Hi I have connected 4 switches to PORTA0, 1, 2, 3.They are active low types.
I need to detect if any key is pressed then the function must be called. I think there are some syntax errors. Please correct them. I use mikroC.
I need to detect if any key is pressed then the function must be called. I think there are some syntax errors. Please correct them. I use mikroC.
Code:
while(1){
temp= 0b00001111 & PORTA;
temp = temp ^ 0b00001111;
if(temp>0){ // new key found
Key_Scan(); // do action on each switch
Update_LCD(); // if new key found update the display
}
}
Last edited: