Using Bit Logic to Sequence

Guido

Member
Join Date
May 2005
Posts
10
Hi there folks,
I posted earlier, but I don't think I communicated correctly what I was trying to do: make one input cycle through 4 different outputs, turning the old output off as you cycle thru. This can be done with a counter or sequencer, but some companies I have dealt with don't allow the sequence stuff. A fella told me to learn bit logic and then you can do anything.
Here, if it's visible, is a pic of the program I wrote and it does work on the LogixPro Demo simulation:
bitlogicsequencer2.jpg

My question, is this a correct or acceptable way to do this? And in bit-logic terms, is there a better way?
I realized when writing, that you've got to look at each rung and branch on a scan to scan basis. At first I was confused and couldn't get anything to work right, as I had the bit logic to turn off the lights right below each rung that turned on the light. Simply moving them to the top made the program work, but will it work on a real PLC?

Thanks for any help/advice.

Guido
 
Last edited:
Lights

"some companies I have dealt with don't allow the sequence stuff"

It sounds like the teacher doesn't allow this type of stuff.
Look into using an ADD function. Each time the input is pressed, add 1, then use an EQUAL function to turn on each light.
 
Thanks Mark...this already makes sense: if it's equal it's on, if it's NOT then you don't have to go turning anything off.
 
...Or, start with "1" and double it each time you press the button or see an appropriate input condition. Then use the individual bits of the current value (0001, 0010, 0100, etc), as the "output" flags. When you get to the last used state, reset the count.
 
First there arent many companies that will limit the use of instructions for a plc. Knowing the bit logic is great, if what you did works that good too. I have some questions though.
  1. How do you turn off the lights?
  2. How do you stop "during" the sequence?
  3. What if you need to stop with light 2 off then resume at light 3?
  4. What if you need to stop in the sequence then restart at the beginning?
It gets detailed when developing something.
 
You can use SET/RESET-functions if this is possible.

And step X // step X = flag-bit
And conditions for step X to X+1
SET step X
RES step X-1

for your output

OR step X
OR step Y
= output Z

eventually

OR step X
and extraconditions X
= output Z
 
This is how I build simple sequences like you describe:

Sample4.jpg


Sample4b.jpg

16 bit word B3:1 contains the steps 1-4. B3:1/0 is used to prevent the sequence from stepping more than once during a single scan. Each time a step change occurs, the whole word is cleared and the appropriate bit is latched. Use these bits to drive your ouputs as necessary.
Paul C
 
Last edited:
The "OSR" instruction in the ML1400 is a completely different instruction then the logic above. An Allen Bradley gotcha between different platforms.



Use the "ONS" instruction instead.

See pdf.
 
"some companies I have dealt with don't allow the sequence stuff"

It sounds like the teacher doesn't allow this type of stuff.
Look into using an ADD function. Each time the input is pressed, add 1, then use an EQUAL function to turn on each light.


Better still, use a COUNTER (CTU) instruction, it has a built-in "rising edge" (false-to-true) transition and will only count once on the pushbutton press, unlike an ADD, which will add hundreds of counts while the input is on.

On particularly bad buttons, and with fast I/O update times, you may also need to "de-bounce" the button input, so that it doesn't give multiple ONs and OFFs.
 
...Or, start with "1" and double it each time you press the button or see an appropriate input condition. Then use the individual bits of the current value (0001, 0010, 0100, etc), as the "output" flags. When you get to the last used state, reset the count.

+1

Can be used on ANY PLC or PAC (May have to adjusted to use Equal statements if bit access isn't available.)

Bit logic is great, but gets messy of you need to hold your place if switched into Manual Mode, etc. The above sequence method holds your place and can be cleared when you want it to be.

BTW I hate sequencer instructions. Every PLC/PAC has different syntax and can difficult to troubleshoot. Especially for maintenance with limited experience. The "Sequencer" above is easy to see what step the machine is in, what it is waiting for and is easily troubleshot.
 
...Or, start with "1" and double it each time you press the button or see an appropriate input condition. Then use the individual bits of the current value (0001, 0010, 0100, etc), as the "output" flags. When you get to the last used state, reset the count.

+1

Need to consider memory retention for power interruptions requirements, reset of the sequence, jog (fwd/back) of the sequence, etc.

https://accautomation.ca/building-a-plc-program-that-you-can-be-proud-of-part-1/

Just some thoughts.
Regards,
 
"some companies I have dealt with don't allow the sequence stuff"

It sounds like the teacher doesn't allow this type of stuff.
Look into using an ADD function. Each time the input is pressed, add 1, then use an EQUAL function to turn on each light.

I have definitely worked with companies that don't allow sequencers (drum sequencers, etc). Bit logic is almost always accepted (in my experience)
 
I have definitely worked with companies that don't allow sequencers (drum sequencers, etc). Bit logic is almost always accepted (in my experience)

Why won't a company allow using sequencers? How can they even manage this? Is there an issue using sequencers in certain applications? Someone explain please.
 

Similar Topics

Hi, I'm just looking for a simple way to make a button in excel (via VBA I presume) to toggle a bit in RSLogix 5000. I just got FactoyTalkLinx...
Replies
9
Views
529
After watching The Universe is Hostile to Computers from Veritasium, I suddenly remembered a lost weekend years ago trying to reproduce the same...
Replies
12
Views
4,369
What programming technique would use a bit position in a Timer's acc value? For example T4:0.ACC/1 using RSLogix500 in a SLC
Replies
14
Views
2,871
Good Morning , I appreciate your help on a previous post.Your advice helped me understand more. My next question involves the same project...
Replies
8
Views
3,546
Hello, First off, I would like to apologize for beginner question. I am looking to use a 'memory bit' to keep track of the status of an object...
Replies
2
Views
1,286
Back
Top Bottom