Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 29 of 41

AdaptaScan Bar Code Readers (Cat. Nos. 2755-SN3, -SN5, and -SN8) Application Guide: 12 - Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging, pages 240 to 248

Pages 240 to 248 of 354, from AdaptaScan Bar Code Readers (Cat. Nos. 2755-SN3, -SN5, and -SN8) Application Guide

The original document is the PDF (3.2 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 Accu-Sort 2755-SN3, Accu-Sort 2755-SN5, Allen-Bradley 2755-SN5, Accu-Sort 2755-SN8 and Allen-Bradley 2755-SN8

Page 240

Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging

Explicit Message Program Control

12–19

Use the Explicit Message Program Control feature to configure device parameters on your DeviceNet network via the ladder logic program in the PLC-5 processor that is controlling these devices. You can use Explicit Message Program Control only with devices that are slaves of your 1771-SDN Scanner Module. These slave devices must be mapped in the scanner module’s scan list. Use the Explicit Message Program Control feature to: • transmit configuration data from your scanner module to its slave devices on your DeviceNet network • receive status and diagnostics from these devices on your DeviceNet network • make runtime adjustments to device parameters according to changing conditions detected by your processor

Publication 2755-6.8

Page 241

12–20

Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging

Explicit Message Program Control Feature

Block Transfer Write file (64 words) (sent from processor to scanner module)

4 Block Transfer Read file (64 words) (sent from scanner module to processor)

Request – An explicit message sent by a client to a server requesting the server to perform a function. Response – An explicit message sent by a server to a client in response to the client’s request. For every request issued, there is a response.

5 Block Transfer Read file is completed. TXID’s are deleted and can be reused.

DeviceNet trunk line

Explicit Message – A message used to transmit commands, data, requests for data or responses. The message is sent from a client on the DeviceNet network to a server on that network.

Master’s Explicit Request

AdaptaScan Bar Code Reader

DeviceNet drop line Slave’s Explicit Response

1203-GK5 Communication Adapter

1305 AC drive

1. Format a Block Transfer Write file in the processor to send an Explicit Message Request to the scanner module (download). 2. The scanner module transmits the Explicit Message Request to the slave device over the DeviceNet network. 3. The slave device transmits the Explicit Message Response back to the scanner and is queued into a block transfer buffer. 4. The processor uses a Block Transfer Read file to retrieve the Explicit Message Response from the scanner’s buffer (upload). 5. The Block Transfer Read file is completed. The transaction IDs are deleted and can be reused. The scanner module requires a precisely-formatted block transfer read and write size of 64 words. The Explicit Message Control table in the scanner module is 64 words. The scanner module uses the block transfer size as an indicator that the content is a client/server request.

Publication 2755-6.8

Page 242

Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging

12–21

Formatting the Explicit Message Transaction Block Ten 32-word transaction blocks within the scanner module are reserved for Explicit Message Program Control. The transaction blocks accommodate both the download of Explicit Message Requests and the upload of Explicit Message Responses. The scanner module can accommodate one request or response for each transaction block and can transfer two blocks for each upload and download. You must format each transaction block as shown in the following figure. 15 Transaction Header (3 words)

0 TXID cmd/status word 0 port size word 1 service

MAC ID word 2

Transaction Body (29 words)

word 31 One word = two bytes = 16 bits

The transaction block is divided into two parts: • transaction header – Contains information that identifies the transaction to the scanner and processor. • transaction body – In a request, this contains the DeviceNet Class, Instance, Attribute and Service Data portion of the transaction. In a response, this contains only the response message. Each of the data attributes in the transaction header are one byte in length: • command/status – For each download, you assign a command code to instruct the scanner how to administer the request. Command Code

Description

0

Ignore transaction block (block empty).

1

Execute this transaction block.

2

Get status of transaction TXID.

3

Reset all client/server transactions.

4

Delete transaction from response queue.

5–255

Reserved

Publication 2755-6.8

Page 243

12–22

Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging

For each upload, the status code provides the processor with status on the device and its response. Status Code

Description

0

Ignore transaction block (block empty).

1

Transaction completed successfully

2

Transaction in progress (not ready)

3

Error – slave not in scan list

4

Error – slave offline

5

Error – DeviceNet port disabled/offline

6

Error – transaction TXID unknown

7

Unused

8

Error – Invalid command code

9

Error – Scanner out of buffers

10 11

Error – Other Client/server transaction in progress Error – could not connect to slave device

12

Error – response data too large for block

13

Error – invalid port

14

Error – invalid size specified

15

Error – connection busy

16–255 15 Transaction Header (3 words)

• TXID (transaction ID) – When you create and download a

0 TXID cmd/status word 0 port size word 1 service

MAC ID word 2

Transaction Body (29 words)

• word 31 One word = two bytes = 16 bits

• •

•

Publication 2755-6.8

Reserved request to the scanner, the processor’s ladder logic program assigns a TXID to the transaction. This is a one-byte integer in the range of 1 to 255. The scanner uses this value to track the transaction to completion, and returns the value with the response that matches the request downloaded by the processor. The ladder logic program monitors rollover and usage of TXID values. size – The size of the transaction body in bytes. The transaction body can be as many as 29 words (58 bytes) in length. If the size exceeds 29 words, an error code will be returned. port – The DeviceNet port where the transaction is routed. The port can be zero (Channel 1) or one (Channel 2). MAC ID (node address) – The DeviceNet network address of the slave device where the transaction is sent. This value can range from 0 to 63. The port and MAC ID attributes coupled together identify the target slave device. The slave device must be listed in the scanner module’s scan list and be online for the Explicit Message transaction to be completed. service – For each Explicit Message Request and Response, the service attribute contains the service request and response codes that match the corresponding request for the TXID.

Page 244

Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging

12–23

The following figure describes the format and mapping of transaction blocks for request and response messages in the scanner module. Format of 64-word Block Transfer Read for Explicit Message Response 15 0

Format of 64-word Block Transfer Write for Explicit Message Request 15 0 Transaction Header (3 words)

TXID command port size service word 0

MAC ID

Transaction Header (3 words)

TXID status port size service

MAC ID word 0

Class Instance Attribute (optional)

Transaction #1

Transaction #1 Service Response Data

Service Data word 31 Transaction Header (3 words)

TXID command port size service

MAC ID word 32 word 31 Transaction Header (3 words)

TXID command port size service

MAC ID word 32

Class Instance Attribute (optional)

Transaction #2

Transaction #2 Service Response Data

Service Data word 63 word 63

How the Processor and Scanner Module Manage Messages Block transfer operations between the processor and the scanner always originate in the processor. The scanner module can only wait for the processor to download a transaction block to the module or request an upload of a transaction block from the module. Once an Explicit Message Request transaction block is downloaded to the scanner module, a ladder logic program in the processor polls the scanner module for the transaction block containing the Explicit Message Response for that request. This is done by the processor with a Block Transfer Read on the scanner module. Depending on the network load, the scanner could take a few seconds to complete the request. When a response is loaded, bit 15 of the module status register is set to 1. The program may have to poll the scanner module a number of times before the scanner returns a Response Transaction Block.

Publication 2755-6.8

Page 245

12–24

Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging

The scanner module recognizes I/O data and control as higher priorities over explicit messaging on DeviceNet. Message lengths and slave device types impact transaction message completion times. If the processor has queued multiple Explicit Message Transactions to the scanner module for multiple slave devices, the transactions with the slaves may not complete in the order in which the requests were received. The slave responses are queued to the 64 word Block Transfer Read in the order in which they are received. As response transaction blocks are uploaded, the processor’s program matches the responses to the requests using the TXID field. Processor

Scanner Module

DeviceNet Network

BTW Request Transaction Block

Request Transaction Blocks

Scanner Request Queue

Execute DeviceNet Explicit Message Requests and Responses

Process Requests and Responses

Ladder Scans

Slave Device

Done or Error-detected

Response Transaction Block

BTR

Response Transaction Blocks

Scanner Response Queue

Explicit Message Program Control Limitations • The processor is always the DeviceNet client and the slave is always the DeviceNet server. • A maximum of 10 Explicit Message Request Transaction Blocks with the execute command can be queued to the scanner module at any time. For example, 5 Block Transfer Write files containing two transactions each, can be performed at any time. The scanner module receives and deletes any additional client/server requests with the execute command over the maximum of 10.

Publication 2755-6.8

Page 246

Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging

12–25

As transactions are removed from the queue and response transaction blocks are returned to the processor, additional transaction blocks can be issued in their place, as long as the total does not exceed ten. • The scanner module supports two transaction blocks per upload and download. • Request Transaction Blocks can only be queued for slave devices of the scanner module and must appear in the scanner module’s scan list. • If a slave device is not communicating at the time the scanner module processes its Request Transaction Block, the scanner module will return an error status for that transaction. • At a minimum, the scanner module supports the following DeviceNet services in Request Transaction Blocks. Service Name

Service Code

Example

Get_Attribute_Single

0E hex

Upload a single parameter value from a device

Set_Attribute_Single

10 hex

Download a single parameter value to a device

Get_Attribute_All

01 hex

Upload all parameter values from a device

Set_Attribute_All

02 hex

Download all parameter values to a device

• Continuous Block Transfers of 64 words are not supported. • All transaction blocks are processed, therefore, any unused transaction blocks must be left blank. • Client/Server commands and requests with transaction IDs that are in use are deleted by the scanner module. • If a slave device returns a DeviceNet error in response to the request downloaded from the processor, the scanner recognizes the error as a successful transaction (status code =1). A failure to respond to the request within the number of retries or timeout period specified for the Explicit Message Connection is recognized by the scanner module as an error. The error code is returned in the status attribute of the transaction header.

Publication 2755-6.8

Page 247

12–26

Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging

Explicit Messaging Ladder Logic Program This section provides the explicit message ladder logic program and data monitor results. Enable Rung B3:0 to initiate the download process to the AdaptaScan. File N20:0 contains the APM command. The DeviceNet address being written to, in this example, is 10 or 0AH. The N7 inputs are needed if the code from page 12–5 is used.

B3 N7:0 N7:100 [ [ ONS ] ] / [ ] / [ 15 15 0 2

B3 ]

BTW Rack Group

00

Module

0

0

Ctrl Block

N7:200

Data file

N20:0

Length

64

Continuous

N

After BTW is complete, initiate the the BTR statement to retrieve the response code. The N7 inputs are needed if the code from page 12–5 is used.

]

