Send Serial Data in Advanced Ladder

See also: Serial Communication in Advanced Ladder

See also: Project Toolbox for Advanced Ladder

 

 

The Send Communication Data function is used to transmit ASCII data on a port that has been opened with the Open Communications Port function and specified as “Generic ASCII” protocol. Noting the triangular “ > ” symbol on the input rung of the function, it will do as configured one time when it receives power. Interruption to rung input power and re-applying rung input power is required to function again.

The Send Communication Data function is meant for use with 8-bit ASCII data. Each 8 bits, or 1 byte of data is the space a single ASCII character consumes. Therefore, “Bytes” is synonymous with “Characters” in this case. ASCII characters used may be any of 255 characters to include the standard ASCII characters from character code 0x00 through 0x7F (decimal 0 – 127, “printable” characters such as numerals, the alphabet, and “non-printable” characters such as carriage return, line feed, etc.) as well as codes 0x80 through 0xFF (decimal 128 – 255, characters normally defined by the device manufacturer). See also: ASCII Character Codes in Serial Communication in Advanced Ladder

More than one Send Communication Data function may be used. They can be thought of as Move functions that move data from the specified Data Address parameter to the serial port transmit buffer.

Port: The port on which to send data. This must be a port previously opened with the Open Communications Port function [see: Serial Communication in Advanced Ladder] function and specified as “Generic ASCII” protocol.

Number of Bytes: Variable/register or constant value determining the number of bytes to send when this function is used. Synonymous with the number of ASCII characters to send. Up to 255 Bytes may be sent at a time.

Data Address: Variable/array/registers from which to get the data to send. In the case of 16-bit registers such as %RClosed Retentive 16-bit registers., 2 ASCII characters are packed into one register. Consecutive elements/registers will be used accordingly as dictated by the Number of Bytes parameter.

TX Count Address: Variable/register that contains the number of bytes/characters transferred to the port’s transmit buffer so far when the function is powered. The TX Count maximum value is the number specified by the Number of Bytes parameter. The value when the function is not powered will be -1 when viewed as INTClosed Integer - [Data Type INT] - A 16-bit signed value. Integers are used where the value of the data is expected to be in the range of -32,768 to +32,767. format.

 

Power Flow

The Send Communication Data function executes immediately as soon as it receives power from the incoming rung.

The Send Communication Data function will execute one time when it is powered. Power must be removed and reapplied to send more data.

Assuming the specified port has been opened, the Send Communication Data function will pass power flow to the next function on the rung when the data has been completely transferred to the serial port buffer. This may take more than one OCS scan. Function completion is also indicated by the TX Count matching the number of bytes to send.

If the port has not been opened, or if the number of bytes specified is outside the range of 0 to 255, no power flow through the function will occur.

There is no need for any further functions to exist to the right of the Send Communication Data function on the rung. The function’s result is considered an output.

 

Return to the Top: Send Serial Data in Advanced Ladder