Chapter 6 Instruction Details
XBC E-Type Main Unit 6-103 Ve r. 1
6.20.2 BCD4, BCD4P, BCD8, BCD8P
Instruction
Step
P M K F L T C S Z D.x
U N D R
3~5 O - -
Operand Description Data Type
Data to convert to BCD or bit position of device number data is saved in
Bit position of device number to save data converted
[Flag Set]
Error
For BCD4 when S’s value is other than 0~9.
For BCD8 when S’s value is other than 0~99.
F110
1) BCD4 (Nibble Binary Coded Decimal)
(1) Converts specified S device’s 4-bit BIN data to (0~9) BCD4 and saves in specified D device area.
(2) Error Flag (F110) will be set if S value is other than (0~9).
2) BCD8 (Byte Binary Coded Decimal)
(1) Converts specified S device’s 8-bit BIN data to (0~9) BCD8 and saves in specified D device area.
(2) Error Flag (F110) will be set if S value is other than (0~99).
3) Program Example
(1) If P00000 is On, ‘9’s Nibble data will be BCD converted to ‘h9’ from P0200’s No. 4 bit.
(2) If P00001 is On, ‘99’s Byte data will be BCD converted to ‘h99’ from P0400’s No. 8 bit.
BCD4 9 P02004
P00000
BCD8 99 P04008
P00001