Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MiKRO c : problem with Internal osc.

Status
Not open for further replies.

georgetwo

Member
Greetings !
I have been using mikro c for some weeks and havent used internal osc. I am having a problem with the configuration and using the datasheet is confusing. I need help configuring my PIC16F887A and pls make reference to the data so that I dont ask again
Thanks!
 
Here is an example (16F818) for 8 Mhz.

C:
void main() {
     /* Set the internal clock to 8 Mhz */

     OSCCON = 0x70;
     /* x110xxxx = 4 Mhz */
     /* x111xxxx = 8 Mhz*/
     
    // Rest of Code goes Here
}

To answer your question the PIC16F887 datasheet [Didn't find A] has INT I/O or INT Clock out. I would use Internal I/O unless you need the clock out frequency/4. The datasheet talks about internal osc on page in the overview on the right side of the page. On page 62, it talks about the OSCCON register and has bits 6-4 binary '111' so, the 0x70 above should work as long as you have the configuration word set to internal osc.

If you need more, let me know.
 
Last edited by a moderator:
thanks
OSCCON =0 X 70;
did not compile in mikro c.
as for my configuration,
I took oscilator as HS, Power up timer: oFF, Wdt: off clock : 8Mhz ... but It didnt work without cristal.
I also tried oscilator : XT which worked realy slow without crystal...
Im a bit comfused
 
That's 0x70 with no spaces. Configuration should be set to internal oscillator IO. See the attached picture and files. The below MikroC file compiled just fine, so I assume you were using spaces as you typed above. If you still have problems, I'll get back to you in about 10-12 hours, as I need to lay down and get some sleep.

Ralph
 

Attachments

  • MikroC 16F887 Configuration.JPG
    MikroC 16F887 Configuration.JPG
    100 KB · Views: 659
  • 16F887_TEST.c
    98 bytes · Views: 405
Last edited:
SIr,
I got what you are saying,
it seems that pic16f877a does not have such options on it
which i think means that it does not have internal oscillator;
the only option I can see there are RC, Hs, Lf, and Tx,
thaks for your time, and if there is anything i need know about this pic, pls I am still watching this thread

thanks
 
George, I think you need to clarify.

In your OP you mentioned 16F887 which does have an internal oscillator.

In your last post you mentioned 16F877 which doesn't have an internal oscillator.
 
I think he is saying that the PIC16F887A does not have an internal oscillator.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top