cancel
Showing results for 
Search instead for 
Did you mean: 

extern "C"

Amrello
Associate

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.

2 REPLIES 2
LMI2
Lead

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.
Evangelist III

> 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