B3

[

1

B3 N7:0 N7:100 [ ONS ] ] / [ ] / [ 3 15 15

BTR Rack Group

00

Module

0

0

Ctrl Block

N7:150

Data file

N25:0

Length

64

Continuous

N

Note: You can write code to continuously change the TXID for the next transaction. Refer to page 12–21 for information regarding formatting the explicit message transaction block

Example Data Tables Address

Data = Hex Code (matchcode download of 0300 data)

N20:0

0101

Publication 2755-6.8

000C

1003

00CE

0001

0003

Address

Response File (good response)

N25:0

0101

Address

Data = Hex Code (Turn on LED 1)

N20:0

0101

0008

1003

0004

3330

3030

0002

0003

0001

900C

00C9

Page 248

Communicating with a PLC-5 Processor on a DeviceNet Network using Explicit Messaging

12–27

Notes on using Explicit Messaging • You can send messages sequentially from the PLC-5 to different bar code readers, but the response will not update properly (when the response is read in N25:0). • The TXID byte does not need to be incremented, although you may not know where the response came from. • To receive the correct response from the command sent from the PLC-5 you must: 1. Send command down, matchcode download (TXID=11). 2. Send a 03 in the status command. Refer to page 12–21 for more information. 3. Increment TXID to 12. 4. Send command down, turn on LED 1 (TXID=12). 5. View N25:0 for response to step 4. 6. Confirm that TXID=12. If your response is 90, the command was sent correctly. If you receive a 94, the command was not sent correctly. • If an incorrectly formatted command is sent from the PLC-5, you must send a 03 in the status command byte in order for the system to operate properly.

Publication 2755-6.8