4-digit Up/Down counter with preset, reset, hold and overflow output

Discussion in 'The Projects Forum' started by hedrasolutions, Aug 7, 2016.

  1. hedrasolutions

    Thread Starter New Member

    Aug 6, 2016
    1
    0
    Overview

    A four digit decimal counter for the PIC 16F88 with the following features:

    • Count up / down
    • Reset
    • Free running or hold on count over/underflow
    • User count preset
    • Over/underflow output
    Description

    This is a 4 digit decimal counter which can operate as a free running counter or in count and hold mode with manual reset. In either mode the counter can be preset to count to a specified value. Clock edge and leading zero suppression can also be configured.

    The 7-segment display and indicator LEDs are multiplexed. It will drive most common anode 7 segment LEDs. I used four single digit LEDs but a four digit LED module could also be used.

    In free running mode the overflow output resets on the next clock pulse. Therefore the pulse duration is directly related to the input clock frequency.

    The clock input goes to a Schmitt trigger input pin on the PIC. It will accept a 0-5V input signal only. If it's used with a mechanical switch you should use the debounce circuit shown on the schematic.

    I've had the circuit clock reliably at 200Hz and it should be able to operate without missing a clock pulse at frequencies up to 5Khz.

    Operation

    The counter can be configured for either a rising or falling clock edge and leading zero suppression. Once applied these settings are stored in NVRAM and retained across a power cycle. To enter config mode, hold down the 'set' switch at power-on.

    [​IMG]

    .
    [​IMG]

    Overflow:-
    Active when count reaches preset value

    Count Hold:-
    On - Counter in Hold mode
    Off - Counter in free running mode

    Count Up / Count Down :-
    indicates the count direction

    [​IMG]

    Up/Down: - toggle count direction
    Reset:- reset counter
    Hold:- toggle hold / free running mode
    Set / Adj:- set config / preset count value

    The counter normally runs from 0000 to 9999.
    It can be configured to count up to, or down from a preset number using the set and adjust keys.

    The preset number is used until it is manually changed. When it has been changed the preset is saved to EEPROM and will be restored at power on.

    [​IMG]





    Free running counter
    The counter runs continually. When the count reaches the preset value it automatically resets and also asserts the overflow output. The next clock pulse will cause the overflow output to clear.



    Hold Counter
    When the preset value is reached the counter stops. The overflow output is asserted and further clock inputs are ignored. To restart counting press the reset switch.

    [​IMG] [​IMG]

    for more details and download
    http://picprojects.org.uk/projects/counter/counter.htm

    if you any one try this :)
     
Loading...