How To Format Your TCPmaker Dedicated Web Server Data w/ No Code
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:
and you set the argument list property of the string variable to be
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
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
That's all you have to do!
Learn more about: TCPmaker's Transfer Variables >>
Learn more about: Scaling your data with no code >>
Next: TCPmaker's Screen Controls >>