Question: My code compiles fine and works properly, besides the push buttons I cannot get to work properly, and it has something to do with the
My code compiles fine and works properly, besides the push buttons I cannot get to work properly, and it has something to do with the code, but I cannot figure out why. Here is my code:
int main
clearhex;
timerinitperiodmultipler;
pioinit;
while
IOWRALTERAAVALONPIODATALEDRBASE, x;
return ;
static void timerinitint periodmultipler
Setting the stop bit high
IOWRALTERAAVALONTIMERCONTROLSYSTEMTIMERBASE, ;
int period SYSTEMTIMERLOADVALUE periodmultipler;
int periodh period ;
int periodl period & xFFFF;
IOWRALTERAAVALONTIMERPERIODLSYSTEMTIMERBASE, periodl;
IOWRALTERAAVALONTIMERPERIODHSYSTEMTIMERBASE, periodh;
IOWRALTERAAVALONTIMERCONTROLSYSTEMTIMERBASE, ;
alticisrregisterSYSTEMTIMERIRQINTERRUPTCONTROLLERID
SYSTEMTIMERIRQ, timerisr, NULL, NULL;
static void timerisr
Reset status
IOWRALTERAAVALONTIMERSTATUSSYSTEMTIMERBASE, ;
if incrementingdecrementingflag
x pow redled;
redled;
if redled incrementingdecrementingflag ;
else
x x ;
redled redled ;
if redled incrementingdecrementingflag ;
void pioinit
void edgecapturekeyptr void&edgecapturekey;
void edgecapturekeyptr void&edgecapturekey;
void edgecapturekeyptr void&edgecapturekey;
Initialize Key
IOWRALTERAAVALONPIOIRQMASKKEYBASE, ;
IOWRALTERAAVALONPIOEDGECAPKEYBASE, x;
alticisrregisterKEYIRQINTERRUPTCONTROLLERID KEYIRQ,
handlekeyinterrupt, edgecapturekeyptrx;
Initialize Key
IOWRALTERAAVALONPIOIRQMASKKEYBASE, ;
IOWRALTERAAVALONPIOEDGECAPKEYBASE, x;
alticisrregisterKEYIRQINTERRUPTCONTROLLERID KEYIRQ,
handlekeyinterrupt, edgecapturekeyptrx;
Initialize Key
IOWRALTERAAVALONPIOIRQMASKKEYBASE, ;
IOWRALTERAAVALONPIOEDGECAPKEYBASE, x;
alticisrregisterKEYIRQINTERRUPTCONTROLLERID KEYIRQ,
handlekeyinterrupt, edgecapturekeyptrx;
void handlekeyinterruptvoid context
volatile int edgecaptureptr volatile int context;
edgecaptureptr IORDALTERAAVALONPIOEDGECAPKEYBASE;
Set delay to second
periodmultipler ;
timerinitperiodmultipler;
printfKey pressed. Speed set to second.
;
IOWRALTERAAVALONPIOEDGECAPKEYBASE, x;
IORDALTERAAVALONPIOEDGECAPKEYBASE;
void handlekeyinterruptvoid context
volatile int edgecaptureptr volatile int context;
edgecaptureptr IORDALTERAAVALONPIOEDGECAPKEYBASE;
Set delay to ms
periodmultipler ;
timerinitperiodmultipler;
printfKey pressed. Speed set to milliseconds.
;
IOWRALTERAAVALONPIOEDGECAPKEYBASE, x;
IORDALTERAAVALONPIOEDGECAPKEYBASE;
void handlekeyinterruptvoid context
volatile int edgecaptureptr volatile int context;
edgecaptureptr IORDALTERAAVALONPIOEDGECAPKEYBASE;
Set delay to ms
periodmultipler ;
timerinitperiodmultipler;
printfKey pressed. Speed set to milliseconds.
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
