'ADC using 71'
Hi to all.
I was experimenting with 16c71 and I ended with problem that
I could not solve.
I am using picmaster emulator with 16k probe (16c71)
all I was doing is to check A/D and output it to 8 bit LED's.
I am using demo board 1 .
I am outputting it to portb
The problem I have is when input voltage is 0 on output led0 and led1
are still on but they are not bright. when I play with POT I see led
are running .
My question is why led0 and led1 are not working. hardware connection is
is there any error in my code?
init clrf portb
bsf status,5 ; set up page 1
movwf trisb ; B0 and B1 inputs the rest
movwf trisa ;
movwf adcon1 ; set a/d inputs on a0/1 rest
movlw b'00000001' ; set timer internal div 1/4 and
movwf optreg ; do it
bcf status,5 ; return to page 0
movlw b'11000001' ; set a/d internal rc clock and 11
movwf adcon0 ; do it
; ****************** the start ************************
bsf adcon0,2 ; start conversion
movlw 20 ; this line is 20
lp1 decfsz temp,f ; wait a while
conv btfsc adcon0,2 ; test for end of conversion
movf adres,w ; load a/d result into w
movwf on_time ; store it
comf on_time,f ; compliment to mach demo1 pot
movwf portb ; disply it
Andre: First off- you have port B0 and B1 set to inputs rather than outputs
so you should never expect them to output. Secondly, you probably have
internal pullups enabled (bit 7 RBPU* in the OPTION register) which would
explain the dimly glowing LEDs. (Note the * on RBPU*. This means the signal
is active low- so a 0 in bit 7 will *enable* pullups.)
From: Andre Abelian <compufire.com> andre
To: MITVMA.MIT.EDU < PICLISTMITVMA.MIT.EDU> PICLIST
Date: Friday, March 13, 1998 2:26 PM
Subject: ADC using 71
> movlw B'00000011'
> movwf trisb ; B0 and B1 inputs the rest
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- New search...