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, display, or other hardware from a Biamp Tesira device via RS-232. Serial Command String blocks can be initialized with up to 32 channels. Each channel can contain a string that can be triggered by logic, presets, or TTP from a control system. More than one Serial Command String blocks can exist in a Tesira system and they can be assigned to multiple devices.
Carriage Return (0d) and Line Feed (0a)
Many devices can be controlled with 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.
Tesira does not transmit a string unless a carriage return and/or line feed is sent after each command. The 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 (escape character) 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.
Configuring the serial port
The Tesira device that will be sending command strings will need to have its serial port configure for the correct communication mode. The Port Settings is located in the Device Maintenance window. Highlight the desired device and click the Port Settings button.
The port settings window is where you configure the baud rate for serial communication. The default rate depends on your Tesira model. Ensure this matches the attached serial device that will receive RS-232 strings.
The usage setting may also need to be configured. It must be "Both" or "Command String" on the usage value. Settings of "TTP" or "None" will not allow the device to send serial RS-232 command strings.
Allocating to the device
The allocated unit ID of the serial command string block determines which device will send RS-232 strings from its serial port. Allocation is configured on the properties sheet of the block. Fixed in unit should be set to true if the system contains more than one Tesira device with a serial port. The software may move the block to another unit during the compilation process. Multiple command string blocks can be used within a single Tesira configuration file and allocated to different devices, such as multiple TesiraLUX and EX-LOGIC devices.
When using devices that have more than one serial port, such as the Tesira SERVER-IO, the properties sheet is where you also define which serial port will be used for that channel of RS-232 commands.
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