On a 32-bit processor, can an ISR and the main loop share an int32?
This may be a galactically stupid question, but I'm an 8-bit programmer making the leap to 32-bit programming.
On 8-bit CPUs, we could 'share' (read and set) a 1 byte (char, uint8_t) variable between ISRs and the main loop. Setting or reading it was atomic, so the ISR could set a flag and the main loop could read it, without corruption by interrupting between assembly instructions.
Is the same true, by chance, for 32-bit processors and 32 bit variables (uint32_t, int32_t)? Can I read to and write from a single 32-bit variable from ISRs and main loop with impunity?
(I'm guessing I'm not so lucky. In fact now I'm hoping nobody shoots down my 8-bit assertion as a premise...)
Thanks!
#isr #atomic