TCPmaker : Visual Tour    Exploring and Customizing the Generated Code  

Let's focus on one particular TCPmaker Variable, D1, which is intended to carry a value from the PC to the PICDEM.net2 board, in order to turn a particular LED on or off.

Here is the declaration of D1 in file mtGen.c:

// Variable D1 - Diode D1 connected to RJ7
// Used by these controls in browser layout:
// D1 Class=Iv Id=i0 **In** **Out**
// Pb1 Class=Pb Id=pb1 --- Page: name=Index Class=Pg Id=index
int D1; // Data transfer variable as created in Visual Page Designer
unsigned char D1TxFlag; // Transmit flag for this variable: set True to send

TCPmaker has declared a variable named D1 in your C code for the PIC microcontroller: this is a variable of the same name that you created in TCPmaker's Visual Page Designer.  TCPmaker has also declared a corresponding flag called D1TxFlag that you can use if you want to send this D1 variable back to the PC for any reason.

The comment header above the variable gives us information to remind us of the intended use of this variable.

The string "Diode D1 connected to RJ7" was the comment that we created for this variable when we created it in the Visual Page Designer.  (It is a good idea to add a meaningful comment for every variable that you create, because this comment will be automatically reproduced in your generated code to remind you of what the variable is to be used for.)

  • D1 is an Integer Variable ("Class=Iv") whose Id is "i0", and which can send data either IN to the PC or OUT from the PC.
  • This Variable is used by only one Control in your TCPmaker layout: a Pushbutton control ("Pb1 Class=Pb Id=pb1") located on the main page of our layout ("Page: name=Index Class=Pg Id=index ").

When we say that D1 is used by Pushbutton Pb1, we mean that any time Pb1 is pressed or released on the PC browser screen, instructions in file run.xml tell our library run.swf to assign a new value to variable D1, and send that new value to your device.



7 of 21
Copyright Notice and Author Information