i'm currently working on hand clapping projects using pic16f84a
my condition is like this:
clap once within 3 sec = one output
clap twice within 3sec = another output
clap thrice within 3sec = another output
now my problem is:
i trying to use COUNT command for counting pulse received within 3 sec, but it doesn't works for me, i'm not sure whether my code is correct or not, hope anyone can help me on this,
my code is as below:
temp VAR BYTE
main:
Count PORTA.0, 3000
IF Count = %1 Then sub1
IF Count = %2 Then sub2
End
GoTo main
sub1:
For temp = 1 TO 7
PulsOut PORTB.0, 150
Pause 13
End
GoTo main:
sub2:
For temp = 1 TO 7
PulsOut PORTB.0,150
Pause 13
Count PORTA.0, 3000
IF Count = %3 Then main
Else
sub2
EndIF
GoTo sub2
my condition is like this:
clap once within 3 sec = one output
clap twice within 3sec = another output
clap thrice within 3sec = another output
now my problem is:
i trying to use COUNT command for counting pulse received within 3 sec, but it doesn't works for me, i'm not sure whether my code is correct or not, hope anyone can help me on this,
my code is as below:
temp VAR BYTE
main:
Count PORTA.0, 3000
IF Count = %1 Then sub1
IF Count = %2 Then sub2
End
GoTo main
sub1:
For temp = 1 TO 7
PulsOut PORTB.0, 150
Pause 13
End
GoTo main:
sub2:
For temp = 1 TO 7
PulsOut PORTB.0,150
Pause 13
Count PORTA.0, 3000
IF Count = %3 Then main
Else
sub2
EndIF
GoTo sub2