Skip to main content
Amrello
Visitor II
September 2, 2018
Question

extern "C"

  • September 2, 2018
  • 2 replies
  • 904 views

Hello everyone, maybe it's a stupid question but in the interrupt handling function I can't rewrite a variable. I'm sure that the interrupt is triggered and assigns a value to rx_counter, read_msg is executed in a loop, but when the value of a variable is checked, it is always equal zero.

    This topic has been closed for replies.

    2 replies

    LMI2
    Senior III
    September 2, 2018

    Why are you using a screen capture and not code snippet.

    Have you tried making your variable volatile like this: volatile uint8_t       nbr;

    volatile uint8_t nbr;

    Pavel A.
    September 2, 2018

    > maybe it's a stupid question

    Maybe ...

    Do you see that rx1_counter is defined locally in the IRQ handler, and used in function read_msg?

    This means that another variable named rx1_counter is defined outside, and this is what read_msg() uses. IRQhandler modifies its local variable,

    -- pa