View previous topic :: View next topic |
Author |
Message |
vinniewryan
Joined: 29 Jul 2009 Posts: 154 Location: at work
|
18f13k50 not working? |
Posted: Thu Feb 24, 2011 2:01 pm |
|
|
Hello,
I'm having a problem getting my 18F13K50 to function. I power the chip and nothing happens. No activity on pin_a1, and I don't have a scope fast enough to check the xtal. Does my config look okay?
Code: |
#include <18F13K50.h>
#FUSES HS //48 MHz Crystal w/10pf caps
#FUSES NOBROWNOUT
#FUSES NOCPB
#FUSES NOCPD
#FUSES NOEBTR
#FUSES NOEBTRB
#FUSES NOLVP
#FUSES NOMCLR
#FUSES NOPROTECT_0
#FUSES NOPROTECT_1
#FUSES NOPUT
#FUSES NOWDT
#FUSES NOWRT0
#FUSES NOWRT1
#FUSES NOWRTB
#FUSES NOWRTD
#FUSES NOWRTC
#FUSES NOXINST
#use delay(clock=48000000)
#use RS232(BAUD=19200,INVERT,FORCE_SW,XMIT=pin_a0)
void main()
{
while(1)
{
output_high(pin_a1); //LED
delay_ms(500);
output_low(pin_a1); //LED
delay_ms(500);
}
}
|
EDIT:
I've also tried using the internal INTRC with a 4000000 clock, and still the chip is not running the code.
I'm using the ICD-U64, CCS LOAD V4.028, firmware V2.88, and the newest compiler. (just bought the upgrade this week)
In CCS LOAD, I get no errors when: programming the chip; testing the chip; verifying chip=hex file. However, when I click 'run target program', still nothing happens. No activity on pin_a1 or any other pin I try. _________________ Vinnie Ryan |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 24, 2011 2:35 pm |
|
|
Look in this section of the 18F13K50 data sheet:
Quote: |
TABLE 27-1: CLOCK OSCILLATOR TIMING REQUIREMENTS
|
http://ww1.microchip.com/downloads/en/DeviceDoc/41350E.pdf
It shows the maximum crystal frequency for HS mode is 20 MHz.
To get 48 MHz, you have to use an external 48 MHz oscillator with
the EC fuse. Or, use a 12 MHz crystal with HS and PLLEN and CPUDIV1
to get a 48 MHz Fosc.
So you need to get rid of the 48 MHz crystal. |
|
![](templates/subSilver/images/spacer.gif) |
vinniewryan
Joined: 29 Jul 2009 Posts: 154 Location: at work
|
|
Posted: Thu Feb 24, 2011 2:47 pm |
|
|
Thanks for pointing that out!
Any idea why using "#FUSES INTRC" with "#use delay(clock=4000000)" also won't work? I tried with "setup_oscillator(OSC_4MHZ);" also. _________________ Vinnie Ryan |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 24, 2011 3:04 pm |
|
|
Quote: | #include <18F13K50.h>
while(1)
{
output_high(pin_a1); //LED
delay_ms(500);
output_low(pin_a1); //LED
delay_ms(500);
} |
Look in this section of the PIC data sheet. Look at what type of pins
RA0 and RA1 are allowed to be:
Quote: |
TABLE 1-2: PIC18F/LF1XK50 PINOUT I/O DESCRIPTIONS
|
http://ww1.microchip.com/downloads/en/DeviceDoc/41350E.pdf |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Feb 24, 2011 3:26 pm |
|
|
You are trying to set a LED at PIN_A1, which is input only with PIC18F13K50. So it's unlikely, that you see the processor run.
O.K., I see, this has been already clarified. |
|
![](templates/subSilver/images/spacer.gif) |
vinniewryan
Joined: 29 Jul 2009 Posts: 154 Location: at work
|
|
Posted: Thu Feb 24, 2011 5:26 pm |
|
|
Thank you again, this is embarassing. I've been very rushed in this project and overlooked all of that. I ordered a 64mhz oscillator, I'll change pins for the LED. I was previously using the 16f677 and the pin config looked similar to this chip so I tried to save time by assuming it was. I'll never make that mistake again.
Thanks for all the help! _________________ Vinnie Ryan |
|
![](templates/subSilver/images/spacer.gif) |
|