Need help for for simple modification with PIC WEB

Started by brunom, January 29, 2014, 10:56:27 PM

Previous topic - Next topic


I have a PICWEB board.  I want to change the default web page to put some text of my own (this part is ok because I used the HELLO WORLD example in pdf doc).  I can generate the MPFS file and upload it to the PIC web server.  Everything is fine until there.  Now, I just want to add the status BUTTON, temp and CLICK for LED activation options to my little web page (in the same way of the DEMO OLIMEX WEB PAGE).  Technically, I shouldn't have to declare any new IO because I'm using the same ones.  I can't figure out what files to edit and what to compile.  Do I have to generate another HEX file?  Can I do this just by editing and changing the index.htm file?  What part of the code I have to add???  It's so unclear. 

I'm lost and I don't find simple examples to follow.  :-(

Can someone help me please?


Hello, Brunom!

Editing the webpage is simple but adding dynamic variables (like these that you meantion: button, temperature, LED etc.) is a little bit more complicated.

On way to "define" them is inside the "status.xml" file (check the file in the example webpage). So when you use the MPFS2.jar tool in addition to *.bin (the webpage) the tool will also generate HTTPPrint.h and HTTPPrint.idx files (if you REALLY change the dynamic variables it is important to delete/backup them before generate them again). And since the HTTPPrint.h might be different and it is included inside the project, you will have to rebuild the project and reprogram the board.

Basically the content of HTTPPrint.h is just a list of prototypes of functions and a huge switch operator with a lot of case clauses which actions is a simple call of a specific function (something like HTTPPrint_led, HTTPPrint_temp etc.). The functions themselves are defined somewhere inside your project. Usually in the CustomHTTPApp.c (not necessary though). This is from the board side.

But from the webpage side responsible for the actual appearance (like green/grey dot for the LED, ^/V sign for the button etc.) are the files of the webpage (like index.htm, mchp.js etc.)

It is up to you to decide how to proceed but my advice to you is first look at the example webpage as a pattern to see how the stack works before starting your own from the scratch.

Best regards!
Stancho, Olimex
May the Source be with You!


Hello Stanimir5F,

Thank you for your answer.
So If I understand you well, even If I don't want to declare new variables, I have to rebuild the project and reprogram the board, right?

Because, as mentionned, I just want to change Olimex demo web page using the EXACT same declared variables.



Ok I got it.  I found the web pages in Webpages2 directory and I don't have to compile every time since I use the same config.  I hade to declare extras IO and then, recompile and HEX download was necessary.

Beginning to see light!



Rebuilding and reprogramming are necessary only when the HTTPPrint.h is different because this file is included into the project. But it will be different if you change some of the dynamic variables. Most of them (but not all) are defined in the status.xml.
If you wish just to change the appearance of the pages, you don't have to rebuild, only updating with the new *.bin file.
May the Source be with You!