Interrupts

For general Flowcode discussion that does not belong in the other sections.
Post Reply
alanwms
Posts: 145
http://meble-kuchenne.info.pl
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 26 times
Been thanked: 7 times

Interrupts

Post 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?

BenR
Matrix Staff
Posts: 1952
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 510 times
Been thanked: 698 times

Re: Interrupts

Post 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.

alanwms
Posts: 145
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 26 times
Been thanked: 7 times

Re: Interrupts

Post by alanwms »

Perfect Ben. Just what I needed.

Harvolt
Posts: 5
Joined: Tue Feb 14, 2023 5:07 pm
Has thanked: 2 times
Been thanked: 3 times

Re: Interrupts

Post 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.

Post Reply