The new generation of dataloggers have the ability to host a web page over an IP connection. This connection can be over a cell phone modem or an ethernet connection using an NL115. By default the data logger will host a basic web page with links to the historical data stored on the logger and the station status table. This web page can be replaced with a user defined web page in the data logger programming.

Example Web Page Code

making a custom web page

The example code above creates a web page called default.html (this will overwrite the CR1000 default web page) which displays the following on separate lines;

  • “<img src=””cpu/csa_logo.jpg”” />” - An <img/> html tag has been used to insert a company logo stored on the datalogger CPU drive.
  • “<p>Battery Voltage: “ + batt_volt + “ </p>” - The logger battery voltage has been added onto the end of a paragraph of text (<p></p> tags).
  • “<p>Watchdogs: “ + Status.WatchdogErrors(1,1) + “ </p>” - The number of watchdog errors has also been added on to the end of a paragraph. This time the value has come from the status table (this syntax can be used to access any status table value, refer to Tablename.Fieldname in the CRBasic help for more information).
  • lastrecord_string + “<br/>” - The last ten records in the Test table are displayed one after the other using a “for loop” to avoid writing ten lines of code. All CRBasic programming functions, such as for and while loops) are available between WebPageBegin and WebPageEnd. The GetRecord instruction pulls data from a specified number of records back from a datatable and creates a string from that data. For example: “2010-02-25 09:31:00”,0,11.87,28.14
Datalogger Instructions
The following instructions can be used in your datalogger code to change the default web page:

WebPageBegin()
...
WebPageEnd
These two instructions begin and end a web page section. Multiple sets of instructions can
be used to add more than one web page to the datalogger.
HTTPOut()
This instruction is used inside a web page section (defined by the instructions above) to
output HTML code to the web page.

Basic HTML Code


HTML is the programming language of web pages. It is a set of rules for defining how to layout a web page in the same way that CRBasic is a set of rules for how define a dataloggers operation. HTML is organised into many “tags” which can be used to surround areas of text. Below are some good tags to start with, for more information on HTML tags see: http://www.w3schools.com/html/

<p></p>
Text between these tags forms a paragraph. It will be separated from surrounding text by a
line break and spacing.
<br/> This tag inserts a line break wherever it is inserted.
<img src=””/>
This tag inserts a picture into a web page from the specified source location. This location
can be a relative path from the html file (the web page) or a absolute path such as http://
www.google.com/logo.gif

 Facebook

We're now on Facebook!

Stay informed with our latest updates by following Campbell Scientific Australia.