3 Digit Up Down Counter PIC16F877A

3 Digit Up Down Counter shown here is based on PIC16F877A microcontroller. The count is shown on the 2×16 LCD display and the direction is controlled by a switch connected to bit 3 of PORTA. With minimal changes the attached assembly code can be modified to run on similar MCUs from PIC16F family. Analogous design based on Arduino platform is available here. Simple nested loop delay was used to produce 1 sec counter transitions from 20Mhz oscillator connected to pin 13 of the microcontroller. In the next figure a design schematic is shown.

3-Digit-Up-Down-Counter-PIC16F877-Schematic

The counter itself is running in continues loop from 0 to 999 in both directions. This design is more of an educational project as there is no way to enter an initial or a final counter value in current implementation. A basic keypad may be added for this purpose. In one of my other post, I’ve shown how to interface a 4×4 matrix keypad.

3-Digit-Up-Down-Counter-PIC16F877-Prototype-Board

Also, there is no external output from the counter except for LCD. Adding a solid state or a mechanical relay for example can further improve this basic design. A short video demonstrating circuit operation in presented next.