PIC-WEB Project difficulties:

Started by aaz1978, May 07, 2015, 09:50:09 AM

Previous topic - Next topic

aaz1978

Hi, I was wondering if anyone could help.  I am beginner in terms of PIC development (I have dabbled in the past with a little bit of assembly). I bought this development board to get an understand of how I can use the Ethernet functionality using a PIC, I am particularly interested in sending instructions and receiving data via a web based application or html page.

I ran the project and have managed to get it working, which is fine, however there does not seem to be anywhere where it actually explains how this project was created and if I want to make modifications.  For example when I look through the code, it seems to show 8 LEDS, however the board only has one red LED, also in the FORM PROCESSING section it has GREEN LED option! Is this for another development board?  There doesn't seem to be that much material or guides to help me understand how to take control of these features.

In a nutshell what I want to create is my own form where I can send and receive data.

Much appreciated.

JohnS

You probably need to get used to Microchip things like MPLAB and their TCP/IP stack.

John

Stanimir5F

#2
Hello!

As JohnS suggested maybe the best starting point for you is Microchip Libraries for Applications (older versions were called Microchip Solutions). It is free for download and on this link you can get the latest version: http://www.microchip.com/pagehandler/en-us/devtools/mla/home.html . But the example provided on our web site is based on an older version released on 2013-06-15. There you can find what you need as an explanation (TCPIP Stack Help.pdf). You can see it also here: http://www.egr.msu.edu/classes/ece480/capstone/fall11/group03/TCPIP%20Stack%20Help.pdf , but I'm not sure about what version is this one.

In code you can see 8 LEDs because the original example of Microchip was made to support up to 8 LEDs. But since on our board (PIC-WEB) we have only one the rest of them are ignored. You can see in "Configs\HWP OLIMEX_PIC_WEB.h" file lines 87-102 that only one of them is used (LED1). The same idea with the buttons.

As for the red/green LED question. It's my fault that I wrote green. The LED is red and I don't know why I wrote green in the file. But until now nobody notify me about this. Also I just found another mistake that it should be "led1" instead of "led0".

The transmission of data is something that you should read more about in the help file I told you earlier.
I will try describe it briefly - let's take for example how potentiometer value is printed on the index page.
1) In file status.xml (line 5) - you have a variable for the potentiometer value called pot0 (the name in the <> brackets is how it is called in the web server, the name between ~~ is for the MPLAB part).
2) In file index.htm (line 14) - you have a section in the web page where it is printed.
3) When this is done build the web page using MPFS2.jar tool (located here: "..\Microchip\TCPIP Stack\Utilities\MPFS2.jar). Keep in mind that when you change the status.xml file (which in this case will be done) you MUST remove/rename/backup these three files: HTTPPrint.h; HTTPPrint.idx and MPFSImg2 Prebuilt.bin (or whatever the name of the page is), before generate the new three files.
4) In file HTTPPrint.h (line 64) - you have declared a function called HTTPPrint_pot ()
5) In file CustomHTTPApp.c (lines 1935-1964) - you have the actual calling of the function that calculates the value that should be displayed on the page.
6) Rebuild the project, upload the hex, upload the new webpage bin file.

Keep in mind that by doing this you will have to refresh the page to see new value. The fact that potentiometer (and other peripherals) is self-updated is caused by java script (index.htm, lines 68-103).

Stan, Olimex
May the Source be with You!

aaz1978

Thanks Guys!

I will have a good read of the material that you passed me, sometimes all you need is a pointer in the correct direction as it looks overwhelming when you first start off.

Much appreciated!