;------------------------- READ IN ANALOGUE SIGNALS ROUTINE ------------------- ; THIS ROUTINE READS IN THE ANALOGUE VOLTAGES, Read_analouge ; ENTER WITH CHANNEL NUMBBER 0-4 IN W CLRC ; CLEAR CARRY BEFORE COMMENCING ANDLW B'00000111' ; ENSURE NO ERRORS MOVWF GP1 ; TEMP STORE RLF GP1,F RLF GP1,F RLF GP1,W ; SPIN TO PUT THE CHANELS IN THE RIGHT PLACE ADDLW B'11000001' ; SET ADCON0 TO CONVERSION TIME 0F RC 2-6us Gie_off ; disable int's MOVWF ADCON0 ; DO IT BCF PIR1,ADIF ; clear intrupt flag MOVLW .23 ; 69 us wait for channel sel to register CALL SHORT ; SETTLING DELAY FOR A/D BSF ADCON0,2 ; START THE CONVERSION btfsc ADCON0,2 ; test for finished goto $-1 ; no then retest Gie_on ; enable int's RETLW 0 ; EXIT Try this it works enter with rreqd channel in w exit with result in adres h,l -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Jinx Sent: 02 December 2002 07:54 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: Code Request - ADC on 16F877 > movf ADRESH,w > movwf PORTB > movf ADRESL,w > movwf PORTD ADRESL is in bank1 -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu