View previous topic :: View next topic |
Author |
Message |
leto
Joined: 02 Aug 2005 Posts: 14
|
Checking simultaneous events |
Posted: Mon Apr 03, 2006 2:35 pm |
|
|
Hi,
I need to check the status of between 12 or 16 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 5 in a second.
What is the better manner to solve it?
Thank you
leto |
|
|
leto
Joined: 02 Aug 2005 Posts: 14
|
|
Posted: Mon Apr 03, 2006 4:10 pm |
|
|
Yes, I say "real time" because this events can occurs simultaneously, so I think it would be a hardware solution instead of some kind of software loop checking input ports.
About 74HCXX's chips, I saw some type of them, but it works with just one input and 8 or 12 outputs to connect it to a UC. I need to read and count 12 or 16 independent inputs and treat each independently.
do you know any specific model of 74xx ?
Thank you. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 03, 2006 4:15 pm |
|
|
Quote: | I need to check the status of between 12 or 16 events of infrared barriers sensors. |
Describe the signals that you get from the sensors. Is the signal a
positive pulse that occurs for several milliseconds ? Or is it something
else ? |
|
|
leto
Joined: 02 Aug 2005 Posts: 14
|
|
Posted: Mon Apr 03, 2006 4:22 pm |
|
|
Sorry, 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. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Tue Apr 04, 2006 9:48 am |
|
|
Go with 2 of the 74HC30 8 input nand. Run the 2 outputs to the port B interupt on change B4,B5.
tie unused inputs high.
If interupt happens then I would latch data and read in serially through a set of 2 74HC165.
Thats just what i would do.
You could also tie both the outputs into another nand to get 1 signal... but that would add another chip. |
|
|
Guest
|
|
Posted: Tue Apr 04, 2006 10:07 am |
|
|
I think that is a good idea... So, the IC could be in sleeping.
Thank you.
leto |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Tue Apr 04, 2006 10:09 am |
|
|
Check the spec. Can the pic wake from sleep on a INT on change??
I don't know. I don't know which chip your using. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Apr 04, 2006 12:34 pm |
|
|
treitmey wrote: | Go with 2 of the 74HC30 8 input nand. Run the 2 outputs to the port B interupt on change B4,B5.
tie unused inputs high.
If interupt happens then I would latch data and read in serially through a set of 2 74HC165.
|
Will this work if one event starts before the last one ends? The NAND will trigger on the start of the first and stay till the end of the last, registering only one event. Is this acceptable?
These events are so slow (thousands of microseconds) that I would use a software only solution. Just have the PIC scan the inputs 8 at a time and XOR with the previous scan. A non-zero result means something changed, so you shift till you find it. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Tue Apr 04, 2006 1:35 pm |
|
|
SherpaDoug may be right. the serial read of 165 maybe too slow. But we don't know enough about what you are trying to do.
Do you just what to know when a beam is broken? Then you don't even
need to read all 16 inputs in. |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Wed Apr 05, 2006 2:52 pm |
|
|
leto wrote: | Sorry, 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. |
Out of curiosity, how are these sensors arranged? You say that someone can cut the beam of each sensor. It seems that you have the sensors adjacent to each other. Isn't it possible that one of the beams are blocked, but the corresponding receiver will still get the adjacent beam?
It seems that you cannot fire all infrared transmitters at the same time.
In my case, I detected 6 beams and I used Polling of the inputs.
You should be able to get it done fast enough w/o interrupts if that was all the PIC would be doing -- i.e. to monitor the inputs. |
|
|
|