The text of a manual · part 30 of 42
DS/DD Series B Enhanced Bar Code Decoders User Manual (Bulletin 2755): 16 - PCCC Host Commands, pages 266 to 274
Pages 266 to 274 of 361, from DS/DD Series B Enhanced Bar Code Decoders User Manual (Bulletin 2755)
The original document is the PDF (1.4 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 2755-DD and Allen-Bradley 2755-DS
Page 266
Chapter
16
Chapter Objectives
This chapter defines PCCC (Programmable Controller Communications Commands) commands you can send from a host to the decoder using the DH485 interface. These commands allow you to use binary data exchange to configure the decoder, read data from the decoder, and obtain diagnostic information.
Protocol Options
The PCCC host commands use the Allen-Bradley DH485 link protocol. To use these commands, the Host Protocol configuration parameter on the Host Communications configuration screen must be set to one of these options: • DH485 PCCC-1 Protocol with Write Replies • DH485 PCCC-2 Protocol without Write Replies The decoder supports the following DH485 communication addresses: DH485 LSAP 0 1 or 128 129
PCCC Commands
Function Diagnostic Commands (Perform Application Layer) PCCC Commands (Perform Application Layer) Perform Link Reset-immediate Block
The PCCC commands perform the same functions as the configuration screens and fall into three categories: 1. Unprotected Read Command The unprotected read command is used to read bar code data, configuration data, counter values, performance indicators and the last message sent to host. 2. Unprotected Write Command The unprotected write command is used to modify (or write over) configuration data, clear counters, flush data, set defaults, and perform other functions. 3. Diagnostic Command The diagnostic command is used to read link layer diagnostic counters and statuses, reset diagnostic counters, and perform a diagnostic loop.
Publication 2755-833
Page 267
16–2
PCCC Host Commands
ATTENTION: When controlling discrete outputs locally using AUX port configuration, suspend host communications to prevent outputs from unintentionally changing state.
!
Command Format The general structure and definitions of all commands is shown below. The structure shows the high and low byte of each data word (word= 2 bytes). Data is always transmitted with the low byte of each data word first and then the high byte. In the command explanations below, MSB stands for Most Significant Bit, and LSB stands for Least Significant Bit. High Byte
Low Byte
STS
CMD
0
Transaction Number Sequence (TNS)
2
MSB
LSB
1 3 5
High Address
FNC Code or Low Address
7 .
4 6 .
Data 122 or 124 bytes maximum
.
.
.
.
127
126
• CMD Byte 0 specifies the command to perform. Bits 0, 1, 2 and 3 of the CMD byte contain the command code. The options are: – 0001(01H) = Unprotected Read Command – 1000 (08H) = Unprotected Write Command – 0110 (06H) = Diagnostic Command Bit 6 is cleared (0) for the command and set (1) for the reply. Bit 4, 5, and 7 are always zero. To send an unprotected write command, CMD byte 0 would look like this: MSB
LSB
7
6
5
4
3
2
1
0
0
0
0
0
1
0
0
0
Bit 6 cleared (0) for command Always 0
Publication 2755-833
1000 = Unprotected Write (08H)
Page 268
PCCC Host Commands
16–3
• STS •
•
•
•
•
Byte 1 specifies the command status which is always 0. TNS Bytes 2 and 3 contain a unique transaction number sequence that links each command to a reply. The TNS is user defined. FNC Code When the CMD byte = 06H (diagnostic command), byte 4 specifies a diagnostic function. For example, FNC = 01 means read diagnostic counters. Low Address When the CMD byte = 01H (unprotected read command) or 08H (unprotected write command) byte 4 contains the low byte of a two byte address. The low address (byte 4) and high address (byte 5) map to a specific area in decoder memory for a read or write operation. High Address When the CMD byte = 01H (unprotected read command) or 08H (unprotected write command) byte 5 contains the high byte of a two byte address. The low address (byte 4) and high address (byte 5) map to a specific area in decoder memory for a read or write operation. Data The data area is command dependent. The starting byte for the data area is also command dependent.
Command Reply Format The general format and definition of a command reply is: High Byte
MSB 1
Low Byte
STS
CMD Reply
LSB 0
3
TNS
2
5 .
Optional
4 .
.
Data 124 bytes maximum
.
.
.
127
126
• CMD Reply Byte 0 contains the response to a command. Bit 6 is set for the reply and responses are:
Publication 2755-833
Page 269
16–4
PCCC Host Commands
– 41H – Response to an unprotected read (01H) command – 46H – Response to a diagnostic link (06H) command – 48H – Response to an unprotected write (08H) command If the CMD byte sent in any of the commands is invalid, the STS byte will contain 10H. • STS Byte 1 contains the status of a processed command. The table below lists the STS codes for all commands. Status Response Codes Hex Value 00H 01H 02H 10H
Meaning Command successful (no errors).
20H
Invalid or unsupported command.
30H
Hardware fault (reserved and unused).
40H
Command successful but no data available (read command only)
80H
Command successful but data truncated. (read command only)
Command complete and successful.➀ Display buffer is full. ➀ Valid command but invalid format or address.
➀ Applies only to CMD Address 900H or 901H. See page 16–12
• TNS Bytes 2 and 3 contain the same transaction number sequence as the command. The TNS value links the reply to the command. • Data The data area contains data requested by a read command. The write commands do not return data.
Unprotected Read Command
The unprotected read command (01H) performs these decoder functions: • Reads current bar code data • Reads decoder configuration data • Reads decoder performance indicator, counters, and diagnostics • Reads last message to host Each command returns data to the host that is read from a specific address of the decoder’s memory. The following sections define each read command. Appendix A contains a summary of the memory addresses for all decoder functions or commands.
Publication 2755-833
Page 270
PCCC Host Commands
16–5
Read Current Bar Code Data Bar code data is stored as a packet in the host buffer of the decoder at address 100H to 3BFH. Each packet contains data from one read operation. The maximum number of bytes in one packet is 704 bytes. To read the current bar code data, send this command structure: Read Current Bar Code Data Command High Byte
Low Byte
MSB 1
LSB STS= 00
3
CMD= 01H
0
TNS
5
2
Host Buffer Address= 100H 00H
7
4 Size = n
6
Each command can return up to 124 (7C Hex) bytes of data, which is determined by the size byte (byte 6). The amount of data in the host buffer is variable. The size of the reply varies depending on how much data is in the host buffer and the number of bytes specified in the size byte. If the host buffer is empty, the reply is returned without data and a status of 40H (no data in host buffer). Reply - No Data in Host Buffer High Byte Low Byte MSB 1
LSB STS= 40H
3
0
CMD Reply = 41H
2
TNS
If the host buffer contains data ≤ the number of bytes specified in the size byte, the reply returns all data and a status of 00H (no errors). Reply - All Data Returned in Host Buffer High Byte
Low Byte
MSB 1 3
LSB STS= 00H
CMD Reply = 41H TNS
5
0 2 4
Data
If the host buffer contains more data than the number of bytes specified in the size byte, the reply is returned with truncated data and a status of 80H (data truncated).
Publication 2755-833
Page 271
16–6
PCCC Host Commands
Reply - Truncated Data (Host Buffer Contains More Data) High Byte
Low Byte
MSB 1
LSB STS= 80H
0
CMD Reply = 41H
3
2
TNS
5
4 Data
To read the rest of the data in the buffer, send one or more additional read commands. In each command, offset the address appropriately from the previous command. A status of 00H is returned in the reply when the last segment of data from a bar code packet is read. Here is an example. The host buffer contains a bar code packet that is 200 bytes. To read the entire packet, you need to send two read commands. The first command would read 124 bytes (62 words) of data. The second command would read the remaining 76 bytes (38 words) of data. The following table shows the start and end address for each read command. Read Commands 1st Read Command Start Address 2nd Read Command Start Address
Address HEX
Decimal
Read 100 words (200 bytes)
100
256
62 words (124 bytes)
17C
380
38 words (76 bytes)
Note: By always setting the size of 7C Hex, you will know that the decoder will always return up to 124 bytes.
Read Counters and Performance Indicator Counter values (package, output, no-read) and performance data are stored at addresses 600H to 6FFH. The command format for reading this data is: Read Counters and Performance Indicator High Byte Low Byte MSB
LSB
1
STS= 00
CMD= 01H
0
3
TNS Read Counter or Performance Indicator Address
2
5 7
00H
Size = n
4 6
Appendix A lists the address and byte size for each counter and the decoder performance indicator.
Publication 2755-833
Page 272
PCCC Host Commands
16–7
The following command reads the value of output counter 1: Read Output Counter 1 High Byte Low Byte MSB 1
LSB STS= 00
CMD= 01H
3
0 2
TNS 604H
5
4
00H
7
Size = 4
6
Read Reply High Byte
Low Byte
MSB 1
LSB STS= 00H
0
CMD Reply = 41H
2
3
TNS
5 7
Counter Data
4 6
You can read more than one counter, however the read operation must specify an address within the valid address range and start on an address boundary. If you try to read outside a valid address range, the reply returns with a status of 10H (invalid address).
Read Last Host Message The last message sent to the host is stored at address 800H. The command and reply format for reading the last host message is: Read Last Host Message High Byte Low Byte MSB 1
LSB STS= 00H
0
CMD= 01H
3
TNS
2
5
Address = 800H
4
00H
7
Size (Unused)
6
Reply High Byte
Low Byte
MSB 1 3 5
LSB STS= 00H
CMD Reply = 41H TNS
0 2 4
Data from Last Host Message
Publication 2755-833
Page 273
16–8
PCCC Host Commands
Read Decoder Configuration Data Appendix A lists the address location for each configuration parameter along with the byte size of the data and the default value. To read or examine one or more parameters, send the read command with the appropriate starting address and byte size referenced in Appendix A. Read Configuration Data High Byte Low Byte MSB 1
LSB CMD= 01H
0
TNS Configuration Data Address (300H to 5FFH)
2
5 7
00H
6
STS= 00H
3
4
Size = n
The reply returns the configuration data at the specified address. Reply to Read Configuration Data High Byte
Low Byte
MSB 1 3
LSB STS= 00H
CMD Reply = 41H TNS
5
0 2 4
Configuration Data
You can read more than one parameter, however the read operation must specify an address within the valid address range and start on a parameter boundary. If you try to read outside a valid address range, the reply returns with a status of 10H (invalid address).
Unprotected Write Command
The unprotected write command (08H) performs these decoder functions: • Modifies (or writes over) decoder configuration data • Executes a decoder function • Sends a repeat read command • Sends a message to the AUX port terminal and LCD Display • Holds a discrete output on or off Each command modifies (or overwrites) data at a specific address in decoder memory or executes a specific decoder function. The following sections define each of the write commands. Important: If the configuration date is a text string, you must send the length of the string as the first byte of the string.
Publication 2755-833
Page 274
PCCC Host Commands
16–9
Modify Configuration Data Appendix A lists the address location for each configuration parameter along with the byte size of the data and the default value. To modify a specific parameter, send the write command with the appropriate starting address and the appropriate data referenced in Appendix A. To modify the configuration data, send this command structure: Modify or (Write Over) Configuration Data High Byte
Low Byte
MSB 1
LSB STS= 00H
CMD= 08H
3
0
TNS
2
5
Configuration Data Address (3C0H to 5FFH)
4
7 . . 127.
New Configuration Data 122 bytes maximum
6 . . 128.
The command includes new configuration data for specified parameters. Reply - Modify or (Write Over) Configuration Data High Byte Low Byte MSB 1 STS= 00H 3
LSB CMD Reply = 48H TNS
0 2
An invalid configuration data address returns a status code of 10H (invalid address).
Execute Decoder Functions The unprotected write (08H) command is also used to execute decoder functions or commands. Appendix A lists the decoder functions you can perform and their respective addresses. To execute a command listed in Appendix A, send an unprotected write command to the specified command address. The command and reply format for executing a decoder function is:
Publication 2755-833