I am working on Atmega1280v. It is 8 bit MCU.
I have a 16 bit variable shared across interrupt. I have defined it as volatile
I was reading the documentation & found that if I have to access that variable in main then I have to disable interrupts first & then access.
1. I thought declaring a shared variable as volatile is enough?
2. Does that apply to all MCU & compiler.
3. If I access 16 bit shared variable in main across 8 bit machine then I should disable interrupt first & reenable them after accessing them?
4. If it is common, then what we should in 32 bit machine like ARM?
I have a 16 bit variable shared across interrupt. I have defined it as volatile
I was reading the documentation & found that if I have to access that variable in main then I have to disable interrupts first & then access.
1. I thought declaring a shared variable as volatile is enough?
2. Does that apply to all MCU & compiler.
3. If I access 16 bit shared variable in main across 8 bit machine then I should disable interrupt first & reenable them after accessing them?
4. If it is common, then what we should in 32 bit machine like ARM?