D.Dorling 2001
 
 

PICTIMER

What is it? The Hardware
Circuit Operation The Software
Operation Parts List
The Files Download
 

 

PICTIMER is a project for the PIC16F84

It comprises a clock/timer using 3 double-digit 7-seg led displays giving 6 digits in all. There are 8 push-switches, 1 piezo buzzer, 2 leds and 1 logic output. As well as a 4 pin programming connection.
Setting time is much easier than a conventional electronic clock or stopwatch because there are two buttons each (INC and DEC) for hours, mins and seconds. It is written in A84  assembler.

 

 

 

The Hardware

The common-anode double-digit LED displays were salvaged from old computer cases, the Switches, 4 pin socket and LEDs from old computer monitors, the Piezo buzzer and Transistors from old computer printers, the 74138 from an old XT computer mainboard, and the Crystal from an old computer modem.

 


  Full-sized  diagram for printing at 300 dpi
 
 

Circuit operation

 
 
 

The Software

The MAIN routine initialises the TMR0 prescaler to 1:8 (225 Hz), and PORTB pullups are enabled, and the TRIS registers are setup for the ports. Various variables are set, EEPROM is read. The program then loops continuously testing the SWITCHES variable. If any switches are down then the program carries out the corresponding function and returns back to the loop.

The main loop is interrupted 225 times a second by the interrupt routine at 0004 which updates the display and tests the switches. If any switches are down the displays are turned OFF by turning LED2 ON. This prevents the corresponding segments of the all the displays from lighting because the switch completes the circuit. The interrupt routine also divides by 225 to produce a branch every 1 second which increments or decrements the time as well as decrementing the blanking timer.

The time is maintained in three 8 bit BCD registers. The upper 4 bits (MSN) are the TENS and the lower 4 bits (LSN) the UNITS. These three registers are saved in EEPROM whenever the counting is started. To display the time, these registers are separated into tens and units registers corresponding to the 6 LED displays. Four bits of these regs are used for the time, 1 bit is used to indicate a suppressed zero, and one to specify whether the decimal point is on or off. These registers are updated whenever a change occurs to the corresponding BCD time register.

Whenever the hours increment in clock mode a flag is set to signal chiming. The main loop tests this flag and calls the chime routine if set. Timing for the beeps and hour chimes is accomplished by a general-purpose timer register which is decremented 225 times a second by the interrupt routine. A delay routine simply loads this register and then waits for it to hit zero.

 

 

component overlay
  Full-sized  diagram for printing at 300 dpi
 
 

Operation

 
 
 

Parts List


             1  x  IC PIC16F84 Microprocessor
             1  x  IC 74LS138, 74HC138 etc.
             8  x  Transistors BC640, BC636, 2SA733, 2SA1015, 2SA844 ect.
             2  x  1N4148 Diodes
             3  x  Double-Digit Common Anode 7 Segment (+dp) LED Displays (see text)
             2  x  Leds
             1  x  1.8432Mhz Crystal
             1  x  Piezo Buzzer (see text)
             2  x  27pf Ceramic Capacitors
             2  x  1u Monolithic Capacitors
             8  x  100 ohm 1/4W resistors
             10 x  1k 1/4W resistors
             1  x  10k 1/4W resistor
             1  x  270 ohm 1/4W resistor
             8  x  Button Switches (see text)
             1  x  DPDT slide switch
             1  x  DIL18 IC socket
             1  x  4 pin socket
             1  x  4xAA battery holder
             4  x  AA Batteries
             1  x  PC Board 110x74mm
             
  Making PC Boards

 
 

The Files

PICOVER.GIF - The PCB overlay diagram for parts placement.
PTIMERC.GIF - Full-sized circuit diagram for printing at 300 dpi.
PICPCB.GIF - Full-sized Copper-Side PCB pattern for printing at 300 dpi.
PICTIMER.ASM- The source code in A84 format.
PICTIMER.GIF- Operational Layout diagram
PICTIMER.ZIP- All files plus the original CorrelDraw files.

copper side
 

 

Download


 
Download PICTIMER.ZIP
(201,248 bytes)
Download A84.ZIP
(37,159 bytes)
Email Author


  Electronics Stuff