At present, there are three types of transfer variables in a TCPmaker embedded PIC web server:
Integer Variables transfer data in either direction (to or from the PC), and this data remains in integer form on both sides. Like all of TCPmaker 's transfer variable types, an Integer Variable has a name, a short ID, and a value.
Numeric Variables transfer also data in either direction, but the data is not in the same form on both the PIC and PC side. The value of a Numeric variable is used in integer form in the PIC device (and sent in integer form over the Ethernet as well). However, it is scaled and transformed to floating point form on the PC browser. This lets you display variables in floating point format on the PC, without having to do floating point arithmetic (or even having to load the larger floating point libraries) in your PIC code.
String Variables are often used to display titles and headings on TCPmaker screen controls displayed on the browser. Optionally, a String Variable can contain a standard C-style format string, to display your data in a format that you control. This very powerful capability is done on the PC side: your PIC code does not need to do any formatting of the data with format statements, so your PIC code can stay small and simple.
Integer and Numeric variables are easily set up to send values, from TCPmaker screen controls on the PC browser, to the PIC device. Once a variable and a screen control have been defined in the Visual Page Designer , all you need to do is associate a variable with a control, on the property page that is displayed when the control is selected.
For instance, suppose we have a pushbutton control called Pb1 in our layout, and we have already defined an Integer variable called D1, that we want to send to our PIC to light up LED1 on our board. All we have to do is to select pushbutton Pb1 on our layout, and on its property page, we look for the i property, drop down the list of existing integer variables, and select variable D1.
Once we do that, any time we press the pushbutton Pb1 on our layout, variable D1 is given a value of 1 and sent to our PIC device. (This value is also sent to any other screen controls in our layout that are also associated with variable D1, so they can update their display states as well.)
[image needed here, to show the sequence of how clicking Pb1 changes variable D1 & lights LED1]
In our PIC code, a simple event handle will be automatically called, so we can just assign the new value of D1 that was just received by the PIC, to the digital I/O pin connected to LED1. This was a 1, so LED1 turns on.
When the pushbutton Pb1 is released and goes to its inactive state, the variable D1 is given a new value of 0. This new value is then sent to the PIC device and to the other screen controls. When the new value of 0 is assigned to the pin connected to LED1, the light turns off.
Learn more about: Scaling your data with no code >>
Read more about: Formatting your data with no code >>
Next: TCPmaker's Screen Controls >>