1-99 Minute Timer



1-99 Minute Interval Timer

This project is a crystal accurate 1-99 minute interval timer set by rotary DIP switches and is based on the PIC16F84A. After a button is pressed it will switch on a relay for a preset number of minutes.

The PCB design is a two layer through hole PCB, it is based around a PIC16F54 running off a 32Khz crystal.

Click to enlarge
Click to enlarge

The time is set using the rotary DIP switches SW1 & SW2 which is read into PORTB via the internal pull up resistors.

Power is supplied via D2 and a standard 7805, a reset signal is triggered by R5.

The PIC after reading the  status of the rotary DIP switches monitors the Switch input on RA0, after the switch is pressed then it sets RA1 high to switch on the relay and light the indicator LED D6. This LED could also be connected to the LED in an illuminated switch. Code for the project can be downloaded Interval timer.asm



Or cut and pasted from below

;Interval Timer

LISTp=16F84A;tell assembler what chip we are using

#include <P16F84A.INC>;include the defaults for the chip

__CONFIG   _CP_OFF & _WDT_OFF & _PWRTE_ON & _LP_OSC

PCEQU H’0002′

Ticks EQU H’000C’

Seconds  EQU H’000D’

Minutes  EQU H’000E’

Count  EQU H’000F’

HNibble EQU H’0010′

DelayEQU H’0011′

TenMinutesEQU H’0012′

DipswitchEQU H’0013′

org0x0000;org sets the origin, 0x0000 for the 16F628,

;this is where the program starts running

goto start

start

Movlw b’01000111′

Option

MOVLW b’00000001′

TRIS PORTA

BCF PORTA,1

MOVLW b’11111111′

TRIS PORTB

MOVF PORTB,W

MOVWF Dipswitch

movlw b’00000000′

movwf Minutes

BTFSS PORTB,0

BSF Minutes,3

NOP

BTFSS PORTB,1

BSF Minutes,2

NOP

BTFSS PORTB,2

BSF Minutes,1

NOP

BTFSS PORTB,3

BSF Minutes,0

NOP

movlw b’00000000′

movwf TenMinutes

BTFSS PORTB,4

BSF TenMinutes,3

NOP

BTFSS PORTB,5

BSF TenMinutes,2

NOP

BTFSS PORTB,6

BSF TenMinutes,1

NOP

BTFSS PORTB,7

BSF TenMinutes,0

NOP

BTFSC PORTA,0

Goto start

Call Delay1

Call Delay1

Call Delay1

BTFSC PORTA,0

Goto start

Movlw 0xFF

SUBWF   Dipswitch,W

btfsc    STATUS,Z

Gotostart

bcf      STATUS,Z

BSFPORTA,1

movlw .60

movwf Seconds

CLRWDT ;Clear WDT and prescaler

Movlw b’01000111′

Option

Timer1

Clrf TMR0

Movlw.224;

Movwf TMR0

loop

btfsc TMR0,7

Goto loop

Decfsz Seconds,f

Goto Timer1

movlw .60;

movwf Seconds

Movf Minutes,W

Decfsz Minutes,f

Goto Timer1

Movlw .10

Movwf Minutes

Movlw 0x00

SUBWF   TenMinutes,W

btfsc    STATUS,Z

Gotostart

bcf      STATUS,Z

Decfsz TenMinutes,f

Goto Timer1

Movlw 0x00

SUBWF   TenMinutes,W

btfsc    STATUS,Z

GotoTimer1

bcf      STATUS,Z

bcf PORTA,1

goto start

Delay1

movlw .200

movwf Delay

Loop1

Decfsz Delay,f

Goto Loop1

Return

End

The bill of materials for the project is

 

QTY  PART-REFS           VALUE              

—  ———           —–              

Resistors

———

2    R1,R5               10k                

1    R6                  560                

1    R7                  120                

 

Capacitors

———-

2    C1,C2               15pF               

1    C3                  470u                

1    C4                  22u                

1    C5                  100n               

 

Integrated Circuits

——————-

1    U1                  PIC16F84A           

1    U2                  7805               

 

Transistors

———–

1    Q1                  BC108BP            

 

Diodes

——

2    D1,D2               1N4004             

1    D6                  LED                

 

Miscellaneous

————-

1    J1                  TBLOCK-I3          

1    J3                  TBLOCK-I2          

1    RL1                 GL5A-!E 5DC        

2    SW1,SW2             MCRH4AF-10R        

1    SWITCH              CONN-SIL2          

1    X1                  32Khz