Integer to bcd (to_bcd), C.9.8 integer to bcd (to_bcd) – Nematron Pointe Controller User Manual

Page 437

Advertising
background image

Pointe Controller User Guide

Appendix C: Ladder Diagram Block Reference

435

C.9.8 Integer to BCD (TO_BCD)

When used in a Ladder Diagram, the TO_BCD block converts a regular integer
value into an equivalent binary coded decimal (BCD).

Select the

tool (from the

Miscellaneous Blocks

toolbar) and click on a ladder

rung to insert the following block:

Once the block is inserted, you can double-click on it to

configure

it.

Functional Description

This block always passes the Enable input state (EN) through to the Enable Out
output state (ENO) without change; when EN becomes on, ENO is turned on, and
when EN becomes off, ENO is turned off.

When EN becomes on, the block function is executed: each digit of the Input
Value (IN) is separately converted into a 4-bit “nibble, and then the nibbles are
concatenated into a single binary which is placed in the Output Value (OUT).

For example, an integer value of 5319 would be converted in the following
manner:

DIGIT

5

3

1

9

NIBBLE

0101

0011

0001

1001

The resulting BCD is 0101001100011001.

NOTE: Given the 32-bit limit on the size of Logic Memory variables, the largest
integer that can be practically converted into a BCD is 99999999.

The block function is executed every time the ladder is

scanned

, so long as EN

remains on. If EN becomes off, then OUT remains at its last calculated value until
EN becomes on and the block function is executed again.

Advertising