TCPmaker : Visual Tour How Variables and Controls Work Together |
To send a data item from the device to the PC browser, you must do 3 things:
1) Assign a value to the variable, e.g.:
MyVar = 5; // or it could be an A/D converter result
2) Set the transmit flag for that variable to true (any non-zero value), e.g.:
MyVarTxFlag = 1;
3) Synchronize these actions to the MicroTrace Server by doing the above steps
in one of the general mtServer Event* handlers below. (We suggest putting
these in the mtEndOfMessage() event handler.) Doing so will make
everything operate smoothly.
-OR-
You could synchronize these actions by placing them in one of the receive
event handlers discussed above.
If the variable you are sending to the PC is a Numeric Variable, remember that you are supposed to assign a value (to the integer variable that TCPmaker has declared for this variable) that lies between the values of the mn and mx properties of that Numeric Variable, before you set the TxFlag. When received by run.swf on the PC side, the Numeric Variable will automatically scale the integer value you sent, to a floating point value in the range between the values of the variable's pn and px properties.
* We will discuss the general mtServer Events in a later tutorial.
1 2 3 4 5 6 7 8 9 10 11 12 |