Hi again, there is a missunderstanding here. I'm NOT trying to read the analog port. I want to read the digital port. I mean RF0..RF7. I think you don't understand me, but may be i didn't understand you, if so please sorry. Mauricio Jancic -----Mensaje original----- De: Quitt, Walter [SMTP:wquitt@MICROJOIN.COM] Enviado el: Lunes, 13 de Diciembre de 1999 03:20 p.m. Para: PICLIST@MITVMA.MIT.EDU Asunto: Re: PIC17Cxxx Urgent HELP!! The code reads AN0. You need to change it to read ANx (where x is the analog port number) It does it in NON real time. It is straight code. Just execute it to read your analog port. I STRONGLY suggest you read the data sheet (book) for the 756. There are MANY places to make mistakes. The referenced code to several days to work out. I don't remeber how it all works all the time. Review the code and check it against the referenced sections it the data sheet. Good Luck, Walt.... -----Original Message----- From: Mauricio Jancic [mailto:mrjancic@SION.COM] Sent: Monday, December 13, 1999 9:58 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: PIC17Cxxx Urgent HELP!! Thanks Walter, but I think I don't explain myself very good. What I'm trying to do is simply to read the PORTF contents. I have tryied to do the basic thing I can do: I put all the port as input, read it and print it on the LCD. Please if you can help me on this I'll apreciate it. For a more detail explanation read again my message and try to undestand it, cause english is no my first language as you can see... Thanks again, Mauricio Jancic -----Mensaje original----- De: Quitt, Walter [SMTP:wquitt@MICROJOIN.COM] Enviado el: Lunes, 13 de Diciembre de 1999 02:31 p.m. Para: PICLIST@MITVMA.MIT.EDU Asunto: Re: PIC17Cxxx Urgent HELP!! Here is a code snipet of how I have done it: ;*************************************************************** ;* Read_Configuration ;* ;* Reads the configuration voltage to determine the number ;* of FETs or FET boards to determine system power level. ;* This uses Port G RG3:AN0 as an analog channel ;* ;* It also messes with other ports so must be done early ;* in/during init (pg 178) ;* ;* GLOBAL Interrupts MUST be OFF! ;* Since this is only called at init we can use software ;* loop timeouts for waiting for ADC conversions. ;* ;*************************************************************** Read_Configuration ; ** First assume NO Configuration Fault ******************** movlr STATES movlw FALSE movwf CONFIG_FAULT_STATE ; ** SETUP for ADC conversions ****************************** movlb 5 ;Bank 5 is ADCON bank ; ** pg179 1. Config anlaog pins/ V ref, and digital I/O ** movlw B'10101100' ;64T Clock select, output right justified, ; AN9,8,1,0 are inputs, A/D ref is AVdd and AVss movfp WREG,ADCON1 ; ; ** pg179 1. Select A/D input channel ** movlw B'00000001' ;AN0,NO Conversion running, Converter is ON movfp WREG,ADCON0 ; NOTE: AN0 is Port G bit 3 ; ** pg 179 3. Wait the required acquisition time ** ; Recall 1 instruction is 4Q cycles = 4*1/28MHZ = 4*35ns = 140ns ; So 255 * 140ns is 35,700ns = 35us which is good enough ; for a Tacq as shown on pg181 movlr 0 movlw H'FF' movwf TEMP_0 Read_Configuration_Wait_loop decfsz WREG,F goto Read_Configuration_Wait_loop ; ** pg179 4. Start Conversion ** bsf ADCON0,GO ; ** pg179 5. Wait for A/D conversion to complete by polling GO/DONE ** Read_Configuration_Wait btfsc ADCON0,GO goto Read_Configuration_Wait ; ** pg179 6. Read A/D result out of ADRESH and ADRESL in Bank 5 ** -----Original Message----- From: Mauricio Jancic [mailto:mrjancic@SION.COM] Sent: Monday, December 13, 1999 7:21 AM To: PICLIST@MITVMA.MIT.EDU Subject: PIC17Cxxx Urgent HELP!! Hi all, here I'm again having problems. This time I'm using a PIC17C756. All I want to do is to read the portf. I've set this port as analog inputs and configure the corresponding pins as inputs or otputs, like this: movlb 5 movlw 0x0E movpf WREG, ADCON1 clrf PORTF, f movlw 0xF3 movwf DDRF Then, I just go to this routine, wich reads the port data and send it to a routine that print it on a LCD display Important: I clear pins 2 and 3 because i conected on this port a matrix keyboard, so when I press a key it "sends" the '0' present at one pin to another pin of the PIC. All pins have a 10k pull-up. I also try putting pins 0 and 1 to Vcc (by hard) but it didn't change the value read by the pic. Main movlb 5 ; Bank 5 clrwdt bcf Teclado, 2 ; bcf Teclado, 3 tel movfp PORTF, WREG ; Read PORTF andlw 0xF3 ; Mask to evitate unwanted data from unused pins (4 and 5) call lcd_wrtlcd ; print data to lcd movlb 5 clrwdt call delay ;wait call delay call delay call delay movlb 0 ; Send lcd cursor to home movlw 2 movwf DISPLAY movlb 1 bcf LCDCTRL,RS call lcd_pulsoE call delay goto tel ; go back and read PORTF again Thank!! Mauricio Jancic