Hi
Can someone tell me if my code is correct? if not where is my mistake.
1)Write a C program to count the number of times PORT T pin 4 goes high. It should stop counting when PORT T pin 2 goes high. Note that DDRT should be appropriately configured. No de-bouncing is necessary.
P.S
Can someone tell me if my code is correct? if not where is my mistake.
1)Write a C program to count the number of times PORT T pin 4 goes high. It should stop counting when PORT T pin 2 goes high. Note that DDRT should be appropriately configured. No de-bouncing is necessary.
Rich (BB code):
#define GOHIGH4 (0x10)
#define GOHIGH2 (0x04)
void main(void){
DDRT |= GOHIGH4;
DDRT &= GOHIGH2;
int counting; //use to count
for (;;){
if((PTT&GOHIGH) != 0){
counting();
else if((PTT&GOHIGH2) == 1){
}
}
}