beautypg.com

Red Lion LEGEND User Manual

Page 36

background image

SENDING COMMANDS AND DATA (Cont’d)

The Address command is used to allow a command to be directed to a specific

unit on the Serial Communications line. When the unit address is zero,
transmission of the Address command is not required. This is done for
applications that do not require more than one Legend.

For applications that require several units, each Legend on the line must be

given a non-zero address. If they are given the same address, a command such as
the Transmit Value Command, will cause all the units to respond simultaneously,
resulting in a communication collision. All Legends in a multiple unit
application should be given an address other than zero. If a unit has an address of
zero, it will attempt to process any transmissions from the other Legends as
commands. These transmissions fill up the receive buffer of the unit with an
address of zero, which may produce unpredictable results.

In a multiple unit configuration an asterisk must be sent to clear the input

buffer of all units on the line after a transmit value or print request command is
sent to a specific unit on the line. The Legend will require a maximum of 50 msec
to process the asterisk (*).

The command string is constructed in a specific logical sequence. The Legend

will not accept command strings that do not follow this sequence. Only one
operation can be performed per command string. Below is the procedure to be
used when constructing a command string.
1. The first two or three characters of the command string must consist of the

Address Command (N) and the address number of the unit (1-99). If the
Legend address is zero, the address command and number need NOT be sent.

2. The next character in the command string is the actual command that the

Legend is to perform (P, R, T, or V).

3. A Value Identifier is next if it pertains to the command. The command P (print)

does not require a Value Identifier.

4. The numerical data will be next in the command string if the “Change Value”

command is used.

5. All command strings must be terminated with an asterisk * (2AH). This

character indicates to the Legend that the command string is complete and
begins processing the command.
Below are some typical examples of properly constructed command strings.

(EX. 1) Change Preset 1 Value to 123.4 on the Legend with an address of 2.

COMMAND STRING: N2VA1234*

(EX. 2) Transmit the Process Count Value of the Legend unit with an address of 3.

COMMAND STRING: N3TE*

(EX. 3) Reset Output 1 of the Legend unit with an address of 0.

COMMAND STRING: R1*

If illegal commands or characters are sent to the Legend, the unit will respond

by transmitting an error character “E” (45H) in which case the string must be
re-transmitted.

When writing application programs in Basic, the transmission of spaces or

carriage return and line feed should be inhibited by using the semicolon delimiter
with the “PRINT” statement. The Legend will not accept a carriage return or line
feed as valid characters.

It is recommended that a “Transmit Value” command follow a “Change

Value” Command. If this is done, the reception of the data can provide a timing
reference for sending another command and will insure that the change has
occurred. When a “Change Value or Reset Value” command is sent to the
Legend, there is time required for the unit to process the command string. The
diagrams show the timing considerations that need to be made.

-34-