Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Building a Webserver with a Wiznet W5100
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM Project Blog
View previous topic :: View next topic  
Author Message
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Mon Jun 23, 2014 12:26 pm    Post subject: Reply with quote

Now a working meter that shows ADC 0 every 4 seconds it updates the reading (the left most meter)
The title and scale is from a variable on the AVR so without editing the web page the meters settings can be changed it is set for 5 volts so a jumper to the 3.3v can give a reading or use a 1.5v battery so now we have a volt meter on the PC , I pad , phone etc.

Also if you have a file error404.htm this will be displayed if a requested page does not exist if no file is found the page from data at the end of the W5100_SDcard.bas will be sent so we can serve pages from flash as well.

Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Thu Jul 03, 2014 10:21 am    Post subject: Reply with quote

Found a very useful function in the dual digital gauge it will load a file from the server at user settable intervals the values will be displayed in the 16 segment display so by making it a cgh/cgi file the AVR will replace the values with whatever you want.
Here is what it looks like showing the 5V supply.
Regards Paul
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Thu Jul 03, 2014 10:55 am    Post subject: great work Reply with quote

Great work Paul.
Back to top
View user's profile Visit poster's website
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Wed Jul 09, 2014 12:15 pm    Post subject: Reply with quote

Another update

I have added a command line server on the rs232 port so now you can get values from the server and set them with a terminal or a program. This gives 3 ways to set the server variables webpage , sd card and rs232. Sending "help" via rs232 gets a help file sent back. As all the subs are modules you can use them separately in your own projects, in the future I will try to make as many possible into functions to save on ram if it was not for the amount of ram being used the program would fit into a 32K AVR.

Regards Paul
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Jul 09, 2014 3:14 pm    Post subject: submask not correct... Reply with quote

Paul

In your code I see that your subnetmask is not correct:

Code:
Config Tcpip = Noint , _
  Mac = 12.128.12.33.46.74 , _
  Ip = 192.168.1.192 , _
  Submask = 255.255.255.0 , _
  Gateway = 192.168.0.254 , _
  Localport = 1000 , _
  Tx = $55 , Rx = $55 , _
  Chip = W5100 , _
  Spi = 1 , _
  Cs = Portb.4
 


submask in this case should be 255.255.254.0



Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Thu Jul 10, 2014 3:40 am    Post subject: Reply with quote

Hello Ben

There is a typo there I have two locations that I write at one has 192.168.0.xxx (VPN link between so different sub nets) the other 192.168.1.xxx just forgot to change one. The server loads the settings from eeprom which gets changed if I change the setting.txt file on the SD card so these initial ones really do not matter as yet but will when I set up a default if there are no settings and no SD card.

Also I forgot to mention there is now also the ability to change the com port speeds via the command line and I will add this to the settings.txt file and the web page.

Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Fri Jul 11, 2014 10:43 am    Post subject: Reply with quote

Found another source of free gauges http://www.bindows.net/free_gauges/ these are ajax so no need for flash just need time to work them out!

Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Sun Jul 13, 2014 9:50 am    Post subject: Reply with quote

I am progressing with the server

Writing new web pages to enter/view variables into the server (will post them when they are working)
Adding more functions to the command line

Changed a lot of sub's so they accept parameters this makes passing variables to them independent without the need for global variables.
I makes it so that they can be used in other programs easily.
The only ones that need Dim statements are those that write to eeprom you need eeprom Dim's.
The exception is the ones using a split() command as arrays are global only.

Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Mon Jul 14, 2014 7:12 am    Post subject: Reply with quote

More functions on the basic1.cgi page which is included in the zip file

Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Sat Jul 26, 2014 12:03 pm    Post subject: Reply with quote

Have some more pages now for the server.

Digital Inputs page shows state of inputs Note for testing it shows the state of the digital outputs.

Digital Outputs page shows state of outputs and has buttons to change them

Edit port names this is where we can enter the name displayed in the above pages for the ports, the colour of the background for the port when it is high & low I store these in eeprom as this is faster than reading the SD card and why not use it.

The program tests for correct lengths of text so it fits into the eeprom variable, there is a sub "Decode_chr.inc" that takes the text sent by the browser and converts the hex values sent for characters that can not normally be sent into their original character.

