Hello: =20 I had downloaded a Sing Channel A/D source code from www.michip.com .=20 I made a changed to the List P=3D16c72 to P=3D16C765. =20 my question is how do I interpret the result? if I put a 2VDC into = Pin2(RA0) should I get some reading from PortB? =20 Thanks in Advance =20 Rith =20 ;TITLE "Single channel A/D (SAD)" ;This program is a simple implementation of the PIC16C71's ;A/D. 1 Channel is selected (CH0). ;The A/D is configured as follows: ; Vref =3D +5V internal. ; A/D Osc. =3D internal RC ; A/D Channel =3D CH0 ;Hardware for this program is the PICDEMO board. ; ; ; Program: SAD.ASM=20 ; Revision Date: =20 ; 1-14-97 Compatibility with MPASMWIN 1.40 ; ; LIST P=3D16C765 ERRORLEVEL -302 ; include "p16c71.inc" ; TEMP EQU 10h adif equ 1 adgo equ 2 ; ORG 0x00 ; ; goto start ; org 0x04 goto service_int ;interrupt vector ; ; org 0x10 start movlw B'00000000' ;set port b as movwf PORTB ;all outputs ; tris PORTB ; / BSF STATUS, RP0 ; Bank1 MOVWF TRISB ; PortB as outputs BCF STATUS, RP0 ; Bank0 ; call InitializeAD =20 update =20 movf ADRES,W ;get a/d value movwf PORTB ;output to port b call SetupDelay ;setup time >=3D 10uS. bcf ADCON0,adif ;clear int flag bsf ADCON0,adgo ;start new conversion loop btfsc ADCON0,adif ;a/d done? goto update ;yes then update new value. goto loop ;no then keep checking ; ;no interrupts are enabled, so if the program ever reaches here, ;it should be returned with the global interrupts disabled. service_int return ;do not enable global. ; ; ; ;InitializeAD, initializes and sets up the A/D hardware. ;Select ch0 to ch3 as analog inputs, fosc/2 and read ch3. ; InitializeAD bsf STATUS,5 ;select pg1 movlw B'00000000' ;select ch0-ch3... movwf ADCON1 ;as analog inputs bcf STATUS,5 ;select pg0 movlw B'11000001' ;select:RC,ch0.. movwf ADCON0 ;turn on A/D. clrf ADRES ;clr result reg. return ; ;This routine is a software delay of 10uS for the a/d setup. ;At 4Mhz clock, the loop takes 3uS, so initialize TEMp with ;a value of 3 to give 9uS, plus the move etc should result in ;a total time of > 10uS. SetupDelay movlw .3 movwf TEMP SD decfsz TEMP, F goto SD return -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body