Page 1 of 1

Interrupts

Posted: Fri Dec 09, 2022 2:04 am
by alanwms
Hello -

I'm putting a signal (sine wave zero crossing) on the interrupt input pin of the PIC18f2553. I'm driving a motor from AC and the drive is a triac. Works well.

Normally, I like to store variables in Eeprom, and since I can't continuously write eprom values due to life, I store on power down. I monitor the DC volts, and at a specific low voltage, I run the eprom routine. That works well too.
Since I have a zero cross information each time the mains is at zero, I think I can determine the loss of AC based on missing pulses. In my case the time between pulses is 1/120 seconds (8.33ms)

Been thinking about this, and I think I need another interrupt for real time measurement.

I would like to understand how an interrupt acts when another interrupt happens. Any thoughts? How does flowcode handle this?

Re: Interrupts

Posted: Fri Dec 09, 2022 9:07 am
by BenR
Hello,

If your inside an interrupt macro when a second interrupt is triggered then on the 18F device the first interrupt macro will be fully completed and then the second interrupt macro will be called. As long as your monitor timer interrupt isn't too long it should effect your timings by much.

On other devices you can assign priority to the interrupts to say which one can jump in first.

It sounds like yout INT interupt could increment a counter. The timer interrupt could be fairly slow and look at the counter value and reset it to 0. If the count is still at 0 then the mains has gone down.

Re: Interrupts

Posted: Fri Dec 09, 2022 7:00 pm
by alanwms
Perfect Ben. Just what I needed.

Re: Interrupts

Posted: Tue Oct 24, 2023 12:05 pm
by Harvolt
BenR wrote:
Fri Dec 09, 2022 9:07 am
If your inside an interrupt macro when a second interrupt is triggered then on the 18F device the first interrupt macro will be fully completed and then the second interrupt macro will be called. As long as your monitor timer interrupt isn't too long it should effect your timings by much.

On other devices you can assign priority to the interrupts to say which one can jump in first.
Hi Ben,
would the behaiour of an STM32F051 be similar, WRT to when in an interrupt macro when a second interrupt?

thanks,

Bruce.