Lighting bits one at a time.

gbradley

Lifetime Supporting Member
Join Date
Apr 2002
Location
Corona, Ca.
Posts
1,638
I am trying to do something that is so simple, but I can't figure out how to do it without using the Add and compare instructions.
Basically, I want to turn on a bit with one push of a button and leave that bit on.
Now with another push of the same button, turn on the next bit
With another push of the button the third bit lights.
Finally the last push of the button turns off all bits and starts the process over.
Here is how I am doing it, and it works, but it doesn't seem very elegant.

Simple.jpg

LED.jpg

I tried using one shots and latching the bits, but It kept racing through.
Any ideas?
Thanks
George
 
hope this helps

I'm not familiar with the environment you are using there, I have limited exposure to environments other than GE. In Versapro I would do what you are wanting to do like this...

If your language doesn't have a built in "Bit Set Word" function, I don't think it would be too hard to make one...

ScreenShot002.jpg
 
Last edited:
And yet another way...

lightson.jpg


I wouldn't call it elegant but it will do the bit shift up to 14 times (adjust the GRT to limit it or the overflow will crash your processor). A value of 7 will do three shifts and then reset.
 
Use a shift register.
At the OSR of the pushbutton turn ON the shift register input and then shift.
When the word = 65535 [all 16 bits are ON] clear the word by move 0 to it.

If you only want to turn on say 8 bits then clear the word when it = 255.

:nodi:
 
One More

Do not use B3:0/0, start your output mapping with B3:0/1
This example uses indirect addressing. Each time the PB is pressed the counter will count up one value and the bit corresponding to the counter accum. value will be latched. When counter is done, clear the counter and B3:0.

Not tested, should work.

LITES.png
 
Another for the mix:

state009.JPG

or in statement list

Code:
	  A	 I	  0.0
	  FP	M	  0.0
	  JCN   end
	  AN	Q	  0.0
	  S	 Q	  0.0
	  BEC   
	  AN	Q	  0.1
	  S	 Q	  0.1
	  BEC   
	  AN	Q	  0.2
	  S	 Q	  0.2
	  BEC   
	  R	 Q	  0.0
	  R	 Q	  0.1
	  R	 Q	  0.2
end:  NOP   0
 
Last edited:
Wow what great ideas!:)
I really liked kolyur's and I was going to do it that way, but then BITS N BYTES suggested shift register.
I think that I will use BSL and ignore Bit B3:0/0 and that will work the way that I want.
You may notice that I had to move a 1 into the address on clear in order for the bits to shift.
BSL2.jpg

Thanks all
 
Last edited:
If this is going into production, be sure to document what you did and why so that the person following you can figure out what and why.

Story - I once did a load shed scheme this way. And although I documented what I did, the person following had a hard time with the concept. Once I gave him a lesson on how a PLC was binary and a word was only bits and in our case, 1 word was associated with all the bits of an output card, he understood.
 
I agree with Oakley about documenting it.

I actually liked your original code the best out of all the examples posted, I even prefer it to my own. It will not confuse anyone, and is plenty efficient enough for any system I can think of. I was curious why you were opposed to the GEQ instructions or if you were just looking for fresh ideas.
 
You guys are doing this the hard way

Make a table of integers or bits similar to what gbradley did at the bottom of his first post. Then wire up the button contact to the input of a counter. Use the counter to do indexed addressing into the table to get the bit pattern that needs to be sent to the I/O. When the counter index reaches the end of the table you can reset the counter index back to 0 and start all over. Now you can make the lights change in any way you want. Better yet, you can change the light pattern from an HMI. You can't change ladder from a HMI.
 
It's not going into production, but I am documenting it just the same.
I just want to be able to step through a process, on a sorting machine with one start button(No HMI).
Peters counter sounds like that will work too.
I was trying to get some ideas and other ways to skin this cat. (sorry Pierre)
Thanks again.
 

Similar Topics

Why AMIo800 Analog input module's I/O LED is Lighting up Red? Checked module connections, 4-20ma wires etc but this light is continuously Lighting...
Replies
1
Views
129
Hi all, I am trying to do Modbus communications via the CB1241 RS485 Communication Board on a Siemens S71200 PLC. I am using a 1215C CPU. After...
Replies
6
Views
294
Quick background info: I am doing a project with a cognex IS2000 model camera with a 6mm lens and am using 80/20 for the frame of the camera. The...
Replies
16
Views
5,749
Does anybody know if there's a way that I can have Logix Designer apply the green highlight to ALL elements that evaluate true (not just XIO/XIC...
Replies
9
Views
1,819
I am working with Honeywell Smart Line Transmitter STD700 Series The transmitters connected to the DE stem cards are pressure units that are...
Replies
2
Views
1,671
Back
Top Bottom