This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

gloable variable change by interrupt

I have a global int variable, and it will be change in ISR

because 8051 is a 8-bit MCU

I have a code
if(a == 0) it needs to check lowwer byte= 0 and higher byte =0

but interrupt a--;
so if a=0x100
lowwer byte =0
interrupt happen a = 0x0ff
higher byte = 0

It will have a wrong result

How ca I do?

0