Welcome, Guest

Author Topic: Issues With Webpage updates  (Read 1675 times)


  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Issues With Webpage updates
« on: July 05, 2016, 11:53:25 PM »
Hi all,
Im pretty new to PIC's, and am using PIC-WEB revC on a project with some 1 wire sensors.
At this point ive written the 1 wire drivers and incorporated them into the pic code, with the aim of displaying the results on the demo webpage.
I have between 2-10 sensors connected, DS18B20's. I've also reconfigured the webpage to list each sensor and their temps.
My problem is this - once I try to add more than say 3 sensors, the webpage results show "?" and do not up[date automatically. If IU use two sensors, this seems not to be a problem. In other words autoupdating and displaying temps with only two sensors is no problem.
The current code im using is inefficient as ive added no timings to it - its just running a sample and convert from the processIO() subroutine. Ive done the required changes in status.xml, index.htm, deleted httpprint and recompiled the image. This is all good.
In customhttpapp.c, all im doing is running a number of routines (up to 16) calling each sensor and sending the result to the web.

Hope this makes sense. Does anybody have any idea why it would work for two sensors, but not for more.
My guess is that for some reason the main code is not calling customhttpapp.c - can anyone briefly explain to me the link between the maindemo.c and customhttpapp.c
Finally, if I debug the code and look at the sensor variables I can see that all sensors actually have valid data - so its not an issue with the sensor/conversion or sampling. Its purely an issue with getting the result to the webpage.

Looking forward to hearing from you


  • Jr. Member
  • **
  • Posts: 80
  • Karma: +2/-0
Re: Issues With Webpage updates
« Reply #1 on: July 12, 2016, 11:12:43 AM »
Hi Ger!

Sometimes when there is a difference in the number (or sometimes order is also a problem if you don't remove the httpprint.h before generating the new one) of the dynamic variables listed in the "status.xml" and their respective functions that process these values causes the issue with the '?' and not updating their values.

How does all thing works?
Best way to understand this is to read Microchip's manual!

But in brief:
When you define all the dynamic variables (for example in the "status.xml") and then generate the page with "MPFS2.jar" you will receive as a result three files: *.bin which to be uploaded, HTTPPrint.idx and HTTPPrint.h. Inside the "HTTPPrint.h" in addition to the long list of prototypes of functions you also have the function HTTPPrint which consist of one big switch operator. Inside the case clauses of this switch you have calling of each of the functions that process the data which is displayed on the webpage. This HTTPPrint function is called by the stack itself (HTTP2.c, line 964).

So what you have to do is - after you got this file ("HTTPPrint.h") to define what the processing functions must do. You can see as an example any of the already existing functions (for example "HTTPPrint_pot"). In this function you have getting the data from the module, calculating its value (as a string) and send it to the stack.

In your case if you have something like this in the "status.xml" file:
Code: [Select]
After generating file with "MPFS2.jar" inside the "HTTPPrint.h" you will have something like this:
Code: [Select]
case 0x00000010:           // the number will be different probably

And then inside the "CustomHTTPApp.c" you will have to define a function like this:
Code: [Select]
   char DataSensor1[10];
   <processing data (value stored in DataSensor1)>
   TCPPutString(sktHTTP, DataSensor1);

Then recompile the project, upload it and then upload the webpage.
All these things will cause sending the data to the webpage but it won't be shown immediately. You would have to refresh the page. If you want to be updated automatically you must add this variable the same way as it is done with "pot0" and "temp0" inside the file "index.htm", function "updateStatus", lines 95-99.

Try this and tell me what the result is.

As for the other question about why it's working with 2 but not 3 or more. I can't give you a certain answer. If you have removed the temperature and potentiometer variables from the "status.xml" then maybe your sensors are some sort of a "replacement". If you didn't remove them - I have absolutely no idea.

Stan, Olimex
May the Source be with You!