View previous topic :: View next topic |
Author |
Message |
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Tue May 19, 2020 6:55 pm Post subject: WizNet5100 and webserver |
|
|
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 |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Wed May 20, 2020 12:03 am Post subject: |
|
|
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 |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Wed May 20, 2020 7:38 am Post subject: |
|
|
Ok, thanks. Time to study. |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Wed May 20, 2020 11:28 am Post subject: |
|
|
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 |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Wed May 20, 2020 11:51 pm Post subject: |
|
|
Hello @królikbest (for those from other countries it means best rabbit )
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
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 |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Thu May 21, 2020 10:38 am Post subject: |
|
|
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 |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Thu May 21, 2020 10:44 am Post subject: |
|
|
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 |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Thu May 21, 2020 11:23 am Post subject: |
|
|
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 |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Thu May 21, 2020 11:37 am Post subject: |
|
|
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
JP _________________ pleasure to learn, to teach, to create |
|
Back to top |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
|
Back to top |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Thu May 21, 2020 11:49 am Post subject: |
|
|
Thanks! |
|
Back to top |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Fri May 22, 2020 11:03 am Post subject: |
|
|
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 |
|
|
|