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?
Interrupts
-
- Posts: 145
- http://meble-kuchenne.info.pl
- Joined: Fri Dec 04, 2020 2:29 pm
- Has thanked: 26 times
- Been thanked: 7 times
-
- Matrix Staff
- Posts: 1952
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 510 times
- Been thanked: 698 times
Re: Interrupts
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: Interrupts
Hi Ben,BenR wrote: ↑Fri Dec 09, 2022 9:07 amIf 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.
would the behaiour of an STM32F051 be similar, WRT to when in an interrupt macro when a second interrupt?
thanks,
Bruce.