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.

16f777 Oscillator config Question

Status
Not open for further replies.

bryan1

Well-Known Member
Hiya Guy's,
I'm working on a project using a 16f777 pic mainly as it has 3 pwn modules and last night I noticed on the datasheet it also has an internal programmable oscillator upto 8 mhz. Now for the question I'm using mplab 7.10 which gives me the window to set the config bits in which I set the osc to INTRC as Port I/O. But on reading the datasheet I need to set the OSCCON register to 01101110 to set it to 4 mhz. Now this is where I'm confused :shock: do I set the OSCCON register at the start of the program or in the header file. As this is a new chip I haven't found any code on the net using this pic to use as a guide. If anyone can help out on this sticky point I have I'll be greatfull.

Cheers Bryan :D
 
Because OSCCON is a part of RAM space and INTOSC is run-time configurable you have to set it in code (startup routine), something like:
Code:
	MOVLW	b'01110000'
	MOVWF	OSCCON,a
will work (this code is for 18F2620)
 
Thanks for that Jay :D I was just looking on the microchip forum and some bloke had the same problem with a 16f88. So it looks like the 16f777 would be the same so that will avoid one problem when I decide to use my 16f88's. I'll check where the OSCCON register is in the memory so I won't have a bank switching problem if it aint one page 1.

Cheers Bryan :D
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top