PDA

View Full Version : 8 port Signal Loss Detector, possible to use a pic?



jamie_s
- 20th March 2006, 14:59
Im investigating some options for a next project.
What im planning on doing is monitoring 8 signals (or more depending on which pic I use) which are 0 - 5 volt signals

The signal would normally be high, and if it goes low, I want to wait for a predetermined timeout, and if it remains low for that timeout, then an output port is raised, until its manually reset / acknowledged.

I can work out how to do it using a single input signal, but would like to have different timeout values for each signal (preset values stored in eeprom)

Would a pic ie 16F628A be capable of a task like this, and what would be the best way to handle it?
Im thinking maybe using PortB interrupt on all pins, and then when the interrupt is fired, check which pin is low. Would this be the best way to do it?

The other thing I havent worked out is how to increment the counter for each port, so any advise will be helpful. Obviously I need 8 word variables, one for each port, which would increment according to an if / then statement depending on the port status, and if the port is high then it is reset?
Timeout values would be anywhere from 10 seconds to 60 seconds.

Any help / advice etc would be appreciated.

Melanie
- 20th March 2006, 15:59
This is very simple, and a 16F628 would be just fine. Interrupts would be total overkill... afterall, if you're waiting up to 60 seconds before you trip an alarm, why have 'instantaneous' notification of an alarm scenario?

If you set up a program loop that polls each port, and the total loop time is say 100mS, you simply increment a variable (one variable for each port pin being monitored) if that monitored pin is not what you expect it to be. When the variable exceeds the EEPROM setting for that pin, you trip your alarm. Worst case is your program gets to know of an alarm situation within 100mS of it happening - no big deal.