Steve Smith wrote: > The data book on this subject has led me to confuse myself (again). > The point is as follows. configuration of the A-D is as follows > ADCON1 equ b'00000100' this implies that RA0 and RA1 are analouge > inputs and Vref is Vdd problem comes here RA3 is also analouge > input. > > RA3 is required as digital output and its Tris flag is set to 0 > therefore a digital output can be sent refering to THE BOOK fig 5-1 > the hardware implies that a digital input is not possable during a > A-D conversion no problem, but a digital output seems possable and > after trying this it appears to work. However the port info changes > on the basis of read modify write surely at this point the data on > the digital input is unstable due to being analouge will this cause > a problem with code or can the RA3 be leagaly used as digital output > when ADCON1 is set as above ? Can sombody clarify this dilema Steve: If a port pin is configured as an analog input by ADCON1 and as a digital output by TRISA, read-modify-write instructions will read it as a "0". This may cause a problem with your code, but it won't be due to any "unstable" data on the digital input; instead, any problems it causes will be of the usual read-modify-write variety. For instance: BSF PORTA,1 ;After this instruction executes, RA1 goes high. BSF PORTA,2 ;After this instruction executes, RA2 goes ;high, but RA1 GOES LOW, since the PIC reads ;"0" for all pins configured as analog inputs. One way to overcome this problem is to use a "shadow" register: SHADOW EQU [any register] .... CLRF PORTA ;Make sure that SHADOW and PORTA are in sync. CLRF SHADOW ; .... BSF SHADOW,1 ;After these instructions are executed, MOVF SHADOW,W ;RA1 will go high. MOVWF PORTA ; BSF SHADOW,2 ;After these instructions are executed, MOVF SHADOW,W ;RA2 will go high without affecting RA1. MOVWF PORTA ; -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === http://www.geocities.com/SiliconValley/2499