Timer Interrupt Prescaler Rate

For general Flowcode discussion that does not belong in the other sections.
Post Reply
liudeqiang_2008
Posts: 9
http://meble-kuchenne.info.pl
Joined: Wed Jan 12, 2022 8:25 am

Timer Interrupt Prescaler Rate

Post by liudeqiang_2008 »

Hello,

I use a main loop to turn on and turn off LED1 every 1 second. Using a timer interrupt to call Macro LED2_Blink.

In the timer interrupt setting, I use 1:1024 Prescaler Rate to set the Interrupt Frequency to 61.035 HZ.
As I understand, in every 1 second the timer interrupt will active 61 times.

In the Macro LED2_Blink, I made a Variable :Count , to count the active times of timer interrupt, if the Count goes up to 61, I will turn on/turn off the Led 2. After that ,the Count will be set back to 0.

Than the 2 Leds should blink almost in same step, every 1 second turn on or turn off.

But in the simulation mode, the Led 2 is much fast than Led 1.
I have attached my program, could you please support me for this?

Thank you in advance!
Best regards,

Adam.
Attachments
TimerINT.zip
(2.46 KiB) Downloaded 175 times

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 503 times
Been thanked: 686 times

Re: Timer Interrupt Prescaler Rate

Post by BenR »

Hi Adam,

Timings for interrupts in the simulation will not be accurate, mainly bacause they rely on Windows based timings which are not timing accurate. On the actual microcontroller the timing should be much more as expected.

liudeqiang_2008
Posts: 9
Joined: Wed Jan 12, 2022 8:25 am

Re: Timer Interrupt Prescaler Rate

Post by liudeqiang_2008 »

Hi Ben,

Thank you for your reply, I will test it in microcontroller.

BR
Adam

Post Reply