>From the datasheet: Note: On a Power-on Reset, these pins are configured as analog inputs and read as '0'. EXAMPLE 3-1: INITIALIZING PORTA BCF STATUS, RP0 ; BCF STATUS, RP1 ; Bank0 CLRF PORTA ; Initialize PORTA by ; clearing output ; data latches BSF STATUS, RP0 ; Select Bank 1 MOVLW 0x06 ; Configure all pins MOVWF ADCON1 ; as digital inputs MOVLW 0xCF ; Value used to ; initialize data ; direction MOVWF TRISA ; Set RA<3:0> as inputs ; RA<5:4> as outputs ; TRISA<7:6>are always ; read as =920=92. So, make sure you initialize the pins as digital pins and not inputs to the ADC (which is what they are after reset). Harold > I feel pretty silly bringing up this problem, but I've tried > everything I can think of. I can't run > the simple code snippet shown below in the MPLAB v7.50 > simulator. > > It is suppossed to set up all PORTA pins as outputs and send > 0x0f to the port. But after running this in MPSIM, PORTA > contains 0x00 rather than 0x0f. > > I have checked that the processor include file is there, it > defines PORTA correctly, and it is being used. A Watch window > correctly shows PORTA at it's 0x05 address. MPSIM is set for > the correct CPU, and specifiying a radix parameter has no > effect. > > I tried creating a brand new project and source code files, but > the result was the same. > > Have I run into a bug or did I miss something that is or should > have been glaringly obvious? Interestingly, it works if I > change PORTA/TRISA to PORTD/TRISD. > > Thanks in Advance, > Andrew > > > > processor 16f877a ; list directive to define processor > #include P16F877A.INC ; processor specific variable definitions > > __CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _HS_OSC & > _LVP_OFF & _DEBUG_OFF & _CPD_OFF > > > ORG 0x000 ; processor reset vector > bsf STATUS, RP0 > clrf TRISA ^ 0x80 > bcf STATUS, RP0 > movlw 0x0f > movwf PORTA > goto $ > > ________________________________________________ > Get your own "800" number > Voicemail, fax, email, and a lot more > http://www.ureach.com/reg/tag > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- = FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist