Installation manual
Publication 1747-RM001G-EN-P - November 2008
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)
(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).
00
Message length in elements 1 10
Message time-out (seconds) 5 5