We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Should I be using the "volatile" declaration with the Keil C compiler? It hasn't made a difference so far - as far as I can tell (which may or may not mean anyting). The manuals make no reference to it one way or the other.
"Any variable which can be changed by something outside of a very narrow "local" view of the immediate code should be declared volatile. This includes variables shared with other tasks and variables shared with interrupt handlers, as well as addresses that overlay hardware addresses and might be updated by the hardware." There are additional considerations when preemptible task switching and interrupts are used. In these situations volatile will not help (but won't necessarily hurt). When manipulating variables of more than one byte in size, you (the coder) have to guaranty mutually exclusive access, since the MCU can't modify multi-byte data objects atomically. Even with 1-byte data objects, you've got to know whether the manipulation is atomic by examining the compiler output.
Well, of course. Under RTX51Tiny, if the pre-emptive task-switching is turned off then it can't change tasks unless allowed to by an os_switch_task or os_wait call.
"Well, of course. Sorry to have offended you by stating the obvious.