A better way to change a variable... EEPROM maybe?

Thread Starter

Dalaran

Joined Dec 3, 2009
168
I have a variable which I am increasing or decreasing depending on which of the 2 buttons was pushed (RB6/RB7). Using C language and PIC uC.

Rich (BB code):
    if(PORTB.F6 == 1){
      Set = Set + 0.1;
    }
    if(PORTB.F7 == 1){
      Set = Set - 0.1;
    }
The code consists of an infinite while loop with the above snipit embedded in it. The problem is that if the code takes longer to run you may need to hold the button for sometime before it registers. I know there is an "interrupt on change" function for the PORTB pins in the PIC I am using, but cannot figure out how to get anything I change in the interrupt back to my main function. Would it make sense to write to the EEPROM during the interrupt routine? Anyone with any better ideas?

Thanks.
 
Top