Debugging Netlinx Code With Terminal Or Telnet Messages - AMX NetLinx Studio Instruction Manual

Netlinx design v3.3 or higher
Table of Contents

Advertisement

Building and Debugging Source Code

Debugging NetLinx Code with Terminal or Telnet Messages

This is often referred to as using "SEND_STRING 0's" in your code. Strings sent to device 0 (the master), port 1 or
port 0, system 0 (the local system) will show up in a terminal or Telnet session once the programmer has entered
'MSG ON'<enter>
For example, if this line is in your code:
SEND_STRING 0,'some message'
your terminal will display something like:
(0100636312) some message
when the code executes.
The 13 characters to the left of the message are called the "time stamp" or "tic time". Also, by default, the master will
append a carriage return and line feed to the end of each string.
If the master is v2.10.81 or higher, there are additional MSG ON modes:
1.
All messages with tic time. This is the same as 'MSG ON' with no type.
2.
SEND_STRING 0 only (no tic time in front of string and no CR and LF appended).
3.
SEND_STRING 0 with tic time pre-pended to string.
Example:
MSG ON 2<enter>
sets the message mode to 2.
To turn off these messages type
'MSG OFF'<enter>.
The SEND_STRING 0 message is obviously completely customizable - whatever is typed in will be what you are going
to get.
This can be used as a way to see the value of variables at specific points in the code, by sending that information from
that point, instead of stopping execution with a breakpoint. This is especially useful if programmers have to watch non-
printable data bytes that only show as blank boxes in Windows programs, the SEND_STRING 0 code can reformat the
data as a string of printable ASCII characters.
The 'debug.axi' file (attached to Technote #461) contains 16 subroutines useful for this type of debugging and other
purposes, e.g. DPS_TO_STRING and STRING_TO_DEV are useful for passing DEV information between masters via a
virtual device in a master-to-master scenario. Theses subroutines were created as an AXI so programmers could use a
single #INCLUDE at the top of the program rather than having to dig through the old programs and find the appropriate
code to cut and paste.
1.
FUNCTION CHAR[17] DEV_TO_STRING (DEV dvDEV)
Formatting NetLinx device structures as strings take a little more than the simple ITOA(<device>) that was
done in Axcess.
This function takes a DEV and returns a string in the '<number>:<port>:<system>' format.
2.
FUNCTION CHAR[25] DEVCHAN_TO_STRING (DEVCHAN dcDC)
This function returns a DEVCHAN as a string with brackets in the format
'[<number>:<port>:<system>,<chan>]'.
3.
FUNCTION CHAR[25] DEV_CHAN_TO_STRING (DEV dvDEV, INTEGER nChannel)
Same as DEVCHAN_TO_STRING but takes a separate DEV and INTEGER as parameters.
Returns '[<number>:<port>:<system>,<chan>]'.
4.
FUNCTION CHAR[25] DEVLEV_TO_STRING (DEVLEV dlDL)
This function returns a DEVLEV as a string in the format '<number>:<port>:<system>,<lev>'.
5.
FUNCTION CHAR[25] DEV_LEV_TO_STRING (DEV dvDEV, INTEGER nLevel)
Same as DEVLEV_TO_STRING but takes a separate DEV and INTEGER as parameters.
Returns '<number>:<port>:<system>,<lev>'.
6.
FUNCTION CHAR[17] DPS_TO_STRING (DEV dvDEV)
This function takes a DEV and returns a string in the '<number>:<port>:<system>' format. Same as
DEV_TO_STRING except it always returns the actual system number, not system 0, if the device is so defined.
116
at the prompt.
NetLinx Studio - Instruction Manual

Advertisement

Table of Contents
loading

Table of Contents