Hi Martin,
medelec35 wrote:
Hi Steve, >Have you post the correct flowchart?

opps no I haven't, I think I have found my issue also gone back to think about it.
the relay's react to a falling voltage level I have a couple of boards that I can plug in to the test rig so I have different readings.
they are as is from our PCB manufacturer.
The set points where very close to each other and the wrong way round. (0.8 volts, trip signal happened first, then alarm)
the RB0 & RB1 counter was an attempt to keep the voltage readings for "alarm" and "trip" and detect if the interrupt had happened incase a relay didn't operate.
It will depend on what point the INT0 has been triggered?
not sure what you mean
Theory of operation example
Incoming voltage range 27.4 - 22 volts DC. Start at 27.3 volts
Reduce voltage
PCB Alarm relay de energises @ 23.8 Volts DC
Further reduce voltage
PCB Trip relay de energises @ 22.8 Volts DC
my understanding of an interrupt - more than likely wrong
when IOC pin changes state the interrupt will then go away from the main program do something else then return ?
Steve
:Edit - found another IOC example on the WIKI going to have another play with this also