CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

18f13k50 not working?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
vinniewryan



Joined: 29 Jul 2009
Posts: 154
Location: at work

View user's profile Send private message MSN Messenger

18f13k50 not working?
PostPosted: Thu Feb 24, 2011 2:01 pm     Reply with quote

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 24, 2011 2:35 pm     Reply with quote

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.
vinniewryan



Joined: 29 Jul 2009
Posts: 154
Location: at work

View user's profile Send private message MSN Messenger

PostPosted: Thu Feb 24, 2011 2:47 pm     Reply with quote

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 24, 2011 3:04 pm     Reply with quote

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
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Feb 24, 2011 3:26 pm     Reply with quote

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.
vinniewryan



Joined: 29 Jul 2009
Posts: 154
Location: at work

View user's profile Send private message MSN Messenger

PostPosted: Thu Feb 24, 2011 5:26 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group