Jump to content

Recommended Posts

Hello Guys,

 

Am using the Below C Program for My Project . This basically blinks the LED. I want to configure the PIC to Use the internal osscilator as the Clock source. I had gone through lots of site and Documents but couldn’t find / couldn’t understand it.Please let me know how to proceed. Am using the SourceBoost c as the Complier and MPLAB ICD2 for Programming.After I compile and program the PIC .. I coudnt see the PIC Working ...Please help me in this Regard.Attached my Circuit for your reference.

 

#include <system.h>

#pragma CLOCK_FREQ 4800000

void main()

{

int i;

clear_bit(trisb,0); // Set RB0 to output

while(1)

{

portb=1;

 

for(i=0; i<4; i++)

delay_s(1);

portb=0;

 

for(i=0; i<4; i++)

delay_s(1);

}

}

 

 

<Senthil/>

 

Thanks & Reards

<Senthil/>

post-4132-1206896764_thumb.jpg

Link to post
Share on other sites
...Am using the Below C Program for My Project . This basically blinks the LED. I want to configure the PIC to Use the internal osscilator as the Clock source. I had gone through lots of site and Documents but couldn’t find / couldn’t understand it.Please let me know how to proceed...

 

Code that you posted does not set fuses. Do you set them separatly? If not you'd better take a look at #pragma DATA.

 

Regards,

Pavel

Link to post
Share on other sites
...Am using the Below C Program for My Project . This basically blinks the LED. I want to configure the PIC to Use the internal osscilator as the Clock source. I had gone through lots of site and Documents but couldn’t find / couldn’t understand it.Please let me know how to proceed...

 

Code that you posted does not set fuses. Do you set them separatly? If not you'd better take a look at #pragma DATA.

 

Regards,

Pavel

 

HI Pavel,

 

Thanks for the Quick Reply..AM Unsure what fuew to set for the nternal Oscillator ? Can you help me in this Regard ?

 

Thanks & Regards

<Senthil/>

Link to post
Share on other sites
Thanks for the Quick Reply..AM Unsure what fuew to set for the nternal Oscillator ? Can you help me in this Regard ?

 

You need to check datasheet of the PIC you use and pick fuse settings that match your circuit. I'd also check settings used in samples that are included into SourceBoost installation.

 

Regards,

Pavel

Link to post
Share on other sites
...AM Unsure what fuse to set for the internal Oscillator ?

Can you help me in this Regard ?

I would like to help but there are some choices that only you can make.

 

Depending on what you choose the fuse setting will become obvious.

 

The PIC18F2550 has support to expose a USB endpoint.

 

If you are developing a USB device you cannot use the internal oscillator as a clock source for the USB function block. You must use an external crystal or oscillator.

 

If you are not using the USB and do not want an external crystal then the internal oscillator is your only clock choice. The maximum frequency available with the internal oscillator is 8MHz.

 

So now you need to decide what you need the PIC18F2550 to do for you.

 

Will you need USB?

How quickly does the PIC need to respond to inputs?

How fast does the output need to be?

 

When you have made these choices, plus a whole bunch more you will have an good idea of what way the configuration need to be set.

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...