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 support@ccsinfo.com

Pic18F can't even blink a led.

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



Joined: 27 Nov 2011
Posts: 7

View user's profile Send private message

Pic18F can't even blink a led.
PostPosted: Fri Dec 09, 2011 6:50 pm     Reply with quote

For some weird reason I cannot do anything on my PIC 18F4550.

I wrote a simple ccs c program like this:
Code:

#include <18F4550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN     
#use delay(clock=48000000)


void main()
{
   while(1) {
   output_high(PIN_B7);
   delay_ms(600);
   output_low(PIN_B7);
   delay_ms(600);
   }
}

Using 20MHz xtal, 22pF capacitors on it.
100uF cap on pin 18 grounded.
MCLR got 4k7 VCC.
100uF cap between pin 11/12 (grounded/VCC respectively).
100uF cap between pin 31/32 (ground/VCC respectively).

PicKit2 seems to write it correctly but I definitely can't get it running, someone could give me some tips?
temtronic



Joined: 01 Jul 2010
Posts: 9162
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 09, 2011 7:19 pm     Reply with quote

One possible reason....

The default setting for build configuration is 'debug' but can be changed to 'release'.

While in MPLAB...click on the 'project' pulldown list,go to the 'build configuration' option, select 'release' NOT debug.
Now recompile( 'make' or F10).

download that code into PIC and try it.

I got caught by that ,wasted a LOT of time....asked MC to change it , and they told me how ! ( v8.63 or higher).
alex



Joined: 27 Nov 2011
Posts: 7

View user's profile Send private message

PostPosted: Fri Dec 09, 2011 7:50 pm     Reply with quote

I just use CCS C and PicKit Programmer do i really need mplab?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Dec 09, 2011 8:27 pm     Reply with quote

Quote:

100uF cap between pin 11/12 (grounded/VCC respectively).
100uF cap between pin 31/32 (ground/VCC respectively).

You should be using 100 nF (not uF) ceramic caps on the Vdd pins.
The ceramic caps have high frequency ability, which is what you need
on those pins.

Quote:
100uF cap on pin 18 grounded.

That is not what the 18F4550 data sheet says to use. You are
violating the spec. See the data sheet info below:
Quote:

TABLE 28-5: USB INTERNAL VOLTAGE REGULATOR SPECIFICATIONS

CUSB External Filter Capacitor
Value (Vusb to Vss):

Minimum: 0.22 uF
Typical: 0.47 uF
Maximum: 12 uF
Ceramic or other low-ESR


Quote:

void main()
{
while(1) {
output_high(PIN_B7);
delay_ms(600);
output_low(PIN_B7);
delay_ms(600);
}
}

Pin B7 (and also pin B6) is used by the Pickit 2. Don't use it.
Choose another pin such as Pin B0.
Quote:

#include <18F4550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000)

Don't do initial testing in PLL mode. Run it in HS mode at 20 MHz.
See this example program:
http://www.ccsinfo.com/forum/viewtopic.php?t=42223&start=1
alex



Joined: 27 Nov 2011
Posts: 7

View user's profile Send private message

PostPosted: Sat Dec 10, 2011 12:08 am     Reply with quote

Problem solved, bad bad 5V power supply :P
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