Manual (not Free Run)Counter using PIC16F628A

Microcontroller Topics
Post Reply
Kriz
Corporal
Corporal
Posts: 6
Joined: Sat Aug 20, 2011 9:49 pm

Manual (not Free Run)Counter using PIC16F628A

Post by Kriz » Sat Aug 23, 2014 7:45 am

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
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Manual (not Free Run)Counter using PIC16F628A

Post by Neo » Sun Aug 31, 2014 2:56 pm

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!
Post Reply

Return to “Microcontrollers”