13.07.2015 Views

[Instruction] Contents

[Instruction] Contents

[Instruction] Contents

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Basic Function <strong>Instruction</strong>FUN 21 D P→BINBCD TO BIN CONVERSION(Converts BCD data of the device specified at S into BIN and stores the result in D)FUN 21 D P→BINOperandS : The register to be convertedD : The register to store the converted data(BIN code)The S, D may combine with V, Z, P0~P9 toserve indirect addressingRangeOperandWX WY WM WS TMR CTR HR IR OR HR HSCR RTCR SR ROR DRWX0∣WX240WY0∣WY240WM0∣WM1896WS0∣WS984T0∣T255C0∣C255R0∣R3839R3840∣R3903R3904∣R3919R3920∣R4047R4096∣R4127R4128∣R4135R4136∣R4167R5000∣R8071S ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○D ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○* ○* ○D0∣D4095●●●The decimal (BCD) data must be converted to binary (BIN) data first in order for PLC to accept the datawhich is originally in decimal unit (BCD code) inputted from external device such as digital switch becausethe BCD data can not be accepted by PLC for its operations.Converts BCD data of the device specified at S into BIN and writes the result in D when the operationcontrol input "EN" =1 or "EN↑" ( P instruction) from 0 to 1. If the data in S is not in BCD, then the error flagFO0 is set to 1 and the old data of D are retained.Constant is converted to BIN automatically when store in program and can not be used as a sourceoperand of this function.Example16-bit BCD to BIN conversionLadder diagram Key operations Mnemonic codeX021P. BINEN S : WX 0D : R 1ERRORGORG X 0FUN 21PS : WX 0D : R 1X15X0↓ 1 2 3 4 ↓S WX0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 X0=B15B0↓↓D R1 0 0 0 0 0 1 0 0 1 1 1 1 0 0 1 06-38

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!