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

The text of a manual · part 68 of 70

SLC 500 Instruction Set Reference Manual, pages 671 to 680

Pages 671 to 680 of 694

The original document is the PDF (7.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 Allen-Bradley 1747-L514

Page 671

Application Example Programs

G-17

On/Off Circuit Ladder Program Does a one-shot from the input push button to an internal bit - the internal bit is true for only one scan. This prevents toggling of the physical outpout in case the push button is held "ON" for more than one scan (always the case).

Push Botton Input

Push Button False-to-True

OSR #1

I:1

B3 OSR

B3

0

1

0

0000

If the push button input has gone from false-to-true and the output is presently OFF, turn the output ON and jump over the following rung. If the JMP instruction was missing, the following rung would be true and would turn the output back OFF. Push Button False-to-True B3

Toggling Output

Toggling Output O:3 L

O:3

0001

0

Push Button False-to-True B3

0 Go to rest of program 1

0

JMP

Toggling Output

Toggling Output

O:3

O:3 U

0

0

0002

0

Contains the label corresponding to the jump instruction in rung 1. The remainder of your actual program would be placed below this rung. Dummy Bit Go to rest of program 1 B3 0003

LBL

2 END

0004

Interfacing with Enhanced Bar Code Decoders Over DH-485 Network Using the MSG Instruction

The purpose of this section is to illustrate how to interface Allen-Bradley Enhanced Bar Code Decoders to SLC 5/03 and higher processors via the DH-485 network. Enhanced Bar Code Decoders act only as slave devices on this network. This means that these decoders cannot initiate the transfer of data to a host device, such as the SLC 5/03 (or higher) processor on DH-485. The SLC processor must initiate commands to a decoder and poll that decoder for the reply to those commands.

Processor and Decoder Operation The Enhanced Bar Code Decoder (catalog number 2755-DS/DD, Series B), when used as a node on a DH-485 network can act as a slave only. This means that the decoder may not initiate communications to any other node on the network. Therefore, in order for a device to get bar code data from an Enhanced Bar Code Decoder on a DH-485 network, that device must send a read command and then poll the decoder for the reply with data.

Publication 1747-RM001G-EN-P - November 2008

Page 672

G-18

Application Example Programs

The only devices capable of polling a slave device on DH-485 are the SLC 5/03 and higher processors. For the SLC 5/03 processors (1747-OS302, FRN10 or later), polling can be done via channels 0 and 1. For the SLC 5/04 processors (1747-OS401, FRN7 or later), channel 0 supports this capability. There are many ways to trigger bar code decoders to read a bar code label when a label is present. • A package detect switch wired to both an SLC input module and the bar code decoder • A package detect switch wired only to an SLC input and an SLC output then used to trigger the decoder • Via a software trigger command from the SLC processor For this example, the software trigger is used. However, the basic principal is the same for all trigger modes.

System Set Up In this example, a photo switch is located such that when it detects a product is in position for the bar code scanner to read a bar code label on the product, a discrete input to the SLC 5/03 processor is energized.

SLC 5/03

1747 Chassis DH-485

Power Supply 1747-AIC Host Port

Photo Switch

2755-DS/DD Enhanced Bar Code Decoder

The 5/03 ladder program then initiates a MSG Write to the decoder to trigger the decoder to start scanning for a valid bar code label. When the decoder is scanning for a valid bar code label, it operates as shown below.

Publication 1747-RM001G-EN-P - November 2008

Page 673

Application Example Programs

G-19

Table G.2 Result of Scanning a Valid Bar code Result of Scan

Bar Code Decoder Response

Good Read turns on its “Good Read” onboard When one of these two inputs output wired to the SLC processor to the SLC are turned on, the SLC will initiate a “MSG Read” turns on its “No-Read” onboard to the decoder to get the label output wired to the SLC processor data or no-read message data.

No-Read

Processor Response

In this case, the good read output is turned on as soon as a valid read occurs, and the no-read output is turned on after the decoder has attempted to read a label for a specified amount of time and could not. The amount of time the decoder attempts to read a label is variable and is called the “No-Read Timer”. For this example it is assumed that the product is moving by the scanner and if the label is not read in 2 seconds, it is not read at all. Therefore, the “No-Read Timer” parameter in the bar code decoder is set to 2 seconds. Refer to the DS/DD Series Enhanced Bar Code Decoders (Bulletin 2755) User’s Manual, publication 2755-833, for details concerning the configuration of your Allen-Bradley Enhanced Bar Code Decoder.

Operating Sequence With the bar code decoder configured as previously described, the following series of event take place when a product with a good bar code label breaks the photo switch and this input to the SLC goes from false-to-true. The SLC 5/03 ladder program logic to make it happen is also included. Please note that, as previously stated, a bar code/SLC system may be configured in a variety of ways. Messages sent by the SLC processor to the Enhanced Bar Code Decoder must be programmed as shown by the example ladder program on page H-29. If this logic is not followed, the communication between the two DH-485 devices could become out of sequence, resulting in no data transfers between the decode and the SLC processor. To correct such a problem, cycle power to the decoder.

Publication 1747-RM001G-EN-P - November 2008

Page 674

G-20

Application Example Programs

Sequence of Events

The photo switch input to the SLC goes from false-to-true

The SLC processors send a “trigger” command to the decoder via a “MSG Write” command. The decoder immediately replies to the SLC that it has properly received the command. The decoder immediately replies to the SLC that it has properly received the command. The reply sets the MSG DN bit and clears the MSG DA bit in the SLC processor. The reply sets the MSG DN bit and clears the MSG DA bit in the SLC processor. The decoder then processes the command and formulates a reply to the “MSG Read” command with the decoded label data included in this reply, and places into its output buffer awaiting a “poll”. The SLC processor then waits a specified amount of time and re-enables the same MSG instruction which now sends the “poll” to the decoder. The SLC processor waits a specified amount of time, then re-enables the same “MSG Read” instruction which now sends the “poll” to the decoder. The decoder then responds to this “poll” with its reply to the “trigger” command. The SLC processor then sets the MSG DN and MSG DA bits. The decoder then responds to the “poll” command with its reply to the “MSG Read” command which includes the bar code label data. The decoder then reads the bar code label and turns on the “good read” output wired to the SLC processor. The SLC processor then sets the MSG DN and MSG DA bits to signify its receipt of the data. When this “good read” input to the SLC goes from false-to-true, the SLC sends a “MSG Read” to the decoder.

TIP

Publication 1747-RM001G-EN-P - November 2008

These events are described in more detail by the comments listed within the example ladder program page G-21.

Page 675

Application Example Programs

G-21

Optimizing MSG Time-out If the time delay between sending a command to an Enhanced Bar Code Decoder and polling for the reply is not long enough, the MSG instruction will time-out (MSG TO bit = 1) each time it is enabled from that point forward. To re-synchronize the SLC processor and the decoder, you need to cycle power on the decoder to clear its buffer. There are ways of clearing the buffers in the decoder, such as sending a Clear Buffers command or a Reset command to the decoder. However, the best way to handle this issue is to never let it happen. Optimizing the time delay between sending the initial command and polling for the reply is the best way to accomplish this. The delay must be long enough so the decoder has enough time to formulate a reply to the command and short enough to not impact the throughput of the application.

Example MSG Instruction Configuration The example SLC 5/03 and SLC 5/04 ladder program demonstrates how to send commands to an Enhanced Bar Code Decoder, and then after a time delay, pol for a reply. The internal set up screen parameters for the two MSG instructions in the example ladder program are shown below, along with the necessary Enhanced Bar Code Decoder configuration parameters. Table G.3 Message Configuration MSG #1

MSG #2

Type peer-to-peer peer-to-peer

Read/write write read

Target device

485CIF

485CIF

Local/remote local local

Control block

N7:0

N7:20

Channel

1

1

Target node

2

2

Our source file address

N7:15

N7:40

Target CIF offset(1)

0

0

Message length in elements

1

10

Message time-out (seconds)

5

5

(1)

The Target CIF Offset when working with Enhanced Bar Code Decoders as slaves on DH-485 must contain a value greater than 255. However, 255 is the largest value SLC programming software allows you to enter into this parameter in a MSG instruction. Therefore, use an unconditioned rung with a MOV instruction to move the proper value into the Target CIF Offset field. The example ladder program in this section demonstrates this. Note that 1586 decimal in a “MSG Write” is the value which results in a properly configured Enhanced Bar Code Decoder to initiate the “trigger” function. A value of 256 in a “MSG Read” requests a specified number of words of data from the bar code decoder. In this example, we are reading 10 words or 20 characters (bytes).

Publication 1747-RM001G-EN-P - November 2008

Page 676

G-22

Application Example Programs

Example Scanner and Decoder Configuration

Table G.4 Scanner and Decoder Configuration

Publication 1747-RM001G-EN-P - November 2008

Scanner Configuration Parameters

2755-DS/DD Series B Enhanced Bar Code Decoder Configuration Parameters

Scanner Control Page

Host Configurations Page

Discrete I/O:

Read Package 25 ms No-Read Package 25 ms

Baud Rate:

19200

Laser Light:

Triggered

Bits/Char:

8 Data 1 Stop

Decode Mode:

Host

Parity:

Even

No-Read Time:

2000 ms

Host Protocol:

DH-485 PCCC-1

Inter Scan Time:

none

Device Address:

2

Capture Count:

2

ACK Char:

none

Symbols/Scan:

1

NAK Char:

none

Symbols/Package 1 :

Large Buffer:

No

Match Complete:

Send Host Message: Package

Immediately after Valid

Transmission Check:

none

1

Page 677

Application Example Programs

G-23

Example Ladder Program

This rung detects the Photo Switch input going from false-to-true, and latches internal storage bit B3/1.

This rung moves the decimal value for the bar code decoder “trigger” command into the MSG instructions “Offset” parameter. The programming software does not allow values greater than 255 decimal to be entered into a MSG control block “Offset” value.

The internal storage bit (B3/1) gives the MSG instruction a false-to-true transition to send the initial command. B3/1 remains latched until both the DN and DA bits are set for the MSG instruction.

The initial reply from an Enhanced Bar Code Decoder will result in MSG DN = 1 and MSG DA = 0. This simply indicates that the decoder has received the command, but has not yet formulated a reply. The maximum time delay needed between sending the initial command and sending a poll to get the reply is 250 ms. In most cases this delay could be much less (30 ms to 100 ms), depending on the number of features the decoder is configured for.

Publication 1747-RM001G-EN-P - November 2008

Page 678

G-24

Application Example Programs

The internal storage bit, B3/1, holds the MSG instruction true until DN and DA are both set, indicating completion of the command sent and reply received sequence. When DN is set and DA is reset, unlatching the MSG EN bit effectively toggles the MSG instruction the same as if the MSG rung were toggled, i.e. rung conditions made false, then true. The MSG instruction is toggled one time after DN and NOT DA plus some time delay, to send a final poll to the decoder to get the MSG reply. When the reply is received, the SLC processor sets DN and DA.

When the SLC processor sets both DN and DA for a MSG instruction, the MSG sequence to an Enhanced Bar Code Decoder is complete. In this case, the decoder has received the “trigger” command and has performed this command. Therefore, unlatch B3/1 at this time to be ready for the next request for “trigger”.

If an error occurs with the MSG instruction, the ER bit is set. If this occurs, the user can either try to resend the same message again by unlatching EN, or at this point, could sound an alarm or route the product down a rework loop or some other similar action. If the latter choice is used, you must also unlatch B3/1 at this time to be ready for the next request for “trigger”.

This rung detects false-to-true transitions of either a good read or a no-read input from the bar code decoder and latches internal storage bit B3/2. B3/2 then, in the next rung, initializes the MSG read command to the decoder. This is done if either a good read or a no-read occurs, because the no-read message configured in the decoder is data as much as actual bar code label data. Therefore, the ladder program must distinguish between data that means no-read as well as actual bar code label data.

Publication 1747-RM001G-EN-P - November 2008

Page 679

Application Example Programs

G-25

This rung moves the decimal value for the bar code decoder “Read” command into the MSG instruction’s “Offset” parameter. The programming software does not allow values greater than 255 decimal to be entered into a MSG control block “Offset” value.

The internal storage bit, B3/2, gives the MSG instruction a false-to-true transition to send the initial command.

The initial reply from an Enhanced Bar Code Decoder will result in MSG DN = 1 and MSG DA = 0. This indicates that the decoder has received the command, but has not yet formulated a reply. The maximum time delay needed between sending the initial command and sending a poll to get the reply is 250 ms. In most cases this delay could be much less (30 ms to 100 ms), depending on the number of features the decoder is configured for.

The internal storage bit, B3/2, holds the MSG instruction true until DN and DA are both set, indicating completion of the command sent and reply received sequence. When DN is set and DA is reset, unlatching the MSG EN bit effectively toggles the MSG instruction the same as if the MSG rung were toggled, i.e. rung conditions made false, then true. The MSG instruction is toggled one time after DN and NOT DA plus some time delay, to send a final poll to the decoder to get the MSG reply. When the reply is received, the SLC processor will set DN and DA.

Publication 1747-RM001G-EN-P - November 2008

Page 680

G-26

Application Example Programs

When the SLC processor sets both DN and DA for a MSG instruction, the MSG sequence to an Enhanced BAr Code Decoder is complete. In this case, the decoder has received the “Read” command and has formulated a reply to this command. Therefore, unlatch B3/2 at this time to be ready for the next “REad” request. In addition, when DN and DA are both set, this indicates that the data received with the read reply (except “no-read” data) is valid and may be buffered or used.

If an error occurs with the MSG instruction, the ER bit is set. If this occurs, the user can either try to resend the same message again by unlatching EN, or at this point, could sound an alarm or route the product down a rework loop or some other similar action. If the latter choice is used, you must also unlatch B3/2 at this time to be ready for the next “Read” request.

Publication 1747-RM001G-EN-P - November 2008