> -----Original Message----- > From: Olin Lathrop [SMTP:olin_piclist@EMBEDINC.COM] > Sent: Thursday, February 28, 2002 12:34 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Experimenting with F872 -- can't read from PORTA > ??? > > >> > movlw B'00111111' > movwf TRISA ; Port A is all inputs > movlw B'00000110' > movwf ADCON1 ; Port A is all digital > movlw B'00000000' > movwf ADCON0 ; Turn off A/D > tris PORTB ; Port B is all outputs > tris PORTC ; Port C is all outputs > > loop: > movf PORTA,0 ; Grab data at port A > movwf PORTB ; Dump to port B > goto loop > > end > << > > For one thing, you've totally ignored bank settings. You do need to pay > attention to these. Check out my DBANKIF and related macros if you want a > more automatic way of setting the banks. You can find them in > STD.INS.ASPIC > at http://www.embedinc.com/pic. > > Secondly, don't use the TRIS instruction. I'm surprised the assembler > didn't give you a warning. This is an old instruction that is (has) being > obsoleted. Note that it's not in the list of instructions on page 136 of > DS30292C. > > It looks like you may have programmed some old chips a long time ago. > It's > time to sit down and read the manual again for the chip you are using now. > Is there even one mid-range device that dosen't support the TRIS instruction on ports A,B and C? Mike -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.