I think that encouraging someone to do "movf 0x05, 0" is a pretty bad idea- the symbols are defined for a pretty good reason after all. -----Original Message----- From: Paul James E. To: PICLIST@MITVMA.MIT.EDU Sent: 09/02/2004 01:59 Subject: Re: [PIC:] Reading PortA on 16F877 I'm not sure what BANKSEL PORTA is supposed to do. Do a bsf STATUS, RP0 movlw 0xFF movwf TRISA bcf STATUS, RP0 This will setup PORTA as all inputs. Then to read the port, just do a movf 0x05, 0 This will move the contents of PORTA into the 'w' register. Then do with 'w' what you need to do. Regards, Jim > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > I want to read either PortA or PortE on a 16F877 chip as digital input. > > I have read the PortA, PortE, and A/D sections of 30292c.pdf > In particular, I have read p113. > On page 218, there is an example to use PortA. I have not done the > CLRF PortA shown in the example, but otherwise comply. I will try this > in the next cycle. > > I have set ADCON1 to 0x06 and verified this with read and display to > LEDs. I have set and verified TRISA to 0x3F > > I do a very simple > banksel PORTA > movf PORTA,w > banksel PORTD ;home of the LEDs. > movwf PORTD > > The LEDs are always dark. I have success with PORTC as an input. > > Thoughts? > > > - -- > Aubrey McIntosh, Ph.D. > > > -----BEGIN PGP SIGNATURE----- > Version: PGPfreeware 7.0.3 for non-commercial use > > iQA/AwUBQCe2FwKlSw8yssF7EQKtwgCeJkH1LfsMeQzKfAIbhTNbV22kqvQAn3bS > eZLvXCkZhjwOSI+CpLj8fz3n > =kizK > -----END PGP SIGNATURE----- > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body