AngryRobot

Turn 8 inputs into a number?

6 posts in this topic

All,

 

Is there an instruction that would let me take 8 inputs and map them to a word as a binary number?  These inputs are on input cards with other non-related inputs, so I cannot simply look at the CIO channel value.  For example, 1205.00 is a push button, and 1205.02 starts my binary inputs through 1205.09.

 

I need to look at 1205.02 through 1205.09 in a series and to decode it into binary.

Share this post


Link to post
Share on other sites

MOVB if in the processor. You do not specify the PLC type you are using.

Share this post


Link to post
Share on other sites

We need to know the model number of the Omron PLC that you are using.
Look at the instruction set under the data movement instructions heading.

Example:
http://www.edata.omron.com.au/eData/PLCs/CQM/W228-E1-08.pdf
Here is the manual for the  CQM1/CPM1/CPM1A/SRM1

In this PLC the Move Bit (MovB) instruction will only move one bit at a time. You need to use the Transfer Bits (XFRB) instruction. This will allow you to specify the number of bits to move from the source to the destination.

Here is a post that will show the XFRB instruction as part of the data movement instructions in the CP1H.
http://accautomation.ca/omron-cp1h-data-movement/

Regards,

Omron XFRB instruction.png

Omron MovB instruction.png

Share this post


Link to post
Share on other sites

I am using a CJ2H, sorry for leaving that out.

 

With the MOVB instruction, is it possible to designate how many bits to move?  Because some of these binary code inputs aren't full bytes so I might need to move six bits.

Share this post


Link to post
Share on other sites

https://assets.omron.eu/downloads/manual/en/w474_cs_cj_nsj_series_instruction_reference_manual_en.pdf

Here is the above instruction manual for the CJ2H.
The MOVB instruction will only move one bit at a time. Use the  MULTIPLE BIT TRANSFER  - XFRB  instruction. You will be able to specify the number of bits to move along with the starting bit location in the source and destination words. See diagram above.

Regards,

Share this post


Link to post
Share on other sites

Thank you!  The transfer bit instruction did the trick!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now