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

internal oscillator for PIC16F819

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



Joined: 11 Jul 2004
Posts: 1

View user's profile Send private message

internal oscillator for PIC16F819
PostPosted: Sun Jul 11, 2004 3:37 pm     Reply with quote

Hello,

As everybody in this forum i use the CCS compiler.
I have problems selecting the internal 4 MHz osc block.
It seems alwas to be the 31250 Hz wich is selected.
Maybe someone has an idea to help me out.

The device is an PIC16F819

Thanks in advance

Kind Regards
jds-pic



Joined: 17 Sep 2003
Posts: 205

View user's profile Send private message

Re: internal oscillator for PIC16F819
PostPosted: Thu Jul 15, 2004 9:27 am     Reply with quote

discoboy wrote:
Hello,
I have problems selecting the internal 4 MHz osc block.


please read the forum policy for the "Code Library".
this is not the place to ask questions.

the right place is here:
http://www.ccsinfo.com/forum/viewforum.php?f=1

jds-pic
valemike
Guest







PostPosted: Thu Jul 15, 2004 11:27 am     Reply with quote

He is in the right forum, unless the original post was moved.

Anyways, I had the exact same question in mind 2 weeks ago. But "PCM Programmer" (Thanks!!) had a code snippet a while back which helped me 100%. Here is the similiar code snippet:

Code:

#include <16F627A.h>
#fuses INTRC_IO,WDT,NOLVP, NOBROWNOUT
#use delay(clock=4000000)
#use fast_io(a)
#use fast_io(b)

#bit OSCF_BIT = 0x8E.3

// function to set oscillator frequency
#define set_osc_freq(value) OSCF_BIT = value

// Two possible speeds, based on the datasheet's values
// for OSCF bit, in the PCON register.
#define OSC_4_MHZ  1
#define OSC_37_KHZ 0


#byte port_a = 0x05
#byte port_b = 0x06

   
void main(void)
{   
    set_osc_freq(OSC_4_MHZ);
 
     //The rest of your code goes here.
}


Note that the #use delay(clock=4000000) must be selected if you will be running your internal oscillator at 4Mhz. Also notice the INTRC_IO in the #fuses directive.

-Mike
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