Page 69 - Making PIC Microcontroller Instruments and Controllers
P. 69
REAltltlc l POIEI{TIOMEIEB AttD DtSPL,AYlitc THE RESULTS Ot{ tHE LED BAncBApH 59
al!lf-6,i!i!ni!i6ll Displaying the potenliometer wiper posltion on lhe LCD and lhe
LED bargraph (Conttnued)
paramerers
DEFTAIE A.DC BIAS 8 set nunber of bits in result
DEFTNE A.DC CIOCR 3 set cLock source (3=rc)
DEFXNE .[.DC-S!!|PLEUS 50 set sampling tine in uS
IJOOP: ; sLart loop
lllcl![ 0, A2D VATUE ; read channel 0 to A2D_va1ue
SVAIJUE- \, ",
LCDOUT $FE, S80, HEX2 A2D VAITUE, " DEC5
A2D VATII'E
LCDOUT SFE, $COI BT!I8 A2D VAIUE
PORTD=A2D VAIJI'E ; the pause nust cone right afLer serting
; PORTD and befo.e PORTD is used again
PAUSE 250 ; try setting PORTD before the LCDOUT
Go:rO LOOP ; do iL forever
END ; end progran
E-F-'FBi 4
l:lF.ii9!!-,.!!el: The baslc circuitry for the three potentiometers" read
{The informarion
fron polenLiometerO o'1 rl-e barg.aph n Prcgrarr 5.6.)
rs d,spldyed