IMPROPER COUNTER VALUES AND INTERRUPT GENERATION

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AaJ_4705826
Level 1
Level 1

Hello,

I am using a counter to measure the on and off time of the led input given to a GPIO pin. There is a LED On ISR and LED Off ISR. I read the counter value at the start of each ISR and set a flag. This flag is polled in the infinite FOR loop in the main.

When my code runs, it sometimes enters LED On ISR twice consecutively and gives weird on time values. I have logic for resetting the counter in my ISR using the control register.

<OFF>260580

<ON>260782

<ON>1003

<OFF>260842

<ON>258372

<OFF>260700

What could be the reason?

inthandlerCODE.PNG

0 Likes
1 Reply
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi AaJ_4705826​,

Can you please attach your project here ? This will help us understand the issue more clearly and also, the reason for the interrupts to be generated twice.

Best Regards,

Aashita

0 Likes