15.07.2013 Views

Automatic control function programming manual ladder language

Automatic control function programming manual ladder language

Automatic control function programming manual ladder language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.4 Binary —> BCD Code Conversion bin_bcd<br />

Syntax<br />

6 - 6 en-938846/7<br />

bin_bcd(binary_code)<br />

Binary_code: Operand or numerical expression in binary code.<br />

Operation<br />

The operand considered as signed can have a width of 8, 16 or 32 bits. It is extended on 32 bits before being placed<br />

in the stack. Conversion can only be performed on an operand between 0 and 99999999. If the operand is outside<br />

these limits, conversion is incorrect and the <strong>function</strong> returns -1.<br />

Examples:<br />

%V0.W=bin_bcd(1234)<br />

1234==0x4D2 Memory representation 0000-0100-1101-0010<br />

0 4 D 2<br />

%V0.W Memory representation 0001-0010-0011-0100<br />

1 2 3 4<br />

%V0.L=bin_bcd(12345678)<br />

12345678==0xBC614E Memory representation 0000-0000-1011-1100-0110-0001-0100-1110<br />

0 0 B C 6 1 4 E<br />

%V0.L Memory representation 0001-0010-0011-0100-0101-0110-0111-1000<br />

1 2 3 4 5 6 7 8<br />

Return Code<br />

If OK<br />

Conversion result<br />

Error<br />

-1: Operand not between 0 and 99999999.

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

Saved successfully!

Ooh no, something went wrong!