Page 226 - Making PIC Microcontroller Instruments and Controllers
P. 226
TIMERO 224
!gn4!0ll*{e{]: Program to u€e the tachometer board as a metronome
(Continued\
GOSUB DISPI,AY shor walue on the 4 sewen seer displays
GOTO ![AIN do it aqain forewer
-o
DTSPLAY! d'sp_"y h- 4 n 'nrbe s
tF vtr-ltE<1000 !!HEN check value for first disit
DIGIT=1999
EITSE
DIGIT=LEDPOS/1000 + 2 0 0 ; set pattern position in table
ENDIF
RE]AD DIGIT, PORTB read the patrern fox the di€rit
PORTA=%o0000001 dispLay disit 1 from if 1000 to 9999
PAUSE P pause to 1et dispLays come oN
LEDPOS-LEDPOS//1000
IF VA!T'E<1OO THEAI check value for second d:igrit
DIGIT=1999
EIJSE
DIGIE-LEDPOS/100 2 0 0
ENDIF
RTJAD DIGIT, POREB
PORTA=%00000010 fron 100 to 999
PAUSE P
TJEDPOS-ITEDPOS//100
IF VA'U!<TO EHEN check value for third diqit
DTGII=1999
E',SE
DIGII=iEDPOS/10 +2000
ENDIF
RE.A! DIGIT, FOREB
PoRIA-%00001000
PAUSE P
/ /
LSDPOS=ITEDPOS 10
DIGIT=I.EDPOS +2OOO
READ DIGIT, PORTA
PoRTA-?o0100000
PAUSE P
REf,t'RN
DISABI.E
IlqT ROIIIINE ! in!edupt service rouLinq
increnent value of x
IrilTCON.2=0 reset/c1ear the flag
RESU![E
ENASITE
END