View previous topic :: View next topic |
Author |
Message |
amate
Joined: 29 Aug 2010 Posts: 14 Location: SPAIN
|
problem with PIC18F46K80 |
Posted: Fri Jun 22, 2012 12:03 pm |
|
|
I have written this code for test this micro, and all is Ok except for C0 and C1, this don't change. Thinking that was one broken micro I have change, but happen the same.
Somebody knows the reason?
Thanks for your help.
Code: |
#include <18F46K80.h>
#fuses XT, NOWDT, PUT
#use delay (internal=8000000 )
void main(void)
{
output_A(0x00);
output_B(0x00);
output_C(0x00);
output_D(0x00);
delay_ms(5000);
while(1)
{
output_A(0xFF);
output_C(0xFF);
output_D(0xFF);
output_B(0xFF);
delay_ms(500);
output_A(0x00);
output_B(0x00);
output_C(0x00);
output_D(0x00);
delay_ms(500);
}
} |
|
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1349
|
|
Posted: Fri Jun 22, 2012 12:21 pm |
|
|
One of the first things you should ask yourself if you have a problem with only a few pins is "what is special about those pins?" If you take a look at the datasheet, you can see the pin diagram near the beginning and see all the functions associated with them. For RC0 and RC1, a common functionality is the secondary oscillator. Nine times out of 10, you need to set a fuse to turn those pins from SOSC pins to digital pins. See the bottom of page 56 of the data sheet to verify this for your particular PIC.
The next step is to figure out how CCS handles those fuses. If you use the "Valid Fuses" option from the IDE menu, you can see all the valid fuses for each chip. Select your chip and look for the ones concerning SOSC. I would guess it is something like SOSC_DIG based on other chips I have used. Add whatever fuse it is to your list. |
|
|
amate
Joined: 29 Aug 2010 Posts: 14 Location: SPAIN
|
PIC18F46k80 problem solved |
Posted: Sat Jun 23, 2012 8:46 am |
|
|
Was enough to include the fuse SOSC_DIG.
You are right, thanks a lot.
antonio mate |
|
|
|