AnsweredAssumed Answered

volatile variables and "functions"

Question asked by karpavicius.linas on Nov 20, 2014
Latest reply on Nov 20, 2014 by Ivan Ivanov
i am running compile (IAR AMR) in highest optimization settting, but sometimes it does ignores my code, or even functions that does have purpose;

as example, DataRx[] is loaded by DMA with data from computer, and it is used for triggering ( software based), 160 is free running mode, 168 is external trigger

if i use uint8_t as my variable, this code is ignored, adding volatile uint8_t does solve problem, but then, compiler states that is problem in my other code ( but it works)
error code says for all lines:
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement

any idea how to tell compiler, that it must execute my trigger code, or should i move this code to outside main(), and create volatile function ? ( just tryed, it does work, but i should know what kind of programming error i am creating)