This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049C: Atomi access to variables

Part Number: TMS320F280049C

Hi,

I know this has been asked and answered several times but I want to ask this in a slightly different way.

Consider a 16 bit (WORD) global variable like:

volatile uint16_t counter;


if I read this variable in main (not interrupt) level:

uint16_t flag_value;

counter_value = counter;



and in an interrupt increment it like this



counter = counter + 1;

Given that I'm targeting F280049C which has only word access in hardware, is there any 

conceivable / realistic way the compiler could generate code that would do a partial read

of the counter ?

I have hard time accepting that in this circumstance and context the compiler could

generate non atomic read because the CPU can only do atomic reads of 16 bit values?!

What about floats?