Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Cheking 12 simultaneous digital inputs

Status
Not open for further replies.

leto

Junior Member level 1
Junior Member level 1
Joined
Jan 24, 2006
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,424
read 12 bits

Hi,

I need to check the status of 12 events of infrared barriers sensors. This must be in "real time" and all of them can appear at the some time.
Then, I'll fire an alarm if the amount of events is less than a "X" number in a second. What is the better manner to solve it?

note:
the input signal is a 5v pulse and it occurs when somebody cut the beam of each sensor. I'll have 12 sensors and its could interrupt each 10ms aprox. I need to detect each interrupt of each sensor.


Thank you
leto
 

You can employ a small microcontrller with ≥12 inputs and program it to scan inputs in a loop ..
For a microcontroller this is a trivial task, and the time required to sequentialy scan all inputs is well below 1ms ..
Microcontroller's inputs work with voltages 0-5V so you can connect outputs from sensors directly to inputs ..

Regards,
IanP
 

it could be posible. Now, After I read all inputs, i need to count each independent input in order to analize the amount of events by second of each input. eg.

Code:
pseudo-code

read_portb();                                    // read 12 bits simultaneously              
for bit=1 to 12
    if portb[bit] then array[bit]+=1       // count each bit independent
next bit

then, I would have an interrupt each second to analize the total count.

My question is: Is posible to include some IC in order to have "latched" each input and like this to avoid to lose some event?

thank you
leto
 

leto said:
Hi,

I need to check the status of 12 events of infrared barriers sensors. This must be in "real time" and all of them can appear at the some time.
Then, I'll fire an alarm if the amount of events is less than a "X" number in a second. What is the better manner to solve it?

note:
the input signal is a 5v pulse and it occurs when somebody cut the beam of each sensor. I'll have 12 sensors and its could interrupt each 10ms aprox. I need to detect each interrupt of each sensor.


Thank you
leto

If you want to observe the output on the instrument then you can use the Logic Analyzer which can plot the real time output from many nodes.
 

No, I need to make an electronic circuit.

thanks
 

Hi Leto,

Just some things to consider:
It sounds like you want to understand the direction of the motion. Have I understood?

The advice Ian gave you is good, and you should follow it. I think it is all you need, really, but if the above is true, then you will also need some kind of clock.

With each of the 12 inputs -
Test the input if it is low go to the next
if it is high time stamp and record which input

then, I would have an interrupt each second to analize the total count.
You could also increment a timer in this interrupt, but don't let your interrupt get too long, or you will lose any inputs! I think you could just do the analysis outside of the loop which tests if any inputs are high.

read_portb(); // read 12 bits simultaneously

The micros I know have only 8 bits per port, but yes, you could read the ports, two of them, one at a time. Anything more than 0x00 would indicate a tripped sensor; you wouldn't have to walk an array, and then write to another one. You would know which pin from the hex number you read on the port.

Is posible to include some IC in order to have "latched" each input and like this to avoid to lose some event?

Well you could latch them, but why would you want to? The controller is fast enough to get all 12 and process them, and do it all over so many times a second it would make your head spin. You won't miss any.

Something else you may want to look at is noise. You didn't say how far away the sensors are, but there is a good chance in the real world, of false triggers and other noise. Perhaps some scheme similar to switch debouncing would work here. I mean if one sensor is tripped only once for a time of a micro second or so, and no others are tripped it is probably a false signal. I would think that most moving objects would not be that fast, but then I don't know just what you are doing. More information would stimulate more ideas.

Anyway, your project is interesting; please keep us abreast of your developments.
Regards,
Robert
 

    leto

    Points: 2
    Helpful Answer Positive Rating
try 74ls147they are decoders 19 to 4 unless you want to buy a PC to do this
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top