Jose Pino's projects & tidbits
"Great stuff from someone with an inquisitive mind"

Four Digit Counter

An Easy to build & multifunctional counter with 7-Segment Led Display. (5/06/2004)


Source: http://www.josepino.com/?four_digits_counter   Tags: microcontroller project electronics

CODE: JP6281 -- Updated May 27, 2004 FUSE CONFIG: Internal RC

Just one PIC to use it as counter with multiple functions. Here is the pin information:
Taken from http://www.josepino.com

Four digits counter

PIN FUNCTIONS:

  • CLEAR/COUNT - GND to clear count, VSS to count.
  • SAVE COUNT - GND start from zero on power up, VSS continue last count.
  • C CATHODE/C ANODE - GND to use COMMON CATHODE Display, VSS to use COMMON ANODE.
  • INPUT - Signal in, pulses to count.

    As you can see, now you can use any 7 Segment Led Display. Just connect the pin C CATHODE/C ANODE to the respective signal. The pin SAVE COUNT can be used to save the count and power off the circuit. When you power on the circuit, the display will resume the counting.

    An example how to use it using common cathode displays, no resume count on power up and free runing:

    Four digits counter - schematic

    Download the HEX file HERE

    Every time when you turn ON the circuit, will display 0000. Each pulse in the INPUT pin will increase the count. You can replace the switch with a LDR, reed switch or any kind of sensor.

    Use RED displays for better performance, Green displays may need 5.5 volts.

    6/16/06 Update:

    You can use this counter with one, two, three or four digits, just remove the displays that doesn't need to be used. Also, you can use transistors to increase the current for each display. Here is an example of a 2-digits counter using transistors:

    The displays are connected in parallel, each segment is connected to the same pin, that means the segment 'A' is connected to all 'A' segments, 'B' to all 'B' segments and so on.

    Please note when you use transistors for this circuit, you need to define the right display type (pin 3).


    < Forgiveness.   Home   Free Energy from the Sea.>

    Share your comments and experience:
    Keep it short, Comments with bad words, spam and non-related will be deleted.

    07/26/09 - 01:43:49 George from Greece wrote: It works fine with 16F628A.
    Just use the below config as Jose Pino said before:
    PIC CONFIG: INT RC I/O,
    Watchdog DISABLED,
    PowerUp Timer DISABLED,
    Master Clear Reset ENABLE,
    Brown Out ENABLE,
    LVP DISABLED,
    Data Read Protect OFF,
    Code Protect OFF.
    Nice job Jose. Keep going...
    07/26/09 - 01:45:01 Rob from Florida wrote: Works Great! I had to increase supply voltage to 4.1V, did not work at 3V.  Next I will add a 555 oneshot to narrow the pulse to pin 4 to shorten the "blackout" time where display turns off. Then I will run at 5V with a few resistors on the cathodes to keep the current down to 20mA on each LED. Thanks for publishing plans. Wish I had the source though, to make changes.
    Rob

    07/26/09 - 01:46:42 Bill Sherman from Hayward, Ca wrote: A question to Jose. Is it true that every time a pulse is counted, the code does a write to the data EEPROM?  If so, the life time of the pic may only be limited to 10,000 to 100,000 erase/write cycles before the memory gets "worn down" and fails to count.
    07/26/09 - 01:50:09 José Pino wrote: Unfortunately, that is correct. Each pulse is saved in the EEPROM DATA area ONLY when "SAVE COUNT"  {connecting the pin 2 to positive +) is enabled.  So, it will work without any problems when it is used for low-speed counting, like Coin Counter.  DON NOT enable SAVE COUNT for hi-speed counting like a motor.  Connecting the counter to a 5,000 RPM motor, it will have a 20 minutes lifetime.
    08/06/09 - 02:21:41 Colin from New Zealand wrote: Keep up the great works!
    08/12/09 - 23:25:45 José Pino wrote: Update:
    I just found that newer PICs (like 16F84A) have a longer "erase/write cycles life".  Microchip indicates:
    Special Microcontroller Features:
    • 10,000 erase/write cycles Enhanced FLASH Program memory typical
    • 10,000,000 typical erase/write cycles EEPROM Data memory typical

    08/28/09 - 00:45:20 mohamed from egypt wrote: pls how i can change the program to increament the counter every two pulses from switch instead of one pulse
    08/29/09 - 15:37:11 Jeme from sanaashami@yahoo.com wrote: Can we use it as frequency counter
    08/29/09 - 17:59:10 José Pino wrote: No.
    10/31/09 - 00:46:46 Pedro from Portugal wrote: Can i use two JP6281 so that i can count until 20000? And if it possible how do i do it, thks.
    10/31/09 - 00:56:20 José Pino wrote: Sorry, it is not possible.  It only counts up to 9999.
    11/10/09 - 03:10:14 Jorge Adrian from Argentina wrote: Hi, I want to connect a phototransistor for the pulse. Haw I do it?? sorry for my english.
    11/18/09 - 02:07:26 Pedro from Portugal wrote: Can we connect this to a computer software so that we can see and store the information from the counter? I would like also to count until 20000.
    11/18/09 - 03:28:52 José Pino wrote: Sorry,  it cannot be connected to a computer neither increase the counting.
    11/18/09 - 03:49:49 Pedro from Portugal wrote: I was trying to built this on proteus but it gave me errors from the hex file, any tip?

    Name:   Location:
    Captcha:   <-- This is the Captcha
    Your Comments:

  • Bookmark or Bookmark and Share Suscribe to RSS Feeds

    10 most viewed pages:

    - How To Make a Speaker
    - Hi-fidelity Homemade Loudspeaker.
    - Tachometer/RPM II.
    - Homemade WiFi Lid Antenna.
    - Super Simple Sun Tracker.
    - Led Clock
    - USB LED Light.
    - How To Repair Sony PSP
    - Knowing Everything.
    - Matrix Led Display.

    Articles related:

    - 7-Segment ASCII character Set
    - ADC without ADC.
    - Air Display.
    - Four Digit Counter
    - How To Control Multiple Leds
    - INSIDER V1.0
    - Matrix Led Display.

    All categories:

    - about
    - advertisement
    - audio
    - automobile
    - bad_ones
    - best
    - circuits
    - computer
    - discover
    - diy
    - electronics
    - fail
    - food
    - from_readers
    - funny
    - furniture
    - hacks
    - homemade
    - how_it_works
    - howto
    - humor
    - interesting
    - lego
    - light
    - microcontroller
    - mysql
    - opinion
    - php
    - projects
    - readings
    - realmeal
    - religion
    - robots
    - science
    - scripts
    - trips
    - videos
    - websites
    - woodworking


    Mr. Counter says: 1578 views.

    Search Article

    Additional Links:

    - Mary's Creations.
    - Publicidad Gráfica.
    - Todito Yucatán
    - Lucina Castillo's Art
    - Conoce Amigos en Dalnet
    - Narciso González' Alebrijes

    Need to contact me?
    e-mail address
    Please get a good reason before sending me an e-mail.

    IE, Firefox, SeaMonkey & Opera tested OK, Some features may not work with Google Chrome. © 2006 - 2009 José Pino - JPC-PHP V5.0
    If any information, data, picture or design infringes a copyright material, please send me an e-mail asking to remove it along with the supporting data.