31.21.1.4 System Variables Indicating Execution Results - BCD/BCDP

Program Example

BCD

Converts a constant to binary coded decimal and stores it in the result data.

  1. When the positive transition instruction turns ON, the BCD instruction will be executed. When the BCD instruction is executed, 10 (1010 in binary) is converted to a binary coded decimal and the binary code 0001 0000 is stored in D1. When using a normally open instruction, the BCD instruction is always executed as long as the normally open instruction variable remains ON.

BCDP

  1. The BCDP and BCD instructions have different ways of detecting when to execute. In the BCDP instruction, only the upward transition is detected and the BCDP instruction is executed even when using a normally open instruction. Even if the normally open instruction variable remains ON, the BCDP instruction is executed only for one scan.
    For example BCD conversion of S1 (Data_A) = "99999999" to D1 (Data_B).