Convert between ints and dints – Rockwell Automation Logix5000 Controllers Messages Programming Manual User Manual

Page 16

Advertising
background image

Chapter 1 Controller messages

Tag Name

Type

Description

UCB_Set

MESSAGE

Control tag for the MSG instruction.

Source_Array

SINT[8]

Source values for the MSG instruction, including the number of
unconnected buffers that you want.

In the Logix5000 controller, use the DINT data type for integers whenever

possible. Logix5000 controllers execute more efficiently and use less memory

when working with 32-bit integers (DINTs).

If your message is to a device that uses 16-bit integers, such as a PLC-5 or SLC 500

controller, and it transfers integers (not REALs), use a buffer of INTs in the

message and DINTs throughout the project. This increases the efficiency of your

project.

Read 16-bit integers

Data from the
device

Buffer of INTs

DINTs for use in the
project

Word 1

INT_Buffer[0]

DINT_Array[0]

Word 2

INT_Buffer[1]

DINT_Array[1]

Word 3

INT_Buffer[2]

DINT_Array[2]

Description

The Message (MSG) instruction reads 16-bit integers (INTs) from the device and stores them in a

temporary array of INTs.

A File Arith/Logical (FAL) instruction converts the INTs to DINTs for use by other instructions in your
project.

Convert between INTs and
DINTs

16

Rockwell Automation Publication 1756-PM012F-EN-P - October 2014

Advertising