Forum breadcrumbs - You are here:ForumGeneral: HelpPIC16F887 PORTA problem
You need to log in to create posts and topics.

PIC16F887 PORTA problem

Hi together,

I tried to use a PIC16F887 PORTA as output. I set all needed configurations (in my opinion), such as:

FOSC in CONFIG1 as INTOSCIO (RA6/RA7 for IO),

OSCCON = 0b01110101; // OSC settings
ADCON0bits.ADON = 0; // ADC off
ADCON1 = 0x00; // Vref internal
ANSEL = 0x00; // PORTA analog off
ANSELH = 0x00; // PORTB/E analog off
CM1CON0bits.C1ON = 0; // Comperator 1 off
CM2CON0bits.C2ON = 0; // Comperator 2 off

and at last TRISA = 0x00; // PortA for output

But if I set PORTA = 0xFF, only bits 0..5 are set.

Can help anyone to find my mistake? Thank you very much!

Hi, thanks for reporting.

I'm not at my computer now, so I'm very limited, but if you share your hex file I can try to find what is happening.

Hello arachofo,

 

sorry for my late replay. I send you attached a zip file with the hex file, the C source and the sim file.

The example here is only toggling PORTA, but RA6 and RA7 doesn’t work.

Thank you very much!

 

Best regards

Uploaded files:

Thanks for the files, but seems that the hex file does not match the source code, PORTA is doing nothing.