Mitsubishi — Chapter 6 Application Instructions API 00-49

6 Application Instructions API 00-49 API 19 Operands: S : Source of data D : Conversion result Explanations: 1. If S and D are used in device F, only 16-bit instruction is applicable. 2. See the specifications of each model for their range of use. 3. Flags: M1067 (operation error); M1068 (operation error); D1067 (error code) 4. The content in S (BCD value) is converted into BIN value and stored in D . 5. Valid range of S : BCD (0 ~ 9,999), DBCD (0 ~ 99,999,999) 6. Provided the content in S is not a BCD value (in hex and any one of its digits does not fall in the range of 0 ~ 9), an operation error will occur. M1067, M1068 = On and D1067 records the error code 0E18 (hex). 7.

Constant K and H will automatically be converted into BIN format. Thus, they do not need to adopt this instruction. Program Example: When X0 = On, the BCD value of K1M0 will be converted to BIN value and stored in D10. X0 D10 Remarks: Explanations on BCD and BIN instructions: 1. When PLC needs to read an external DIP switch in BCD format, BIN instruction has to be first adopted to convert the read data into BIN value and store the data in PLC. 2. When PLC needs to display its stored data by a 7-segment display in BCD format, BCD instruction has to be first adopted to convert the data into BCD value and send the data to the 7-segment display. 3.

When X0 = On, the BCD value of K4X0 is converted into BIN value and sent it to D100. The BIN value of D100 will then be converted into BCD value and sent to K4Y20. X0 DVP-PLC Application Manual 6-33 Mnemonic Operands Function D BIN P Binary Type OP Bit Devices Word Devices Program Steps X Y M S K H KnX KnY KnM KnS T C D E F BIN, BINP: 5 steps DBIN, DBINP: 9 steps S * * * * * * * * * D * * * * * * * * PULSE 16-bit 32-bit EH3 SV2 ES EH3 EH3 ES EX SS SA SX SC EH SV EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV SV2 SV2 0 BIN K1M0 0 BIN K4X0 D100 BCD D100 K4Y20