In the Hex_replace sub I use the hex number to reduce the amount of code and use blocks of 16 to make this simple.

The code is now 40K in the flash there is a lot of checking if inputs are valid which could be left out but the server would be less robust.

I had to go to three characters in the hex ~ values as I exceeded the value that two hex can represent, the Edit port names page has 6 x 16 values on it alone.

Now when creating pages you can create the basic page in a web page editing program but some has to be done in a text editor, when I put in the ~XXX hex codes to replace colours or other non text to be displayed on the page the very helpful editors erase them as it sees them as an error!
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Sat Jul 26, 2014 12:05 pm    Post subject: Reply with quote

Here is the code

Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Wed Jul 30, 2014 1:01 pm    Post subject: Reply with quote

Ok I have a board that has a 40pin dip with sockets Arduino shields,
5v/3.3v 3amp power supply,
second six pin header for programming,
provision to plug a 16 x 2 LCD into the end of the board with a pot for contrast on the board,
provision to set up an external reference for ADC,
provision for TPIC6C595 (High power 74HC595) or 74HC595 & for 74HC165 these provide 8 output ports and 8 input ports using only 4 pins of the AVR Note the TPIC6C595 can drive devices like relays directly
provision for bias resistors on the I2C buss

With this board any of the 40pin dip AVRs can be used but for a web server the MEGA1284 is needed for its ram
some components are surface mounted on the back of the board
TO220 size LM5768 3.3V regulator that uses a 1500 resistor for 5V or a link for 3.3V, SMT inductor & 3A diode
the TPIC6C595 is SO16
the 74HC165 is SO16 these are not to hard to mount

Note the connection to the Arduino 6 pin spi is done via resistors these should be around 100-180 ohms this stops the wiznet shield from interfering with programming the AVR via SPI

The board was done with Kicad attached is a pdf that can be used to print a positive to make it by hand as I did I will attach the Kicad files later
I will make a double sided version later to be commercially made by anyone who wants to
Sorry there is no circuit diagram but its fairly simple to follow

Regards Paul
Back to top
View user's profile
Bojan

Bascom Member



Joined: 15 Feb 2005
Posts: 83
Location: Slovenia

slovenia.gif
PostPosted: Sat Aug 23, 2014 7:04 am    Post subject: Reply with quote

Hello Paul,

Thanks to share with us. It is very useful

Regards,
Bojan
Back to top
View user's profile
tiket

Bascom Member



Joined: 14 Apr 2005
Posts: 31

PostPosted: Mon Nov 10, 2014 8:58 am    Post subject: Reply with quote

Hello Paul,
very good work.
Is possible to have the schematic of your board?

Thanks.
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Mon Nov 10, 2014 11:27 am    Post subject: Reply with quote

Hello tiket

I have been using an Arduino 2560 and the W5100 shield for development you can use the two boards as I have not used all the 8K of ram yet that these AVRs have.
I have also started work on a board that has a 40pin dip with the ability to plug the W5100 shield into so that I can use the Mega1284p with its 16K of ram.
I have made one prototype of the board but it has some changes needed to it so that programming can easily be done with the W5100 shield plugged in.
The serial output and input ports are small development boards I made for testing but only have two ICs on each (two 74HC165 inputs & two 74HC595 outputs).

At present I have now added the ability of sub directories so pics/photo/birds/sparrow.jpg now works.
Also working on an events system so that outputs can be turned on or off at preset date and times or some other tasks done at regular intervals.

There is a lot of work in making the web pages for entry of the data in the EEPROM (times/dates , IP numbers , gateway etc) this has taken a lot of time.

Note it is not intended as a full web server I am building it as an automation server for web control and monitoring of equipment.

So if you get athe Arduino 2560 and W5100 shield you can load the code into it using the Arduino USB cable and Bascom you only need a SPI programmer to change the fuse bit so that EEPROM is not cleared when flash is written but you only need this if you are developing the code like me and do not want to re-enter the values into EEPROM each time you upload new code to the flash.

So to sum up I have not drawn any schematic of my board and you can get the Arduino on line.

Regards Paul
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM Project Blog All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
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