Why is this variable not set?

I am working on a code snippet that calculates some values ​​based on synchronization data. It works on a microcontroller (TI MSP430)

I get an unusual behavior in that the variable never gets the assigned value.

unsigned int angle = 0;
unsigned long int average_period;
void main(void){
    ...
    while (1){
        ....
        angle = ((2359325536UL)/average_period);
        ...
        }
    }

In this code, I have a global angle of the variable (it must be global, since it is available in interrupts), and it calculated and installed many times in the main loop of my program.

However, its meaning never changes. If I set the angle for some other arbitrary value, it will remain in that value, so it’s not the way the calculation outputs zero.

, , ( 3 7,5 ). , , volatile.

. volatile, , .

+4
1

volatile , , , ISR. , angle ISR, .

, angle while (1), , , . volatile , .

volatile, angle , , , .

+4

All Articles