Page 107 - Making PIC Microcontroller Instruments and Controllers
P. 107
flfiEnl: THE SECO DTlllER 9Z
thal depends value 01
i:BFli.!;ll$qipi Timerl usage (Rudimentarv limer operalion on
POr-1) \Cantinued)
oN INITERRu?E Goto lErcKIM! ; tells Lhe progran where co go on
rnitiaLize display and write ro top
\MM
r,cDolr! sFE. 1. $FE, 980. SS {z ,
MAtt{looP:
aDcoNO.2 = 1 ; conwersion !o reads PoT l converslon sEarL
; now and takes place dutinq Loop If I'oop was
; shor! we would allor for !haL'
; then check lhe bultons to decide whaL !o do
IF POR!TB.4 = O TSEN STARICLOCK ;
IF PORTB.s = O TEEN STOPCI,oCK ;
IF PORTB.5 = O BEEN CI,EA'RCI'OCK ;
{hat lhe clock
i :li,:"'1"1*
LCDOuI SFE, $80, DEC2 lltNs, {3zrDEC2 SECS, \:/, DEC TENIIIS/-
{FOtlEz, DEC ADVAI" . *
; We are now teady !o read {haL polentioneter seltinll is
Al|tl! E ADRESII ; we dssmed lhat enough lime has
; passed
; to hawe an updated value in the
; r e g f s l e r s . I f n o t a d d v a i L
Gctto MAINI OOP ; do it agarn
DISABLE ; disabte interrupts durinq
, inLerupt handLer
TICKINT:
TICKS = IICKS + I ; ticks are irduenced bv Lhe settlng
; of PoT-l
tF ttrcRs < 5 TEEN fErE)<It ; arbilrary vatue Lo geL one
; second
TICKS - 0
A E N I E S = E E l t r T H S + 1
IF TETiEES <9 THEN TIEXIf ;
TENIITS = 0
s E c s = 6 E C S + 1 i u p d a t e s e c o n d s
IF SECS < 59 TIIEN TIEXII ;
SECS = 0 i
M I N S = M I N S + 1 ; u p d a t e n i n u C e s
EIEXIT: i
(ContinueA