The Serial Command String block allows serial strings to be sent out of one of the serial ports of a Tesira device. This article describes the proper syntax for command strings sent from the serial port of a Biamp device. It is common to use this syntax when trying to control a projector or other hardware from a Biamp device via RS-232.
Carriage return (0d) and line feed (0a)
Many 3rd party products can accept RS-232 commands. If commands are sent from a PC via a terminal emulation program the user will press the Enter key to "send" the command. This results in hexadecimal (hex) notation control character for a carriage return (0d) and line feed (0a) being appended to the original string. The receiving device interprets these hex values as the end of the command string and executes the command. If they are not received, the receiving device will not know that the string is complete.
Sending the string PWR_ON from a Windows PC terminal emulation program results in the string PWR_ON0d0a once the Enter key is pressed. The receiving device interprets the 0d and 0a as the carriage return and line feed and understands the string is complete.
Different operating systems have different standards for the Enter keystroke. In Windows it is 0d 0a. In Unix and Mac OS X it is 0a. In older Mac OS (OS-9 and earlier) it is a 0d.
Most serial devices recognize either 0d or 0a as a valid end of string argument. If both characters are received and not required it typically results in an empty string being created. This may result in a syntax error message. The RS-232 protocol manual for your device should offer guidance.
Serial Command String block
The Serial Command String block supports upper and lower case characters. Serial command strings are case sensitive, the hex control character string may be case sensitive depending on the receiving device.
A carriage return and/or line feed must be sent after each command. Biamp's Serial Command String block does not automatically add either a 0d or 0a, the user needs to explicitly add them. To allow the unit to recognize the text as a hex character a special notation is required. The tilde (~) is used for this notation. The command string generator will know that the 2 characters after a ~ are meant to be a hex character and will treat them appropriately.
A string must be explicitly terminated with the hex characters for a carriage return and/or line feed. To add a hex character use the tilde (~) plus the hex character desired. Do not add any unnecessary spaces.
Carriage return = ~0d or ~0D
Line Feed = ~0a or ~0A
Sending the string PWR_ON from a Biamp's Command String block results in PWR_ON at the receiving device. If there is no line feed or carriage return (and the device is expecting them), then the receiving device has no way of knowing that the string is complete and should be executed.
To add a line feed and carriage return use the tilde character (~) plus the hex characters (0D and 0A). Do not add any unnecessary spaces. PWR_ON~0D~0A will result in the command PWR_ON with a line feed and carriage return, allowing the receiving device to execute the string. The tilde and following hex character are interpreted as a line feed by the receiving device and are stripped from the command string text.
If you are sending multiple hex characters you must place a tilde before each one. In the example seen below the string would be ~30~30~30~31~0d, notice that the string includes the carriage return hex character.
For the Command String block the correct format is the 2-character hex notation. There are other notations you may see used, convert your characters to hex notation as needed.
0x0D = hexadecimal 0D = decimal 13 = octal 15 (or 015)
0x0A = hexadecimal 0A = decimal 10 = octal 12 (or 012)
More on RS-232 and hex notation can be found here: http://www.commfront.com/RS232_Protocol_Analyzer_Monitor/RS232_Analyzer_Monitor_Tester_Tutorial2.htm