Instruction Manual

Publication 1753-UM001C-EN-P - March 2010 111
High-Speed Counters Chapter 12
Decoder Mode/Gray Codes
The Gray code is a binary code where the code differs by only one bit
with two neighboring numbers. Gray codes are useful in mechanical
encoders, because a slight change in location affects only one bit. The
controller uses a Gray code (4 bits for a GuardPLC 2000 controller or
3 bits for GuardPLC 1200 and 1800 controllers) that has this structure.
Each counter input is fed to three internal counters. When a count is
accomplished, the values of the three internal counters are compared,
and if the three values differ by more than one bit, the measuring
result is rejected and Cnt[0x].State indicates an error.
If the measuring result is valid, the system variable Cnt[0x].Value
contains the associated value (see the above table).
Step Gray Code
(GuardPLC 2000)
Gray Code
(GuardPLC 1200,
1600, and 1800)
Cnt[0x].Value
0 0000 000 0
1 0001 001 1
2 0011 011 3
3 0010 010 2
4 0110 110 6
5 0111 111 7
6 0101 101 5
7 0100 100 4
8 1100
12
9 1101
13
10 1111
15
11 1110
14
12 1010
10
13 1011
11
14 1001
9
15 1000
8