Try ; ; ------------------------------ ; SET ANALOG INPUTS = DIGITAL IO ; ------------------------------ ; movlw b'00001110' movwf ADCON1 James De Leon wrote: > > I am having difficulty writing bits to PORTA on a PIC16F877. For some > reason, even after setting the TRISA bits low (output) I cannot write to > PORTA <3:0>. I can, however, write to PORTA<5:4>. I am fully aware of > bank switching and I don't have any problems with writing bits to > PORTB<7:0> or to PORTD<7:0> > > Here is a simple program I wrote to initialize PORTA and PORTB as > output: > > __CONFIG _PWRTE_ON & _XT_OSC & _WDT_OFF > clrf STATUS > clrf PORTA > clrf PORTB > bsf STATUS, RP0 > movlw b'00000000' > movwf TRISA > movwf TRISB > bcf STATUS, RP0 > movlw b'11111111' > movwf PORTA > movwf PORTB > end > > In this code, a write of the bitfield '11111111' to PORTB does just > that. After the code is executed, I expect PORTA to be '00111111' (Bits > 7 and 6 are unimplemented) but it just stays at '00000000'. Has anyone > encountered the same problem? Is there something I am doing wrong? > This has been very frustrating for me. Any help or suggestions would be > wonderful. > > By the way, I simulated this with MPLAB 5.70.00 > > Thank you, > James > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- Best regards Tony mICros http://www.bubblesoftonline.com mailto:sales@bubblesoftonline.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads