Is there any way to detect which bit is first ON in my program

Hmm, my approach has problems

1) if the I/O and program scans are asynchronous: if a button becomes 1 after the first set of button tests, but before the second set (start/stop circuits), then that button press would not be recorded and future button presses would be disabled. This can be corrected with an input map, so the button discrete inputs are tested only once per scan.

2) A debounce (slug) circuit, with a seal-in, on each button might be needed, which could be integrated with the input map mentioned above. i.e.
Code:
  ton0.Q  sto0
----] [---]/[----[MOV/ADD logic]---

                       ton0
     btn0            [ TON  ]   sto0
--+--] [-----+-------[IN   Q]---( )--
  |          |  100ms[PT  ET]
  |  ton0.Q  |
   +---] [----+

   Reset      ton0
----] [------<RES>---
... times 8.


This

  • uses the rising edge of ton0.Q to react to only the first (debounced) press of each button.
  • has the Reset discrete input reset all of the timers
  • Would work in an AOI or FB
 
Last edited:

Similar Topics

Hi All I have x number of bits representing an active state on x number of valves and I want to be able to detect when more than one valve is...
Replies
7
Views
1,986
I would like to have contact with someone who has used Diagnostic Instructions for the PLC-5. I have the manual and the Allen Bradley web site...
Replies
1
Views
3,037
Does anyone know of a way to detect if someone is online with the controller in ControlLogix (from logic) I'm thinking that maybe there is a CIP...
Replies
7
Views
391
Hi all, I am trying to find a way of detecting a motor is not isolated before attempting to run an inverter. We would normally use a 4 pole...
Replies
19
Views
3,084
Hello everybody, I have a vendor system that has some remote monitoring (read only) and remote control (read/write) data that is available via...
Replies
7
Views
2,876
Back
Top Bottom