Topic: P135

Custom Protocol Out (CPO) Instruction

Mnemonic (Keyboard Shortcut) = CPO

Icon / Button =

Purpose

Send structured Hex Based Protocol data to another device in situations where the CPU must communicate to another device that has Hex Based communications and does not have the Modbus RTU Protocol.


Instruction Parameters

Parameter

Parameter Type

Requirements

Description

Count Up

Ladder Input

Must Have

Edge-driven. With every transition of Input from OFF to ON the instruction will execute.

Serial Port

Drop Down Selection

Must Have

The Serial Port from where ASCII data is sent.

Length

Constant

Must Have

The Data Length to be sent, specified in 1 to 4Bytes based on Data Type. Note: Maximum 128 bytes allowed for data.

Data

Numerical Tag or Constant

Must Have

Embedded Data sent out to the Serial Port from a specified Tag or Constant.

Byte Swap

Checkbox Option

Optional

Every Two Characters will be Swapped when Data is sent.

Checksum

Optional

Select if Checksum calculation is to be performed on Data Sent.

Type

Drop-Down Selection

Must Have if Checksum is selected

Type of CRC (Cyclic Redundancy Check) or XOR calculation to perform on the Data to be Sent.  This needs to match the calculation method of the Receiving device.  Enabled when Checksum option is selected.

Checksum Result Offset

Constant

Determines where to place the Checksum result.

Byte Order

Selectable Option

Determines whether the CPU sets the CRC or XOR value as High Byte first or Low Byte first.  Enabled when Checksum option is selected.

Checksum Range

Selectable Option

Determines which Bytes of the Data to be Sent should be used in the Checksum Calculation.  Enabled when Checksum option is selected.

Checksum Preload

Checkbox Option

Optional when Checksum is selected

Different Checksum calculations use different preloads for the calculation.  Check the receiving device technical documentation to determine this value.  Enabled when Checksum option is selected.

No Termination

Selectable Option

Must have No Termination, 1 Character or 2 Characters selected.

CPU will be sending a Fixed number of characters.  This requires no check for a termination character.

1 Character

Selectable Option

This option specifies that the CPU will send out 1 Character that is specified in the Termination Code 1 0x field trailing the String field data.

2 Characters

Selectable Option

This option specifies that the CPU will send out 2 Characters that are specified in the Termination Code 1 0x field and Termination Code 2 0x field trailing the String field data.

In Progress

Boolean Tag

Optional

This bit turns ON when the Ladder Logic attempts to send the Data out of the Serial Port.  This bit turns OFF once the data has been sent.

Complete

Boolean Tag

Optional

This bit turns ON once the Data has been successfully sent out the Serial Port

Use Structure

Checkbox

Optional

Enables the use of Structures.

Note: One of theSerial Ports must be configured for ASCII/Custom Protocol before configuring this instruction.


Note: Tag Values are updated immediately as each Ladder Rung is executed, top to bottom.  However, Tag Values representing physical Outputs are only applied to the physical Output after the END statement of the last Task to be scanned is reached.  Outputs in Remote Base Groups have additional limitations regarding Update Intervals.


Instruction Configuration

When Custom Protocol Out Instruction is selected the window shown below opens.

Parameter Configuration Table

Custom

Protocol Out

Instruction

(CPO)

Notes

Serial Port

                   

Select a Serial Port

Length

                 

Enter a Value Tag for Data Length.  1 to 4 Bytes.

Data

 

   

Select a Tag to place Data into.

Byte Swap

                   

Select if Input to be Byte Swapped.

Checksum

                   

Select for Checksum Calculation.

Type

                   

Select Checksum Type.

Checksum Result Offset

                   

Enter a value for Checksum Result Offset.

Byte Order

                   

Select High-Low or Low-High Order.

Checksum Range

                   

Select All Ranges or enter a Byte Range.

Checksum Preload

                   

Select based on Communicating device documentation.

No Termination

                   

Select to leave with No termination.

1 Character

                   

Select for 1Termination Character.

2 Characters

                   

Select for 2 Termination Characters.

Termination Code1 0x

                 

Enter a Hexadecimal value.

Termination Code 2 0x

                 

Enter a Hexadecimal value.

In Progress

                 

Select a Boolean Tag for the In Progress bit status.

Complete

                 

Select a Boolean Tag for the Complete bit status.

Use Structures

                   

Enables the use of Structures.

Timing Chart


Application Example

Rung Example


Related Topics Link IconRelated Topics