CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Checking simultaneous events

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
leto



Joined: 02 Aug 2005
Posts: 14

View user's profile Send private message

Checking simultaneous events
PostPosted: Mon Apr 03, 2006 2:35 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 03, 2006 4:10 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 03, 2006 4:15 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 03, 2006 4:22 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Tue Apr 04, 2006 9:48 am     Reply with quote

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








PostPosted: Tue Apr 04, 2006 10:07 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Tue Apr 04, 2006 10:09 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Apr 04, 2006 12:34 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Tue Apr 04, 2006 1:35 pm     Reply with quote

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

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Wed Apr 05, 2006 2:52 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group