Programmable Controllers

Programmable Logic Controllers

Pico Controllers

PicoGFX Arithmetic Functions

The "NC" Numerical Converter Function for Pico GFX

Numerical Converter Function for Pico GFX
Symbol in the function
block diagram

The devices provide 32 numerical conversion function blocks NC01...NC32.

The function block converts BCD coded decimal numbers into integer numbers or decimal numbers into BCD coded numbers. The mode setting (BCD, BIN) is used to select the required conversion operation (BCD = Binary Coded Decimal).

Function

For each decimal number a BCD word consisting of a group of four bits is reserved.

Each number is converted to binary format separately and saved in a BCD word. Decimal numbers between 0 - 9 can be represented.

For example, 0111 0100 represents the decimal value 74.

Using 32 bits allows 7 BCD digits to be saved and provides a value range from -9999999 to 0 to +9999999.

"EN=1" starts the function block.
"EN=0" initiates a reset in which the output QV is reset to 0.

BCD mode

BCD -> Intreger value

Example: Conversion of the BCD number = (1001 1000 0111 0010 0001 0000)BCD to an integer value (1001 1000 0111 0010 0001 0000)BCD = ((1001)2(1000)2(0111)2(0010)2(0001)2(0000)2)10 = (987210)10

Caution: BCD numbers > 9 cannot be converted to a decimal equivalent. The corresponding number is then limited to 9.

BIN mode

The BIN mode converts an integer value to a BCD coded decimal value.

Note: Negative whole numbers are processed in the two's complement and are displayed accordingly.

Example: Conversion of the number (987210)10 to BCD format (987210)10 = ((1001)2(1000)2(0111)2(0010)2(0001)2(0000)2)10 = (1001 1000 0111 0010 0001 0000)BCD.

The Function Block and its Parameters

  Description Note
Function block input (DWord)
I1 Operand to be converted Value range BIN mode:
-9999999...+9999999,
Value range BCD mode:
± 1001 1001 1001 1001 1001 1001 1001
Function block output (DWord)
QV Contains the conversion result  
Contact
- - -
Coil
EN Activates the function block on status 1.  
Operating mode
BCD Converts a BCD coded decimal value to an integer value  
BIN Converts an integer value to a BCD coded decimal value  
Parameter set
Call enabled Function block parameters can be viewed on the device.  
Simulation
Possible

Memory Requirement

The numerical converter function block requires 32 bytes of memory plus 4 bytes if the function block input is configured with an NU constant.