Chapter 6: Instructions
127
Instruction
Mnemonic
Decoder and Encoder with 8421
Range
Bit
■
Word
ENCO
DECO
ENCO: 8421 encoder
DECO: 8421 decoder
Double words
Ladder
ENCO: Inspect the S register. If there is a bit in the On state, encode
it (on bit n) and store it in the low-order 8 bits of D. If there are two
or more bits in the S register that are in the On state, only the highest
bit will be processed. The higher 8 bits of D do not change.
DECO: Interpret the lower 4 bits of the S register and store in D.
Description
1. ENCO: Set D to the value of the bit number of highest bit in S that is On (0 to 16). If there are
two or more On bits in S, use the location of the highest bit. The high-order 8 bits of D do not
change.
2. DECO: Set the bit location (0 to 15) in D pointed to by the value in the low 4 bits of S. All
other bits in D are reset to 0.
ENCO
$0000
→
$00
$0020
→
$06
$0800
→
$0C
$0001
→
$01
$0040
→
$07
$1000
→
$0D
$0002
→
$02
$0080
→
$08
$2000
→
$0E
$0004
→
$03
$0100
→
$09
$4000
→
$0F
$0008
→
$04
$0200
→
$0A
$8000
→
$10
$0010
→
$05
$0400
→
$0B
DECO
$0
→
$0001
$6
→
$0040
$C
→
$1000
$1
→
$0002
$7
→
$0080
$D
→
$2000
$2
→
$0004
$8
→
$0100
$E
→
$4000
$3
→
$0008
$9
→
$0200
$F
→
$8000
$4
→
$0010
$A
→
$0400
$5
→
$0020
$B
→
$0800
ENCO
D =
S =
R
R
DECO
D =
S =
15..8 7 6 5 4 3 2 1 0
S 0..0 0 1 1 1 0 0 0 0
D 0 0 0 0 0 1 1 1 6+1=7
invar
iable
ENCO
S ..... x x x x 0 1 0 1 = 5
D 0..0 0 0 1 0 0 0 0 0
15..8 7 6 5 4 3 2 1 0
DECO
Содержание D320 PLC
Страница 1: ...D320 PLC User s Manual...
Страница 18: ...6 D320 PLC User s Manual...
Страница 28: ...16 D320 PLC User s Manual...
Страница 34: ...22 D320 PLC User s Manual...
Страница 78: ...66 D320 PLC User s Manual...
Страница 176: ...164 D320 PLC User s Manual...
Страница 210: ...198 D320 PLC User s Manual...
Страница 258: ...246 D320 PLC User s Manual...