Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

three separate counters using pic

Not open for further replies.


Newbie level 6
Aug 11, 2008
Reaction score
Trophy points
Activity points
Is it possible to make three separate counters using pic?

do you mean making counters that count from 0,1,2,3,etc...etc...? if yes then make three variable and increase/decrease it in event of pushing 1 of 3 button. and display the variables using either multiplexed 7 segment or with the help of MAX7219.
here is pseudocode:

declare 3 variable here to store the count data

while(1) {
if button 1 is pressed then increase variable 1
if button 2 is pressed then increase variable 2
if button 3 is pressed then increase variable 3
end if
end if
end if
send all three variables to display

Yes you can.
You need to scan for 3 inputs continuously. Then if any clock detected, increment the counter corresponding to that input.

You can also do it by external interrupt method if 3 INT pins are available in your pic. Generally 18f series may have 3 INT.
You can also use timers in pic as a counter.

If you are using push buttons as clock to counter then you must be aware of the SWITCH BOUNCE. Then you need to include some delays to avoide multiple counts in counter due to a single button press...

---------- Post added at 02:25 ---------- Previous post was at 02:23 ----------

for that just search 'switch debounce'

thank you for your answers
yes they are three separate counters ,actually all of them use
the same start ,count variable but each should stop according to
a different condition ,as if you were measuring time taken by three
runners all of them started at the same time but each one will stop
running at a certain moment according to a certain external condition

Not open for further replies.

Part and Inventory Search

Welcome to