Timer Interrupt Prescaler Rate
Posted: Wed Jan 26, 2022 9:03 am
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.
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.