26
MAS7.1 Suplemental Guide, Rev 1.1, 9/28/07
K.I.S.S.™
Keep It Simple Serial
The Response Strings (Continued)
The Acknowledgement is always the string:
+<CR><LF>
and the Error Response is always the string:
!ERR<CR><LF>
By parsing only the prefix characters ‘+’ and ‘!’, a programmer can chose to ignore the error codes and simply
look at the first characters of the response strings and use them as a pass / fail indicator when issuing a com-
mand.
All response strings always end with a <CR><LF>.
A Query Response string always starts with the ‘=’ characters and is followed by a command string indicating
the parameter(s) being returned. This is better explained in an example.
An example of querying a device for its light intensity settings:
LI?<CR>
Sent: Light Intensity Query command
+<CR><LF>
Received: Acknowledgement of command
=LI 3,2,80<CR><LF>
Received: The ‘LI’ Query Response
Note that a “+<CR><LF>” followed the command string. A command string is always followed by either an
Acknowledgment (as in this case) or an Error Response. This consistency allows a driver to use a single rou-
tine to issue a command and check for an Acknowledgement or an Error Response String, whether or not the
command queries for a response.
An example of an error response:
IL?<CR>
Sent: Command characters transposed, no such command
!2<CR><LF>
Received: Error Response indicating unknown command
In this case the Error Response string “!2<CR><LF>” was issued instead of the acknowledgment string since
the command was not recognized.
Response String Checksums and CRC-8 Checkcodes
Response strings can be programmed to have checksums or CRC-8 checkcodes appended to them, the syn-
tax is identical to the Command Structure’s checksum and CRC-8 handling.
Checksum and CRC-8 are turned on and off by issuing the proper command. On most devices this is the “Con-
trol Settings” command.
Only the Error Response and The Query Response strings will have checksum and CRC-8 checkcodes
appended to them. The Acknowledgment Response will always consist of “+<CR><LF>”. Anything else must
be assumed to be a communication error.
An example with checksumming enabled, while querying for LED intensities is:
LI?<CR>
Sent
+<CR><LF>
Received
=LI 3,2,80;21<CR><LF>
Received
An example with CRC-8 responses enabled is:
LI?:194<CR>
+<CR><LF>
=LI 3,2,80:207<CR><LF>