Download Print this page

Omron NS Reference Manual page 27

Hide thumbs Also See for NS:

Advertisement

Section2 Functions
NS series Macro Reference
2-2 Details of the Function
This section describes details of standard functions used in Macro programming.
BCD
Converts the Value to BCD code
Applicable versions
Format
Function
Return Value
Example
BIN
Converts BCD code to Numeral value
Applicable versions
Format
Function
Return Value
Example
System Version 2 or higher
BCD(S)
Convert value "s" to BCD code
Converting range is 0 to 99999999
If you specify the character string outside of the range, overflow occurs.
"0" is set at the end of the character string.
BCD code
$W0 = 1234; 'Set value 1234 to $W0
$W10 = BCD($W0); 'Set BCD code (H1234) to $W10
$W20L = 12345678;
'Set value 12345678 to $W20 to $W21
$W22L = BCD($W20L);
'Set BCD code (H12345678) to $W22 to W23
System Version 2 or higher
BIN(S)
Convert BCD code S to numeral value
Converting range is H0 to H99999999
Numeral value
$W0 = H1234;
'Set BCD code (H1234) to $W0
$W10 = BIN($W0); 'Set 1234 to $W10
$W20L = H334455;
'Set BCD code (H334455) to $W20 to $W21BCD
$W22L = BIN($W20L); 'Set 334455 to $W22 to $W23
7

Advertisement

loading

This manual is also suitable for:

Ns-series