Get the Flash Player to see this player.
Home Define Data More: Formatting
 
How To Format Your TCPmaker Dedicated Web Server Data w/ No Code PDF Print E-mail

String variables can contain standard format strings that you can use to control how your data is displayed.

 

Suppose you want to read a pot on your board, and the two end terminals of the pot are connected to ground (0.0 V) and the 3.3V supply.  You create a numeric transfer variable in TCPmaker, called Pot1.  The chip has a 10-bit ADC, so it returns raw values in the range of 0..1024.  You set the scaling parameters for variable Pot1 as follows:

 

mn = 0,   mx = 1023

pn = 0.0,  px = 3.30

 

You create a String Variable called Sv1 to display the value of Pot1.  You set the f property of the string variable to be:

 

%5.3f Volts

 

and you set the argument list property of the string variable to be

 

Pot1.

 

Then, in the Visual Page Designer, you simply associate the string variable Sv1 with one or more controls in your layout.

 

After you generate your code, you add some PIC code to read the ADC channel that is connected to the wiper of the pot, and simply place the raw ADC result into variable Pot1 and set the flag to send Pot1 to the PC browser. That's the only coding you have to do.

 

When you run your device and turn the pot all the way up, so that your PIC code reads the full scale value 1023 from the ADC, it sends that to the PC in variable Pot1.  The PC browser will then  show the formatted string

 

3.300 Volts

 

on any screen control that uses your string variable Sv1.

 

When you turn the pot down to half of full scale, the PC browser will automatically change its display to show

 

1.650 Volts.

 

That's all you have to do!

 

 

 

Meet Dr. Bob at His Class at Microchip Masters 2011!

SponsorAd-728x90

Click here to visit the Microchip Masters 2011 Web Site

 

Questions? See our FAQ, contact us by email, or call us at 1-888-474-1041 (toll free in US)
We GUARANTEE our generated code to work correctly, PERFECTLY, every time, or we will make it right!

Home | About Us | Contact Us | USB Tools | TCPmaker Tools | Consulting | Site Map