The Problem
Suppose I have two optical sensors attached to a room's door.
When a person enters the room, these are the signals from the sensors:
When a person leaves the room, these are the signals:
Using these signals, I need to implement a counter that will tell me how many people are in the room.
Assume up to 25 people may be in the room at any time. Assume any other signal pattern will not happen, only one person will leave/enter at a time, and there are no other exits.
What I have tried
I have tried using two 74LS190, connecting A to the clock, and B to the up/down switch. Like this:
However, I have run into some bugs when cascading: an enter
signal when we have 9 people sends the count to 10 then to 20. This happens because of rc
's specification.
Best Answer
You could pick a counter which is capable of representing the full required range natively, for example the 74F269 which is an 8-bit counter. You can then leverage the same trick you're using to feed
B
into the clock andA
into the up/down control. Note that this is reverse from how you're using the 74LS190 chip because the U/D pin is count up on high for the 74F269 chip (missed this before).