Kerzer Computers wrote: > > I need to monitor a pin and test what pulses it recieves. Two lows in one > second is one trigger, one low lasting one second is another trigger and one > brief low in one second is a third trigger. Each differant trigger calls a > subroutine, which energises either one of two relays for a timed period, > the timing and checking seems real difficult. Are you able to give me some > advice or some code please ? Please mail me direct so the list does not get > cluttered up. Thankyou > > Gordon Hmmmmm, so what is the mark/space ratio IE after the end of a pulse train be it 1 short,2 short or 1 long how long is it before the next pulse can be expected. This delay can be used to mark the start of a pulse train. now that you know the start you can use the edge trigger inturupt to re-set a counter. This counter would timeout after 1 second generating another inturupt. When the edge inturupt occores you can increment a register counter. now when the timer inturupt times out if the the pin is still high and the counter is only 1 then you have a 1 sec pulse, if the counter is 2 and the pin is low then you have a 2 pulse and finaly if the counter is 1 and you have a low pulse then you have a single pulse. if you now reset the register counter then the system is primed for the next pulse train. The advantage of this method is that you can get on with somthing else when waiting for a pulse. The only prerequiset of this method is that the delay between pulse trains be more than 1 second. Reguards Peter ..... ================================== = New Ideas come from those who = = didn't know it wasn't possible = ==================================