Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

WizNet5100 and webserver

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
krolikbest

Bascom Member



Joined: 02 Jan 2017
Posts: 66

poland.gif
PostPosted: Tue May 19, 2020 6:55 pm    Post subject: WizNet5100 and webserver Reply with quote

Hi,

currently i'm developing a project its aim is to collect some datas from PLCs (Modbus RTU) and want to display this results on some webpage. Hardware is Arduino Uno and hat - wiznet5100. Modbus and communicatioin with plcs is done, last step (I hope) is to display results onto some main webpage. So I found in examples of Bascom some webserver-spi.bas file. After changed definition of uC - Arduino Uno and tcpip config:
Code:

Config Tcpip = Noint , Mac = 9.9.9.9.9.9 , ip = 192.168.1.6 , Submask = 255.255.255.0 , Gateway = 192.168.1.1 , Localport = 3522 , Tx = $55 , _
         Rx = $55 , Chip = W5100 , Spi = 1 , Cs = Portb.2
 

and leaving the rest unchanged I uploaded this project to Uno. After that I expected that I could from my PC with Chrome/Mozilla/Opera type ip number, let say http://192.168.1.6 and I should get basic info about working webserver, but can't connect. Simply something I'm doing wrong. But what or maybe my expectation according webserver differ from what this server can do? I must admit that I have not idea what this example (webserver-spi.bas) should do. That's why I'm asking for help how to show a main page on webserver which is running on Arduino Uno with wiznet5100.

(BASCOM-AVR version : 2.0.8.0 , Latest : 2.0.8.2 )
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1178
Location: SYDNEY

australia.gif
PostPosted: Wed May 20, 2020 12:03 am    Post subject: Reply with quote

In the blog section is a webserver that I made that served pages from an sd card
and also showed data from ports its configuration was done on web page
I also show how to put data into pre prepared web pages both in flash and from sd card.
The functions are contained in separate modules.
But the big thing with web servers is the amount of data you need to
handle that comes from web browser requests means you need lots of ram
so chips with 4k only just work 8k chips are better but the best chip is the mega1284p with 16k of ram
Regards Paul
Back to top
View user's profile
krolikbest

Bascom Member



Joined: 02 Jan 2017
Posts: 66

poland.gif
PostPosted: Wed May 20, 2020 7:38 am    Post subject: Reply with quote

Ok, thanks. Time to study.
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1178
Location: SYDNEY

australia.gif
PostPosted: Wed May 20, 2020 11:28 am    Post subject: Reply with quote

Quote:
Ok, thanks. Time to study.

Yes its a lot of code!
Note also I have designed a board for the mega1284p that takes the Arduino boards
it has power supply , rs232 buffer , I2C and provision for RTC
your welcome to the artwork if you want it.
Regards Paul
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 671

poland.gif
PostPosted: Wed May 20, 2020 11:51 pm    Post subject: Reply with quote

Hello @królikbest Very Happy (for those from other countries it means best rabbit Very Happy)

My first webserver was builded on MCS Sample and Paulvk very helpful code..
After some time, when device must communicate over USB (RX0), BT(RX3), Ethernet(SPI) and even ESP8266(RX2) I found that this is a fine way to write one function for parsing incomming data. So if youll be studdy Paulvk code take in mind that this can be done slighly better when it is from the begining writed like "universal for any interface".

In my code message received from every interface is passed into function "parse_it". Sommetimes I pass into the function from what interface I got data/question so uC will answear into correct interface.

I dont know if I describe it correctly - one function can handle questions/requests from many interfaces so you can write for device APP for PC or Smartphone and contorol it over any interface.

Example of sharing data from USB and ETH is here -> https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=14608
maybe not optimized but every data passed into the function can make some response Very Happy

After all ... presence some data in the elegant way in the AVR need to 1hour studdy HTML syntax. Gauges needs more time.
Back to top
View user's profile Visit poster's website
krolikbest

Bascom Member



Joined: 02 Jan 2017
Posts: 66

poland.gif
PostPosted: Thu May 21, 2020 10:38 am    Post subject: Reply with quote

Hi

luckily I've run this example from Bascom and now i'm rewriting it to the more simplified version (well at least for me) cos I don't need authorization directly in the code because the whole installation is behind a router with authorization. Still looking through Paulvk code
Next small step to make my project ready will be to read and write from/to sd card....

PS.
I like carrot juice, that's why BestRabbit Smile
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1178
Location: SYDNEY

australia.gif
PostPosted: Thu May 21, 2020 10:44 am    Post subject: Reply with quote

Quote:
Next small step to make my project ready will be to read and write from/to sd card...

That is in one of of the modules reading and writing to sd card with sub directories.
Regards Paul
Back to top
View user's profile
krolikbest

Bascom Member



Joined: 02 Jan 2017
Posts: 66

poland.gif
PostPosted: Thu May 21, 2020 11:23 am    Post subject: Reply with quote

I've downloaded the file "ENC28J60 IO Webserver AMTEGA644.bas" and there i'll be looking for routines according to read/write sd card, this is the right file?
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 920
Location: France

france.gif
PostPosted: Thu May 21, 2020 11:37 am    Post subject: Reply with quote

Hi
to read SD file, I use AVRdos , you have to pay a little bit for it. see the main site https://www.mcselec.com/index.php?option=com_content&task=view&id=20&Itemid=41
And I did an adaptation for M644 1284
as Avrdos need space I subjest to use 1284

you ave to enable iterrupts

For me it's works very well

attached the 3 files .inc
Wink
JP

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
krolikbest

Bascom Member



Joined: 02 Jan 2017
Posts: 66

poland.gif
PostPosted: Thu May 21, 2020 11:47 am    Post subject: Reply with quote

Meanwhile I've foung https://www.mcselec.com/index.php?option=com_content&task=view&id=291&Itemid=57 so need time to compare and figure out how to use it.
Thanks for help.
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1178
Location: SYDNEY

australia.gif
PostPosted: Thu May 21, 2020 11:48 am    Post subject: Reply with quote

There is a W5100 project that is done with .INC files
https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=12358
Regards Paul
Back to top
View user's profile
krolikbest

Bascom Member



Joined: 02 Jan 2017
Posts: 66

poland.gif
PostPosted: Thu May 21, 2020 11:49 am    Post subject: Reply with quote

Thanks!
Back to top
View user's profile
krolikbest

Bascom Member



Joined: 02 Jan 2017
Posts: 66

poland.gif
PostPosted: Fri May 22, 2020 11:03 am    Post subject: Reply with quote

Hi, in the attachment my very simple code:

The problem is that in Chrome browser I've noticed that every refresh of page is probably made twice, so the value of hitcounter is also twice whereas in IE or Mozilla it seems to be ok, I mean that after refreshing a page the value of hitcounter is incremented only by one instead of two like in Chrome. I suppouse that it could be something wrong in my code, especially that Bascom example wroks correctly in all browser types. Or maybe someone has already encountered such problem earlier in Chrome?
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum