Clyde,
Below is the code that I'm trying to run. It's a simple routine to cycle through a few different states each time power is applied. It's called once from main() after the user modules are initialized.
Aaron
Code:
BYTE PowerUp;
const BYTE EEPowerUp @ 0x0fc0;
void ReadSettings(void) {
PowerUp = EEPowerUp;
}
void SaveSettings(void) {
BYTE value;
_flash_temp = 25;
_flash_delay = (((24*100L-80)/13));
value=flash_writeBlock((void *) &PowerUp, BLOCK_ID);
}
void PowerUpState() {
//read and toggle the PowerUp byte to allow normal
//operation or color cycling
ReadSettings();
if (PowerUp == 0) {
//color cycle
PowerUp++;
} else if (PowerUp == 1) {
//just be on
PowerUp++;
}else if (PowerUp == 2) {
//cycle with pause
PowerUp=0;
} else {
PowerUp=0;
}
SaveSettings();
}