Port H as input in PIC18f87j11

Status
Not open for further replies.

DatsAbk

Member level 3
Joined
Jun 22, 2012
Messages
55
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,704
Hello,
I've been trying to use PORTH as input in PIC18f87j11 but unable to use it.
I successfully used PH0-PH3 pins of port as input but unable to use the entire port. Need an urgent help on it. M ready to pay for it even if the task is done . An immediate money transfer on receiving a solution for it.

Here's my code:
Code:
void main()
{
    TRISH=0XFF;
    TRISD=0X00;
    PORTD=0X00;
    ANCON1=0XFF;
    PMCONH=0;
    ADCON0=0;
    
    CCP1CON=0;
    CCP2CON=0;
    CCP3CON=0;
            
    while(1)
    {
        PORTD=PORTH;
    }
}
 

I haven't used that device but have a read of page 151 of the manual. There is also some code on that page for initialising portH. It seems that the ANCON1 register needs some care when changing it - see note 2 under table 10-19. So, your write to ANCON1 might be ineffective. You need to set WDTCON<4> first.

Keith.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…