TCPmaker : Visual Tour    Debugging Communication Problems with mtDebug  

Our message data was:

 <-PC at 5945 msec: <LF>
->PC at 5966 msec: <mt><i0 i="0"/><n0 i="573"/><i1 i="0"/><i2 i="0"/><i3 i="0"/><i4 i="0"/></mt>

Let's take a look at the format of the data in that second line.  The message data is encoded in a simple form of XML, which stands for Extensible markup Language, which is sort of a general purpose cousin of HTML or Hypertext Markup Language that is used in web pages.

Notice first that the whole message begins with <mt> and ends with </mt>

Notice also that, between these beginning and ending snippets, we see several sections that look like this:

 <i0 i="0"/>

You've probably already figured out that this message sends the current value of the integer variable whose ID is i0.  The value is shown in ASCII format inside the quotation marks: "0" in this case.

So, you've probably already figured out that the second line of captured message traffic shown above is telling the PC the current values of variables whose IDs are i0, n0, i1, i2, i3, and i4.  These values are all 0 except for n0.

In our particular project, variables i0...i4 happen to be integer variables associated with the 5 rectangular pushbuttons on our TCPmaker layout, each of which is intended to light up one of the LEDs on the PIC device when we push the corresponding button on the browser.  The PIC code is set up to also report the current values of these variables (i.e. the current states of the LEDs) in response to each message from the PC (even an empty message). We haven't pushed any buttons on the browser screen, so no LEDs have been lit up, and all these integer variables are 0.

The Numeric variable whose ID is n0 is used to carry the current position of a pot on the device. Its reported value of "573 " indicates that the pot is somewhere in the middle of its 10-bit range.  If we turn the pot as we log data in mtDebug, we'll see this value change as the browser display updates the state of the Horizontal Gauge and oscilloscope Plotter that are associated with this variable.

 
  

9 of 11
Copyright Notice and Author Information