Hi Friends ,
Can any one help me to do coding for PIC16F628A , to build Counter Using Hitech C.
My requirement is , each time pressing button counter value should increment by one and need to include button for the decrements in a same way.
thank you!
Kriz
Manual (not Free Run)Counter using PIC16F628A
Re: Manual (not Free Run)Counter using PIC16F628A
No time to write the whole program. As a help will write the pseudo code.
Initialise port / set direction
Set the pins connected to two buttons as inputs
click_count = 0;
while (1){
Read button 1
if clicked then
click_count++;
delay (100ms); // to avoid debounce effect
end if
Read button 2
if clicked then
click_count--;
delay (100ms); // to avoid debounce effect
end if
}
You can ask which step you need help on above code. Good luck!
Initialise port / set direction
Set the pins connected to two buttons as inputs
click_count = 0;
while (1){
Read button 1
if clicked then
click_count++;
delay (100ms); // to avoid debounce effect
end if
Read button 2
if clicked then
click_count--;
delay (100ms); // to avoid debounce effect
end if
}
You can ask which step you need help on above code. Good luck!