Hi, I don't know how to edit my text, so I double post. And apparently, I pasted my code but forget to do some checking. Hehe. The code was pasted incorrectly. And sorry again for not specifying which If...Else. I was refering to the If...Else statement which contains my SW4, SW2, SW3 as parameters. If you can see, my higher priority If...Else statement is the statement which contains my SW4 and etc...
P.S please ignore the If..Else which uses parameter, ichoice because that is not the problem If...Else. I am facing. Thanks. >.
---------------------------------------------------------------------
#include "M68DEMO908GB60.h" /*customized header file for GB60DEMO board*/
#include "timer.h" //customized header file for timer
#include "leds.h" //customized header file for LED
#include "sine.h" //customized header file for sine wave
#include "dac.h"
#include "swtiches.h"
int ichoice;
int iTimActPerioddef;
int swit::check (void){
int iwaitmain=0, iSW2flag, iSW3flag,FFreqFlag=0;
timer2 Timer1;
if(SW4 == DOWN){ //SW1 start the data transfer process
if(ichoice==31){
iTimActPerioddef = 96;
TPM1C0SC_CH0IE = 1;
FFreqFlag = 0;
}else if (ichoice>31){
FFreqFlag = 1;
TPM1C0SC_CH0IE = 0;
}
} else if (SW2 == DOWN){ //SW2 increase the frequency
iSW2flag = 1;
} else if(iSW2flag == 1 && SW2 == UP){
if(ichoice> 36){
ichoice ++;
}
iSW2flag = 0;
Timer1.timdelay(1000);
} else if(SW3 == DOWN){ //SW3 decrease the frequency
iSW3flag = 1;
} else if(iSW3flag == 1 && SW3 == UP) {
if(ichoice > 0){
ichoice --;
}
iSW3flag = 0;
Timer1.timdelay(1000);
}
return FFreqFlag;
}