Compare bits of dint to another dint value

seth350

Member
Join Date
Jul 2011
Location
Over yonder
Posts
373
Hello all,

I have been trying to come up with a solution for the following application and I am drawing a blank.

Compactlogix v20
I am using a MOV-EQU sequencer.

I have six different main steps of which each main step consists of 10 sub-steps. These six main steps with their sub-steps are located in a recipe array. Which is called by the operator.

I am monitoring which main step is in process and at what step the sub-step is at. I also monitor when each main step is complete.

I have an output for each step that tells me it is complete.
i.e, "Sub-Step = 10 --> Main Step Complete"

I need to use the "Step Complete" from each step to reset the machine back its beginning cycle. The problem is that not all of the steps are used for each recipe. Some recipes require all six others may only require two or three. It will vary based on which recipe is running.

This can be done in some lengthy ladder...but was hoping for a more classy approach.
Step1 Complete--] [--Step2 Complete--] [--Recipe Steps=2--Current Recipe Done(OTE)

I have the number of steps required stored in an active recipe array as a DINT.
I have the current step stored in an DINT.
I have the Step Complete outputs addressed to bits of a DINT.
Step_Complete.0,Step_Complete.1,Step_Complete.2, etc.

So, when trying to compare the "number of steps required DINT" to the "steps completed DINT", I get a value of 6 in the required DINT and 63 in the Completed DINT (if all six steps are complete). This is natural, but I would like to be able to say that 6 equals 63 by some means.
 
Thank you Bernie & Peter, I really appreciate it.

Not really sure what you meant by "2 shl 6-1=63" though?

Although, I did do a face palm when I saw what you came up with Bernie. Sometimes there are no pre-fabbed solutions in the form of a drag and drop instruction. ;)
 
Peter was showing how to get '63' from '6' by shifting the value '2' to the left by the number ('6') then subtracting '1'. That could have been used to generate the number that you would compare to the bit word.

Actually, Peter's note started a new way of thinking about this. If the 'Step_Complete' word is zeroed before the steps begin and the 'complete' bits are turned on starting with the lowest and working up then the attached code works just as well.

Steps2.jpg
 
Thanks Bernie, I like that way much better. And thank you for clarifying what Peter meant. I see what he was trying to tell me now.
 
Thank you Bernie & Peter, I really appreciate it.

Not really sure what you meant by "2 shl 6-1=63" though?

Although, I did do a face palm when I saw what you came up with Bernie. Sometimes there are no pre-fabbed solutions in the form of a drag and drop instruction. ;)
Actually it should be 1 shift left 6.
SHL or << is commonly used for shift left.
SHR or >> is commonly used for shift right.
 
I have the number of steps required stored in an active recipe array as a DINT.
I have the current step stored in an DINT.
I have the Step Complete outputs addressed to bits of a DINT.
Step_Complete.0,Step_Complete.1,Step_Complete.2, etc.

So, when trying to compare the "number of steps required DINT" to the "steps completed DINT", I get a value of 6 in the required DINT and 63 in the Completed DINT (if all six steps are complete). This is natural, but I would like to be able to say that 6 equals 63 by some means.

In S7 I would do it like this:
L diStepsCompleted
L diStepsRequired
AD // and-ing 32-bits double
L diStepsRequired
=D // Comparing double if equal
=xFinito //Finished, fertig, conec, coffeetime!!!

Kalle
 

Similar Topics

Hello again- after the nice thread on filling the .pre's on timer arrays, I'm in another bind. I need to look at 60 timer_array.dn bits and see...
Replies
20
Views
3,946
I am trying to setup a Fault Active bit in my logic. I have a range of faults roughly 0 to 500 (bits). I would like to have one instruction to...
Replies
1
Views
3,128
Hi All First post. I have 40 bytes in a database that are displayed as ascii text on a Lauer PCS 095 display, if any of the bytes arent valid...
Replies
3
Views
13,481
Help please. Im new to Omron and have a machine down. I have a compare = for barcode label scan. I've attached two pics. On the Mnemonics you can...
Replies
4
Views
618
Hi everyone! Accidentally closed it and it wont appear again. Checked and unchecked the option and seem to make no difference. Running v7.10.00...
Replies
16
Views
1,888
Back
Top Bottom