ICC

13.2.8 ControlLogix Example: Read a Register Block

This example program will show how to continuously read a block of registers from the drive with a single MSG instruction. Only one read request is outstanding at any given time.

1)Create new Tags.

a)Double click “Controller Tags” in the controller organizer view.

b)The “Controller Tags” window appears. Refer to Figure 92.

Figure 92: Create New Tags

c)Select the “Edit Tags” tab at the bottom.

d)Create a new tag by entering “connection” in the first blank Name field, and change its Data Type to “MESSAGE”. This tag will contain configuration information for the MSG instruction.

e)Select the “Monitor Tags” tab. Expand the “connection” tag by clicking on the “+” sign next to the tag name. Scroll down to the connection.UnconnectedTimeout field and change its value from the default 30000000 (30s in 1uS increments) to 1000000 (1s). This value determines how long to wait before timing out and retransmitting a connection request if a connection failure occurs. Refer to Figure 93.

Figure 93: Reduce the UnconnecteTimeout Value

f)Collapse the “connection” tag again by clicking on the “-“ sign next to the tag name.

g)Select the “Edit Tags” tab again. Create another new tag by entering “data_array” in the next blank Name field, and change its Data Type by typing in “INT[100]” in the Data Type field. This tag is an array of INTs that will be able to hold up to 100 16-bit registers from the drive. Always make sure that the destination tag size is large enough to hold all elements to be read.

85