Omron CP1H Data Conversion Instructions

Programmable logic controller programming is all about manipulating the bits within the memory of the controller. Sometimes we need to convert from one form to another. This is where we will use data conversion instructions. BCD to Binary, Line to Column, Grey Scale and Multiplexing are just some of the data conversion instructions. We will be looking at some of these instructions in the Omron CP1H PLC. Examples of some of the instructions will be presented.

Previously in this CP1H series we have discussed:
System Hardware
Establishing Communication
Setting, Forcing and Online Editing
Numbering Systems and Addressing
Data Movement
Compare Instructions
Data Shifting Instructions
Math Instructions

Several different data conversion instructions are available in the CP1H. A full explanation can be obtained by using the help menu in the CX-Programmer software or the Programming Manual for the CP1H. Links are provided at the end of this post.
Instructions can have different variations.
Let’s look at when this instruction will execute:
BIN(023) when used will be scanned and executed every cycle of the PLC that the input condition is on.
@BIN(023) when used will be executed when the input condition turns from off to on. This will trigger the instruction to happen only once.
Please refer to the programming manual or help file in CX-Programmer for different variations of the instructions that you want to use. We will now go over some of the data conversion instructions in the Omron CP1H. This will give you a general idea of the instructions available.

The first few conversions are usually used on math instructions to convert from one numbering system or coding to another. There are several numbering conversion instructions in the CP1H.

This instruction will convert BCD (Binary Coded Decimal) to Binary.


This will convert a Binary number to BCD.


In order PLC models, you had to use the 2’s complement to handle negative numbers in the controller.
Let’s say we have two numbers that we want to add together: 2 and -1. Using 4 bit binary we would represent this information as follows:
2 – 0010
-1 – 1001
Using 2’s complement on -1 we get 1111.
Adding these numbers together we see:
0010 + 1111 = 0001 (discard the carry (4 bits))
We now have the correct answer of 2 + (-1) = 1


The multiplex instruction will read a digit in the source word and turn on the bit representing that digit in the result word. This is used allot of the times in elevator controls. Each of the inputs for the floor call buttons are placed in an internal word. Multiplex and De-multiplex are used to determine the floor number to display and move the lift.

The instruction uses a control word that determines how may digits are used and where the digits are started.


The de-multiplex instruction will determine the first or last bit on in the source word and writes that value into the result word.


This instruction will convert a 4 bit hexadecimal digit in the source word into its 8 bit ASCII equivalent.
The digit designator is used to indicate the number of digits to use, starting location and parity. Parity is used in serial communications.

Example: 1 hex = 0001 binary = 31 ASCII (American Standard Code for Information Interchange)
What everybody ought to know about PLC numbering system. This post will discuss the ASCII table.


This instruction will take the 16 bits of the source word to a column of bits in a 16 word range of the destination. The bits in the destination are specified with the bit number.

Note: The opposite of this instruction is the Column to Line. LINE(063)


Gray code is used because only one bit changes at a time. This is ideal for PLC inputs such as encoders, because if the power is removed and started again you can tell exactly where you left off. See the following post on Gray Code for a complete explanation of this coding idea.
Here’s a quick way to convert grey code into binary for PLCs. This post will go through the logic of converting gray code.

Here is a quick chart on a 4 bit gray code to binary. Notice that only one bit changes at a time from value to value.

Control words are used to determine the resolution, conversion mode and zero point compensation.

You can see that we have many different data conversion instructions in the Omron CP1H. This should give you a good idea of what is possible.

See the YouTube video below on data conversion instructions in the Omron CP1H PLC.

The following is a list of manuals associated with the CP1H programmable logic controller. See the descriptions for each of these manuals in the first post: Omron CP1H System Hardware
W450 – SYSMAC CP Series CP1H CPU Unit Operation Manual
W451 – SYSMAC CP Series CP1H CPU Unit Programming Manual
W342 – SYSMAC CS/CJ series Communications Commands Reference Manual
W446 – SYSMAC CX-Programmer Ver. 6.1 Operation Manual
W447 – SYSMAC CX-Programmer Ver. 6.1 Operation Manual Function Blocks
W444 – CX-One FA Integrated Tool Package Setup Manual
W445 – CX-Integrator Operation Manual
W344 – CX-Protocol Operation Manual

You can download the PLC program as discussed above here.

Next time we will look at program control instructions in the Omron CP1H PLC.

Watch on YouTube : Omron CP1H Data Conversion Instructions
If you have any questions or need further information please contact me.
Thank you,

If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.

Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

It's only fair to share...Email this to someoneShare on LinkedInShare on FacebookShare on Google+Digg thisPin on PinterestShare on StumbleUponShare on TumblrTweet about this on TwitterShare on RedditPrint this page

Leave a Reply

Your email address will not be published. Required fields are marked *