The text of a manual · part 29 of 55
Hand-Held Terminal (Catalog Number 1747-PT1) User Manual: 18 - I/O Message and Communication Instructions, pages 247 to 256
Pages 247 to 256 of 486, from Hand-Held Terminal (Catalog Number 1747-PT1) User Manual
The original document is the PDF (1.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 1747-PT1
Page 247
Chapter
A–B
18
I/O Message and Communication Instructions This chapter discusses the following output instructions. • Instructions for use with fixed, SLC 5/01, and SLC 5/02 processors: – Immediate Input with Mask (IIM) – Immediate Output with Mask (IOM)
• Instructions for use with SLC 5/02 processors only: – Message Read/Write (MSG) – Service Communications (SVC) – I/O Interrupt Enable (IIE) – I/O Interrupt Disable (IID) – Reset Pending I/O Interrupt (RPI) – I/O Refresh (REF) IIE, IID, and RPI instructions apply to I/O event-driven interrupts, discussed in chapter 31, Understanding I/O Interrupts – SLC 5/02 processor only. All application examples shown are in the HHT zoom display.
Message Instruction (MSG)
SLC 5/02 Processors Only Message Read/Write
HHT Ladder Display:
HHT Zoom Display: (online monitor mode)
MSG
Output Instruction
(MSG)
ZOOM on MSG –(MSG)– 2.0.0.0.1 NAME: MESSAGE READ/WRITE MSG TYPE: WRITE LD/LS ADDR:N7:40 TARGET: 500 CPU TARG NODE: 5 CTRL BLK: N7:0 TARG OS/AD:N7:6 EN ST DN ER NR TO MSG LEN: 2 0 0 0 0 0 0 EDT_DAT F1
F2
F3
F4
F5
Ladder Diagrams and APS Displays: MSG READ/WRITE MESSAGE Read/write WRITE Target Device 500CPU Control Block N7:0 Control Block Length 7
(EN) (DN) (ER)
18–1
Page 248
Chapter 18 I/O Message and Communication Instructions
This is an output instruction that allows you to transfer data from one node to another on the DH–485 network. The instruction can be programmed as a write message or read message. The target device can be another SLC 500 processor on the network, or a non-SLC 500 device, using the common interface file (data file 9 in SLC 500 processors). When the target device is SLC 500, communication can take place between two SLC 5/02 processors or between a SLC 5/02 processor and a fixed or SLC 5/01 processor. The instruction cannot be programmed in the fixed or SLC 5/01 processor. The data associated with a message write instruction is not sent when you enable the instruction. Rather, it is sent at the end of the scan during service communications of the operating cycle or at the time an SVC or REF instruction in your ladder program is enabled. In some instances, this means that you must buffer data in your application. The processor can service only one message instruction at any given time, although the processor may hold several messages “enabled and waiting.” Waiting messages are serviced one at a time in sequential order (first in first out).
Related Status File Bits Two status bit files are related to the MSG instruction: • Bit S:2/6, DH–485 Message Reply Pending – Read only. This bit becomes set when another node on the DH–485 network has supplied the information or performed the action that you have requested in the MSG instruction of your processor. This bit is cleared when the processor stores the information and updates your MSG instruction status bits. Use this bit as a condition of an SVC instruction to enhance the communications capability of your processor.
• Bit S:2/7, DH–485 Outgoing Message Command Pending – Read only. This bit is set when one or more messages in your program are enabled and waiting, but no message is being transmitted at the time. As soon as transmission of a message begins, the bit is cleared. After transmission, the bit is set again if there are further messages waiting, or it remains cleared if there are no further messages waiting. Use this bit as a condition of an SVC instruction to enhance the communications capability of your processor. You may also be concerned with the function of status file bit S:2/15, DH–485 Communications Servicing Selection Bit. Refer to chapter 27.
18–2
Page 249
Chapter 18 I/O Message and Communication Instructions
Available Configuration Options The following configuration options are available with a SLC 5/02 processor: • Peer–to–Peer Write on a local network to another SLC 500 processor • Peer–to–Peer Read on a local network to another SLC 500 processor • Peer–to–Peer Write on a local network to a 485CIF (PLC2 emulation) • Peer–to–Peer Read on a local network to a 485CIF (PLC2 emulation) Entering Parameters After you select the MSG instruction on the HHT, the data entry display appears. You enter seven parameters in the following order. 1. Select Message Type – ZOOM on MSG –(MSG)– 2.0.0.0.* NAME: MESSAGE READ/WRITE MSG TYPE: READ LD/LS ADDR: TARGET: 500 CPU TARG NODE: 0 CTRL BLK: TARG OS/AD: CTRL BLK 7 WORDS MSG LEN: 0 SELECT MESSAGE TYPE: READ WRITE F1
F2
F3
F4
F5
Choices are READ, WRITE. Read indicates that the local processor (processor in which the instruction is located) is receiving data; write indicates that it is sending data. After you make a selection [F2] or [F4], the display changes to the following: 2. Select Target Device – ZOOM on MSG –(MSG)– 2.0.0.0.* NAME: MESSAGE READ/WRITE MSG TYPE: WRITE LD/LS ADDR: TARGET: 500 CPU TARG NODE: 0 CTRL BLK: TARG OS/AD: CTRL BLK 7 WORDS MSG LEN: 0 SELECT TARGET DEVICE. 500 CPU 485 CIF F1
F2
F3
F4
F5
Choices are 500 CPU, 485 CIF. The target device can be a fixed controller, SLC 5/01, SLC 5/02 processor (500 CPU) or a non–SLC 500 device (485 CIF). For read message instructions, the target device sends data. For write message instructions, the target device receives data.
18–3
Page 250
Chapter 18 I/O Message and Communication Instructions
After you make a selection [F2] or [F4], the display changes to the following: 3. Enter Control Block – ZOOM on MSG –(MSG)– 2.0.0.0.* NAME: MESSAGE READ/WRITE MSG TYPE: WRITE LD/LS ADDR: TARGET: 500 CPU TARG NODE: 0 CTRL BLK: TARG OS/AD: CTRL BLK 7 WORDS MSG LEN: 0 ENTER CONTROL BLK: F1
F2
F3
F4
F5
This is an integer file address that you select. It is a 7–element file, containing the status bits, target file address, and other data associated with the message instruction. After you enter an address, the display changes to the following. 4. Local Destination/Source File Address– ZOOM on MSG –(MSG)– 2.0.0.0.* NAME: MESSAGE READ/WRITE MSG TYPE: WRITE LD/LS ADDR: TARGET: 500 CPU TARG NODE: 0 CTRL BLK: N7:0 TARG OS/AD: CTRL BLK 7 WORDS MSG LEN: 0 LOCAL SOURCE FILE ADDR: F1
F2
F3
F4
LD – Local Destination LS – Local Source
F5
If this is a read message instruction, this parameter is the local destination file address, the address in the local processor which is to store data that is read from the target node. If this is a write message instruction, this parameter is the local source file address, the address in the local processor which stores data that is written to the target node. Valid file types are S, B, T, C, R, N.
18–4
Page 251
Chapter 18 I/O Message and Communication Instructions
After you enter an address, the display changes to the following. 5. Target Node – ZOOM on MSG –(MSG)– 2.0.0.0.* NAME: MESSAGE READ/WRITE MSG TYPE: WRITE LD/LS ADDR:N7:40 TARGET: 500 CPU TARG NODE: 0 CTRL BLK: N7:0 TARG OS/AD: CTRL BLK 7 WORDS MSG LEN: 0 TARGET NODE:0 F1
F2
F3
F4
F5
This is the node number of the device that the local processor is reading or writing to. After you enter a node number, the display changes to the following. 6. Target File Address/Offset – ZOOM on MSG –(MSG)– 2.0.0.0.* NAME: MESSAGE READ/WRITE MSG TYPE: WRITE LD/LS ADDR:N7:40 TARGET: 500 CPU TARG NODE: 5 CTRL BLK: N7:0 TARG OS/AD: CTRL BLK 7 WORDS MSG LEN: 0 TARGET FILE ADDR: F1
F2
F3
F4
OS – Offset AD – Address
F5
If the target device is a 500 CPU, this is the source or destination file address in the target processor. Valid file types are S, B, T, C, R, N. If the target device is 485 CIF, this is the offset value in the common interface file.
18–5
Page 252
Chapter 18 I/O Message and Communication Instructions
After you enter an address, the display changes to the following. 7. Enter Message Length – ZOOM on MSG –(MSG)– 2.0.0.0.* NAME: MESSAGE READ/WRITE MSG TYPE: WRITE LD/LS ADDR:N7:40 TARGET: 500 CPU TARG NODE: 5 CTRL BLK: N7:0 TARG OS/AD:N7:6 CTRL BLK 7 WORDS MSG LEN: 0 ENTER MESSAGE LENGTH:0 F1
F2
F3
F4
F5
This is the length of the message in elements. The 1–word elements are limited to a maximum length of 41. The 3–word elements (T,C,R) are limited to a maximum length of 13. The destination file type determines the number of words that are transferred. Examples: A MSG read instruction specifying a target file type C (counter), a destination file type N (integer), and a length value of 1 will transfer 1 word of information. A MSG read instruction specifying a target file type N, a destination file type C, and a length value of 1 will transfer 3 words. The message length is the final parameter. After you enter it, the display changes to the following. ZOOM on MSG –(MSG)– 2.0.0.0.* NAME: MESSAGE READ/WRITE MSG TYPE: WRITE LD/LS ADDR:N7:40 TARGET: 500 CPU TARG NODE: 5 CTRL BLK: N7:0 TARG OS/AD:N7:6 CTRL BLK 7 WORDS MSG LEN: 2 SELECT MESSAGE TYPE. READ WRITE ACCEPT F1
F2
F3
F4
F5
Pressing [F5], ACCEPT, completes the entry of parameters. If you must change any of the parameters, you can run through the entry of parameters again before you press ACCEPT.
18–6
Page 253
Chapter 18 I/O Message and Communication Instructions
Control Block Layout The control block layout if you select 500 CPU as the target device: Control Block Layout – 500 CPU 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 EN ST DN ER
EW NR TO
Error Code
Target Device Node Number
Word 0 1
Reserved for message length in words
2
Target Address File Number
3
Target File Type (S, B, T, C, R, N) Code
4
Target Address Element Number
5
Reserved
6
The control block layout if you select 485 CIF as the target device: Control Block Layout – 485 CIF 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 EN ST DN ER
EW NR TO
Error Code
Word 0
Target Device Node Number
1
Reserved for message length in words
2
Target Device Offset
3
Not used
4
Not used
5
Not used
6
MSG Instruction Status Bits The upper byte of the first word in the control block contains the MSG instruction status bits. • Bit 15, EN – Enable bit. This bit is set when rung conditions go true and the instruction is being executed. It remains set until message transmission is completed and the rung goes false. • Bit 14, ST – Start bit. This bit is set when the processor receives acknowledgement from the target device. The ST bit is reset when the DN bit or ER bit is set. • Bit 13, DN – Done bit. This bit is set when the message is transmitted successfully and is replied to by the target device. The DN bit is reset the next time the associated rung goes from false–to–true. • Bit 12, ER – Error bit. This bit is set when message transmission has failed. The ER bit is reset the next time the associated rung goes from false–to–true. • Bit 10, EW – Enabled and waiting. This bit is set after the enable bit is set and the message is waiting to be sent. • Bit 09, NR – No response bit. This bit is set if the target processor does not acknowledge the message request. The NR bit is reset when the ER bit or DN bit is set. • Bit 08, TO – Time out bit. You can set this bit in your application to remove an active message instruction from processor control. Your application must supply its own timeout value. An example appears on page 18–13. 18–7
Page 254
Chapter 18 I/O Message and Communication Instructions
When you are online, you can locate the cursor on the MSG instruction, press the Zoom key, and observe the current status of some of these bits: ZOOM on MSG –(MSG)– 2.0.0.0.2 NAME: MESSAGE READ/WRITE MSG TYPE: WRITE LD/LS ADDR:N7:40 TARGET: 500 CPU TARG NODE: 5 CTRL BLK: N7:0 TARG OS/AD:N7:6 EN ST DN ER NR TO MSG LEN: 2 0 0 0 0 0 0 EDT_DAT F1
F2
F3
F4
F5
Successful MSG Instruction Timing Diagram Target node Rung goes True. receives packet. 1 EN 0 EW
1 0
1 ST 0 1 DN 0 1 ER 0
18–8
Target node processes packet successfully and returns data (read) or writes data (success).
Page 255
Chapter 18 I/O Message and Communication Instructions
MSG Instruction Error Codes When an error condition occurs, the error bit ER is set. The lower byte of the first word in the control block indicates the type of error: Error Code (decimal)
Error Code (binary)
Error Code (hex)
2
0000 0010
02H
Target node is busy. The MSG instruction will automatically reload. If other messages are waiting, the message is placed at the bottom of the stack.
3
0000 0011
03H
Target node cannot respond because message is too large.
4
0000 0100
04H
Target node cannot respond because it does not understand the command parameters.
5
0000 0101
05H
Local processor is offline.
6
0000 0110
06H
Target node cannot respond because requested function is not available.
7
0000 0111
07H
Target node does not respond.
16
0001 0000
10H
Target node cannot respond because of incorrect command parameters or unsupported command.
55
0011 0111
37H
Message timed out in local processor.
80
0101 0000
50H
Target node is out of memory.
96
0110 0000
60H
Target node cannot respond because file is protected.
241
1111 0001
F1H
Local processor detects illegal target file type.
231
1110 0111
E7H
Target node cannot respond because length requested is too large.
235
1110 1011
EBH
Target node cannot respond because target node denies access.
236
1110 1100
ECH
Target node cannot respond because requested function is currently unavailable.
250
1111 1010
FAH
Target node cannot respond because another node is file owner (has sole file access).
251
1111 1011
FBH
Target node cannot respond because another node is program owner (has sole access to all files).
Description of Error Condition
18–9
Page 256
Chapter 18 I/O Message and Communication Instructions
To view a MSG instruction error code when troubleshooting, add a MVM instruction to the program as shown in the example below. This example assumes the control block is an integer file. MVM Source Dest Mask
N7:0 0OFF B3:0
Application Examples 1. Application example 1 is shown below. It indicates how you can implement continuous operation of a message instruction. 2. Application example 2 begins on page 18–11 through 18–12. It involves a SLC 5/02 processor and a SLC 5/01 processor communicating on a DH–485 link. Interlocking is provided to verify data transfer and to shut down both processors if communications fails. Operation: A temperature-sensing device, connected as an input to the SLC 5/02 processor, controls the on-off operation of a cooling fan, connected as an output to the SLC 5/01 processor. The SLC 5/02 and SLC 5/01 ladder programs are explained in the figure on page 18–11. 3. Application example 3 appears on page 18–13. It shows how you can use the timeout bit TO to disable an active message instruction. In this example, an output is energized after five unsuccessful attempts (two seconds duration) to transmit a message.
Example 1 0
1
B3 ] [ 1
MSG READ/WRITE MESSAGE Read/write WRITE Target Device 500CPU Control Block N7:0 Control Block Length 7
(EN) (DN) (ER)
N7:0 (U) 15*
N7:0 ] [ 13* N7:0 ] [ 12*
2
* MSG instruction status bits: 12 = ER 13 = DN 15 = EN
END
Operation Notes Bit B3/1 enables the MSG instruction. When the MSG instruction done bit is set, it unlatches the MSG enable bit so that the MSG instruction will be enabled in the next scan. This provides continuous operation. The MSG error bit will also unlatch the enable bit. This provides continuous operation regardless of errors. 18–10