Problem in PORTE register of PIC

Status
Not open for further replies.

Hesam Kamalan

New Member
Hi,
I have a problem with PORTE of PIC16F877A. In MPLAB i write following code:
ORG 0X00
BANK1
MOVLW 0X00
MOVWF TRISE
BANK0
MAIN:
MOVLW 0X07
MOVWF PORTE
MOVLW 0X00
MOVWF PORTE

GOTO MAIN

END

After simulation, PORTE register have not affect and it is 0 for all times. But if I change E (PORTE) with B (PORTB), simulation becomes correct. For macro of banks, I write this code:
BANK0 MACRO
BCF STATUS, RP0 ; Select memory bank 0
ENDM

BANK1 MACRO
BSF STATUS, RP0 ; Select memory bank 1
ENDM

If you find my problem, tell me please.
 
You're not configuring the pins as digital, by default they are set to be analogue inputs - you need to change them! - read the datasheet!.
 
Have you disabled the default analog function on those pins (RE0/AN5, RE1/AN6, and RE2/AN7) in ADCON1 SFR?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…