1 Reply Latest reply on Oct 26, 2020 10:59 AM by AashitaR_11

    IMPROPER COUNTER VALUES AND INTERRUPT GENERATION

    AaJ_4705826

      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