Page 97 - Making PIC Microcontroller Instruments and Controllers
P. 97
TtMEnO 67
,:a*{!ii!niFiigi usinsIMERo (Proglam btinks rwo LEDS [D1 and Do]ailernalety and
blinks a third LED [D2] lor one second ON and one second OFF as conlrotted by the
interrupl signal)
j ' e d - ' 6 n o j \
D E F I I | E S C 4 j u s i d g a 4 M H z o s c i l l a r o r
O
OPTION F-EG=%10000101 ; page 48 of daLasheeL
pu ups o orJ! B
; bit 5=0 selects tiner node
i biL 2=L j
; biL 1=0 ] seLs Tinero prescala. ro 64
; b i t 0 = 1 ]
IiCTCON=%10100000 ; bit 7=1 Enables alL umasked intefuupts
: b r ' - E r a o . a q T i m - 0 o v - r f o w - - e - - . p
; brt 2 flag wiLl be ser on inieriupt and
; has lo be cLeared in Lhe inlerrupt
; rouLine. rt is set clear ar srar!
A L P S A A R I O R D j n i s v " . " b l e c o - . : n r l - D a u s d S o o p
V
v
r
i
BETA VAR BYTE ; this variable counLs the 61 intefupt
IRISD - %11110100 ; sets lhe 3 output pins in the D porr
PORTD = %00000000 ; sets all pins row in the D porr
aEtA=0
ON IIITERR[IPT Go:rO INTROUIIAIE ; this Line needs to be early in
; lhe progran,
in dy case, before the routine is ca11ed-
_ o o o
MATN']OOP: n e : r b i l k p D 0 d n o D . o a r o r 6 l y
I F P O R I D . I = 0 T H E N
PORID.I = 1
POR!D.o = 0
EI,SE the foreqround as described before
PORTD.I - 0
PORID.o - 1
ENDIF
_ o r
lOR tl,PEA = 1 TO 300 : l 6 s p e L . F _ s - t n ' r a - d / i . q - s
PAUSEUS 100 wlcn snort Lateocv
NEXI AI,PIIA
GCIIIO IIAII\ILOOP
DIS.ASITE DISABLE//ENABLE nus! bIKt the
interrupt routine