void automode() { menudisplay(); int j=0; lcdcmd(0xC0); while(str5[j]!='\0') { lcddata(str5[j]); j++; } while(PORTDbits.RD13==1&&PORTDbits.RD7==1); if(PORTDbits.RD13==0) { PORTA=0xff; delay(1000000); } else if(PORTDbits.RD7==0) { manualmode(); } /* while(PORTDbits.RD6==1); if(PORTDbits.RD6==0) { i++; lcdcmd(0x01); }*/ }
/* * the program start */ void main(void) { unsigned char state = STATE_STARTUP; /* state machine */ while(1) { /* Loop forever */ switch( state ) { case STATE_STARTUP: startup(); state = STATE_INIT; break; case STATE_INIT: state = STATE_OPERATE; break; case STATE_SETUP: setup(); state = STATE_INIT; break; case STATE_OPERATE: if( buttonSetup == BUTTON_ON ) { state = STATE_SETUP; } else { automode(); manualmode(); } break; } // end switch }; // end while }