Serial Data Types
When working with serial units it is often useful to test serial commands directly through iTest. Serial commands come in two types, ASCII commands, and Hex commands.
ASCII commands
ASCII commands are commands that can be typed with a standard keyboard. These commands are human readable and often describe the action that will be performed (e.g. POWER_ON, MUTE, etc.).
The "Literal" mode in iTest allows for sending ASCII data.
Hexadecimal commands
Hexadecimal (Hex) commands are byte commands. These types are not easy for humans to read, and are not always possible to be typed with a keyboard. While Hex commands are documented in various formats they are often written in two character pairs separated by spaces.
Example: `00 09 AB 0D`
Because these character pairs are only human readable representations of the hexadecimal data they will not work when sent directly to the unit without conversion to their byte forms. To get around this iTest has the "Hex" and "Mixed" modes to allow sending of hexadecimal data.
Using iTest for Serial
To use iTest the following steps should be taken after opening iTest:
- Enter the unit's IP address.
- Select the serial port to communicate on. For units with only one serial port select the 'Serial 1 (4999)' radio button. For units with two serial ports select either 'Serial 1 (4999)' or 'Serial 2 (5000)' depending on which serial port you want to send data to.
- Click Connect.
- Select Literal if sending ASCII data, or select the Hex or Mixed modes to send data that contains hexadecimal data.
- Enter the serial command in the Command String field in iTest.
- Literal: In literal mode commands should be typed as written into the commands string field. If the command contains a carriage return (usually denoted as '\r') make sure the Carriage Return Checkbox is checked.
- Hex: In Hex mode commands should be entered as two character pairs separated by spaces. Non-Hex data cannot be entered in Hex mode.
- Mixed: In Mixed mode ASCII data can be entered alongside hexadecimal data. Any hex bytes should be preceded with "0x", "/x", "\x", or "|".
- Click Send.
After sending the data check to see if any response data is seen in the ASCII Response, or Hex Format Response fields.* If the command is supposed to cause the serial device to change state we can also check to see if that state change has occurred.
Also, to confirm transmission devices with LEDs above the serial port will briefly light up when serial data is sent or received. On the Flex, the LED nearest the 3.5mm jack will blink.
*Note: Not all serial devices will provide response data so the absence of a response does not always indicate communication has not been successful.
Examples
Literal Mode
The following example shows a command being sent in Literal mode. The command being sent is "POWER ON\r" and the expected response is "ON!".
Please note that because this command requires a carriage return sending the command without the carriage return checkbox enabled causes communication to fail and no response to be received.
Hex Mode
The following example shows a command being sent in Hex mode. The command being sent is "50 4F 57 45 52 20 4F 4E 0D" and the expected response is "ON!", or "4F 4E 21" in the Hex Format Response.
Mixed Mode
The following example shows a command being sent in Mixed mode. The command being sent is "POWER ON\r", where we are using "\x0d" to represent the carriage return as a hexadecimal byte. The expected response is "ON!".
0 Comments