#NMLP
Routine to check input from terminal
JP #NMLP,P2CD<2
Jump to error if string
JP #ERROR,P2CD=2
Read value
val=P2NM
EN
End subroutine
#ERROR;CI-1
Error Routine
MG "INVALID-TRY AGAIN"
Error message
JP #NMLP
EN
End
Inputting String Variables
String variables with up to six characters may be input using the specifier, {Sn} where n represents the number of
string characters to be input. If n is not specified, six characters will be accepted. For example, IN "Enter A,B or C",
V{S} specifies a string variable to be input.
The DMC-42x0, stores all variables as 6 bytes of information. When a variable is specified as a number, the value of
the variable is represented as 4 bytes of integer and 2 bytes of fraction. When a variable is specified as a string, the
variable can hold up to 6 characters (each ASCII character is 1 byte). When using the IN command for string input,
the first input character will be placed in the top byte of the variable and the last character will be placed in the
lowest significant byte of the fraction. The characters can be individually separated by using bit-wise operations,
see section Bit-wise Operators.
Output of Data (Numeric and String)
Numerical and string data can be output from the controller using several methods. The message command, MG,
can output string and numerical data. Also, the controller can be commanded to return the values of variables and
arrays, as well as other information using the interrogation commands (the interrogation commands are described
in chapter 5).
Sending Messages
Messages may be sent to the bus using the message command, MG. This command sends specified text and
numerical or string data from variables or arrays to the screen.
Text strings are specified in quotes and variable or array data is designated by the name of the variable or array.
For example:
MG "The Final Value is", result
In addition to variables, functions and commands, responses can be used in the message command. For example:
MG "Analog input is", @AN[1]
MG "The Position of A is", _TPA
Specifying the Port for Messages:
The port can be specified with the specifier, {P1} for the main serial port {P2} for auxiliary serial port, or {En} for the
Ethernet port.
MG {P2} "Hello World"
Sends message to Auxiliary Port
Formatting Messages
String variables can be formatted using the specifier, {Sn} where n is the number of characters, 1 thru 6. For
example:
MG STR {S3}
This statement returns 3 characters of the string variable named STR.
Chapter 7 Application Programming ▫ 131
DMC-42x0 User Manual
Summary of Contents for DMC-42 0 Series
Page 195: ...ICM 2900 PCB Layout Appendices 191 DMC 42x0 User Manual...
Page 205: ...CB 50 100 Drawings Appendices 201 DMC 42x0 User Manual...
Page 206: ...Appendices 202 DMC 42x0 User Manual...
Page 207: ...Appendices 203 DMC 42x0 User Manual...
Page 208: ...Appendices 204 DMC 42x0 User Manual...
Page 209: ...Appendices 205 DMC 42x0 User Manual...
Page 210: ...Appendices 206 DMC 42x0 User Manual...
Page 211: ...Appendices 207 DMC 42x0 User Manual...
Page 214: ...CB 50 80 Drawing Appendices 210 DMC 42x0 User Manual...