The text of a manual · part 14 of 31
DF1 Protocol and Command Set Reference Manual: 7 - Communication Commands, pages 108 to 117
Pages 108 to 117 of 251, from DF1 Protocol and Command Set Reference Manual
The original document is the PDF (2.1 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.
Filed in the catalog under the Allen-Bradley 5250-LP and Allen-Bradley 5250-MLP1
Page 108
Communication Commands
7–21 read-modify-write N Sets or resets specified bits in specified words of data table memory. The variable N lets you specify the number of sets modified. The interface that receives this command performs this procedure for each PLC-5 system address, AND Mask, and OR Mask in the message packet:
• PLC-5/250 ONLY
1. Copies the specified word in the data table. 2. Resets the bits specified in the AND mask. 3. Sets the bits specified in the OR mask. 4. Writes the word back to its location. Important:
C
DST SRC CMD STS 0F
The controller may change the states of the original bits in memory before this command can write the word back to memory. (Some data bits may unintentionally be overwritten.) To help prevent this, we suggest that you use this command to write into the storage area of a programmable controller’s data table, and have the controller read the word only, not control it. TNS
FNC No. of 79 Sets
PLC-5 sys. address
Mask AND Mask Length
2 or 4 bytes
OR Mask 2 or 4 bytes
(Repeatable up to 243 bytes)
(Repeated for more sets R
CMD SRC DST STS 4F
TNS TNS
EXT STS
If present
Reply
The EXT STS field may be attached to the reply packet only when there is an error. Reply includes low word, low byte and low word, high byte. Optionally, includes high word, low byte and high word, high byte. The PLC-5 system address specifies the word that is modified. Use more than one field to specify more than one word. Must point to a word, and can be either a logical binary address or a logical ASCII address. Each PLC-5 system address field is followed by: • Mask Length indicates the lengths of AND Mask and OR Masks • AND Mask specifies which bits in the word to reset; 0 to reset a bit, 1 to leave it the same • OR Mask specifies which bits in the word to set ; 1 to set a bit, 0 to leave it the same These three fields, along with the PLC-5 system address field, can be repeated up to a length of 243 bytes.
Publication 1770-6.5.16 - October 1996
Page 109
7–22
Communication Commands read section size Reads the size of the section most fully addressed by the system address given. The size represents the size of the memory addressed most fully expressed in words. If the address is more general than a file address, the size also includes the overhead memory used to maintain the file structure. If the address specifies a file, user data is returned.
• PLC-3 • PLC-5
C
DST SRC CMD STS 0F
TNS
FNC 29
R
SRC DST CMD STS 4F
TNS
EXT PLC-3 STS
PLC sys. address Size Low word
Size High word
PLC-5
Size word
Count word
PLC-5/250
Size word
Size High word
Count word Data type Count word
Privilege write read
Data type
The EXT STS field may be attached to the reply packet only when there is an error.
Important:
Some PLC-5 processors return the PLC-5/250 format.
reset diagnostic counters Resets all the diagnostic timers and counters in the node interface module = 0.
• 1774-PLC • MicroLogix 1000 • PLC-2 • PLC-3 • PLC-5 • SLC 500 • SLC 5/03 • SLC 5/04
Publication 1770-6.5.16 - October 1996
C
DST SRC CMD STS 06
TNS
R
SRC DST CMD STS 46
TNS
FNC 07
Page 110
Communication Commands
7–23 restart request (restart)
• PLC-3
Terminates an upload or a download. The computer cannot issue this command until after it has successfully completed an upload or download operation with the destination node. This command causes the interface module to revoke the upload and download privileges for the source computer node and to initialize a PLC-3 restart. C
DST SRC CMD STS 0F
TNS
FNC 0A
R
SRC DST CMD STS 4F
TNS
EXT STS
The EXT STS field may be attached to the reply packet only when there is an error.
Publication 1770-6.5.16 - October 1996
Page 111
7–24
Communication Commands return edit resource Returns the edit resource (sole access) of the processor when editing is completed. When you return the edit resource, the programming device can be written to or modified. • PLC-5 • PLC-5/VME • SLC 500 • SLC 5/03 • SLC 5/04
C
DST PSN SRC PSN CMD STS 0F
R
LNH LNH CMD DST PSN SRC PSN STS HI LO 4F
TNS
FNC 12H TNS
EXT STS
LNH - length of the optional portion of the reply packet in bytes.
"
First four words of return edit resource The first four words are currently unused and unexamined. To assure compatibility with any future use of these bytes, they should be initialized to 0. DST, PSN, and SRC are included for reference only. For this processor
This access is cleared by
SLC 5/00, SLC 5/01, SLC 5/02 any node sending this command
SLC 5/03, SLC 5/04 the programming device or via a timed mechanism internal to the processor sending this command set data table size
• PLC-2
Sets the data table size for the PLC-2 processor. Use this command immediately before any physical writes on the PLC-2 processor. The enter download mode command must precede this command. C DST SRC CMD 06
STS
TNS
R SRC DST CMD 46
STS
TNS
FNC DATA 08
DATA - enter the number of bytes of memory that you want to allocate to the PLC-2 data table. Since PLC words are two bytes long, the DATA value is double the number of words in the PLC-2 data table. If t 512 bytes, the number must be a multiple of 4. If w 512 bytes the number must be a multiple of 128. DATA is also equivalent to the physical address of the start of the processor's program memory. To determine allowable data table sizes, see the appropriate programming manual
Important:
Publication 1770-6.5.16 - October 1996
Using a data table size that is larger than the processor’s available memory causes a PLC-2 fault the next time the processor is put into Run or Remote Run mode.
Page 112
Communication Commands
7–25 set ENQs
• PLC-2 • PLC-3 • PLC-5
Sets the maximum number of ENQs that the asynchronous interface module issues per message transmission. Put the number in the DATA field. The default setting for most modules is 10 ENQs per transmission (3 ENQs for the 1771-KG and 1771-KE, 9 ENQs for the 1785-KE). C
DST SRC CMD 06
STS
TNS
R
SRC DST CMD 46
STS
TNS
FNC DATA 06 set link parameters Sets the DH485 parameter, Maximum Solicit Address. This parameter specifies the maximum node address that a DH485 node tries to solicit onto the link. • SLC 500 • SLC 5/03 • SLC 5/04 (Channel 0 configured for DH485)
C
DST SRC
CMD 06
STS
TNS
R
SRC DST
CMD 46
STS
TNS
FNC 0A
Address 0000
Size 01 Data
Data - the maximum node address that can be solicited (1 byte).
set NAKs • PLC-2 • PLC-3 • PLC-5
Sets the maximum number of NAKs (negative acknowledgements) that the asynchronous interface module accepts per message transmission. Put the number in the DATA field. The default setting for most modules is 3 NAKs per transmission. C
DST SRC CMD 06
STS
TNS
R
SRC DST CMD 46
STS
TNS
FNC DATA 05
Publication 1770-6.5.16 - October 1996
Page 113
7–26
Communication Commands set CPU mode Sets the operating mode of the processor at the next I/O scan. The operating mode is set to the mode indicated in the flag byte (shown below). A “no privilege” error is returned if the requester does not have the privilege of placing the host in Download mode. This error occurs when: • the processor is not in Remote mode (must be in Remote Program mode, Remote Run mode, or Remote Test mode) • the processor is being edited • some other node is already downloading to the processor
• PLC-5
C
DST SRC CMD STS 0F
FNC 3A
TNS
A
7 6 5 4 3
2
1 0
0 0 0 0 0
0
1 0 unused R
SRC DST CMD STS 4F
TNS determine which operating mode is selected or, for some products, remote lock
EXT STS
The EXT STS field may be attached to the reply packet only when there is an error.
Publication 1770-6.5.16 - October 1996
For this operating mode
A is
Program/Load (processor idle, I/O disabled)
00000000
Remote Test (processor scanning, I/O disabled)
00000001
Remote Run (processor scanning, I/O enabled)
00000010
No change (only remote bit affected)
00000011
Page 114
Communication Commands
7–27 set timeout • PLC-2 • PLC-3 • PLC-5
Sets the maximum amount of time that the asynchronous interface module waits for an acknowledgment to its message transmission. The setting is expressed as the number of cycles of an internal clock. (For example, 40 cycles equals 1 second for the 1770-KF2.) C
DST SRC CMD 06
STS
TNS
R
SRC DST CMD 46
STS
TNS
FNC DATA 04
See the following table for settings and defaults for the module you are setting. Put the number of desired cycles in the DATA field. DATA: Module 1770-KF2 1771-KE/KF 1771-KG 1771-KGM 1775-KA 1785-KE
Cycles/Sec 40 40 38 63 40 29
Default 128 cycles (approx. 3 sec) 128 cycles (approx. 3 sec) 38 cycles (approx. 1 sec) 63 cycles (approx. 1 sec) 128 cycles (approx. 3 sec) 128 cycles (approx. 4.5 sec)
set variables • PLC-2 • PLC-3 • PLC-5
Sets the maximum ENQs, NAKs, and timeout all at once. This command is a combination of the set NAKs, set CPU mode, and set timeout commands. C
DST SRC CMD 06
STS
TNS
R
SRC DST CMD 46
STS
TNS
FNC 02
DATA (3 bytes)
DATA - Put the timeout setting in the first byte, the NAKs setting in the second byte, and the ENQs in the third byte.
Publication 1770-6.5.16 - October 1996
Page 115
7–28
Communication Commands shutdown Asks the interface module to initiate either a PLC-3 shutdown (if the computer has download privileges) or a freeze on file allocations (if the computer has upload privileges). The computer cannot issue this command until it has successfully transmitted an upload or download request to the module.
• PLC-3
C
DST SRC CMD STS 0F
TNS
FNC 07
R
SRC DST
CMD STS 4F
TNS
EXT STS
The EXT STS field may be attached to the reply packet only when there is an error.
typed read (read block) Reads a block of data from the processor starting at the PLC-5 system address plus the packet offset. • PLC-5 • PLC-5/VME • SLC 5/03 • SLC 5/04
C
DST SRC CMD STS 0F
TNS
FNC 68
Packet Offset
R
SRC DST
CMD STS 4F
TNS TNS
A
B
Total Trans
PLC-5 sys. address
Size
Size - number of elements to read from the specified system address. A - Type/data parameter. Used to specify • type of data you are writing or reading • size in bytes of each piece of data you are writing or reading B - Data (up to 240 bytes minus the number of bytes used in the type/data parameter). An EXT STS byte will replace A and B if there is an error. The first byte of the type/data parameter is the flag byte, and has this format: Flag Byte Bit
7 ID format field
6
5 ID value field
Data Type ID
Publication 1770-6.5.16 - October 1996
4
3 Size format field
2
1
0
Size value field
Data Type Size
Page 116
Communication Commands
7–29
Data Type ID (Bits 4-7)
Data Type Size (Bits 0-3)
The following table contains a list of the types of data you can read and write and the ID value of each: Data Type ID Type of Data
If the data type defined in the ID Value field uses
Then enter
7 or fewer bytes for each piece of data zero (0) in bit 3 of the flag byte. Enter the actual number of bytes used for each element of data in bits 0, 1, and 2 (Size Value Field).
1 2 3 4 5 6 7 8 9 15 16 more than 7 bytes for each element of data one (1) in bit 3 of the flag byte. In bits 0, 1, and 2, you enter the number of bytes that will contain the number of bytes used for each element of data. These additional size value bytes follow the flag byte and any ID Type bytes.
bit bit string byte (or character) string integer Allen-Bradley timer Allen-Bradley counter Allen-Bradley general control structure IEEE floating point array of similar elements address data binary-coded decimal (BCD)
For example, if each element of data used 8 bytes, then you set bit 3 to 1 (because the value 8 cannot fit into bits 0, 1, and 2). Bits two, one, and zero would be set to 0, 0, 1 (respectively), to signify that the number of bytes per element of data (8) will be contained in one byte that follows the flag byte and any ID Type bytes. If the Data Type ID is
Then set bit 7 of the flag byte to
7 or less zero (0), and encode the ID value for the data type in the bits 4, 5, and 6 (ID Value Field).
greater than 7 one (1). In bits 4, 5, and 6, you insert the number of bytes to follow that contain the data type ID value (usually 1). These additional ID value bytes follow directly after the flag byte.
For example, if you were sending address data, then bit 7 would be set to 1 (because the address ID value 15 cannot fit into bits 4, 5, and 6). Bits six, five, and four would be set to 0, 0, 1 (respectively), to signify that the data ID value (15) will be contained in one byte that follows the flag byte.
For examples of type/data parameter, see page 7–36.
Publication 1770-6.5.16 - October 1996
Page 117
7–30
Communication Commands typed write (write block) Writes a block of data to the processor starting at the PLC-5 system address plus the packet offset. The type of data sent with the typed write command must match the data type of the file to which it is being written. If not, the remote host returns an error reply.
• PLC-5 • PLC-5/VME • SLC 5/03 • SLC 5/04
C
DST SRC
CMD STS 0F
TNS
FNC 67
R
SRC DST
CMD STS 4F
TNS
EXT STS
Packet Offset
Total Trans
PLC-5 sys. address
A
B
A - Type/data parameter B - Data (up to 240 bytes minus the number of bytes used in the PLC-5 system address and the type/data parameter.) An EXT STS byte will replace A and B if there is an error. For packet offset, total transaction, and size (in elements) low byte is first. The PLC-5 system address can be a logical binary address or a logical ASCII address that contains up to 51 bytes of specification. The EXT STS field may be attached to the reply packet only when there is an error.
unprotected bit write • 1774-PLC • PLC-2 • PLC-3 • PLC-5
DATA DATA is: •4-byte blocks, each of which contains a 16-bit address field •a set mask •a reset mask
Publication 1770-6.5.16 - October 1996
Sets or resets individual bits in any area of PLC data table memory. C
DST SRC CMD STS 05
TNS
R
SRC DST CMD STS 45
TNS
Set
Reset
ADDR Up to 60 masks of this form. Data (max. 244 bytes)
ADDR
SET
RESET
•Use ADDR to specify the address of the byte to be modified in the PLC data table memory. •Put the low byte (least significant bits) of the PLC address value into the first byte of the ADDR field.
•Use SET to specify which bits to set to 1 in the addressed PLC byte.
•Use RESET to specify which bits to reset to 0 in the addressed PLC byte.
•A 1 in a bit position of the SET mask means to set the corresponding bit in the addressed PLC byte to 1.
•A 1 in a bit position of the RESET mask means to reset the corresponding bit in the addressed PLC byte to 0.
•A 0 in a bit position of the SET mask means to leave the corresponding bit in the PLC byte unchanged.
•A 0 in a bit position of the RESET mask means to leave the corresponding bit in the PLC byte unchanged.