Jump to content

scorpio

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About scorpio

  • Rank
    Newbrie
  1. Hi, I was trying to do something like: void doFunctionLoop0(bit & enable) { while(enable) { // .... blinking led or something } } void doFunctionLoop1(bit & enable) { while(enable) { // .... beeping } } void main() { while(1) { enabledFlag = 1; if(state == 0) doFunctionLoop0(enabledFlag); else doFunctionLoop1(enabledFlag); } } where enabledFlag is set to zero by the interrupt (reaction to button), what causes new call to one of the functions according to state. The problem is, that in the assembler code the variable enable is duplicated and the while loops in functionLoops never end. Is there any nice way to specify that the reference is to volatile variable? The simple way to solve this problem is to declare global variable enabledFlag and throw the references away, but I'd like to know...
×
×
  • Create New...