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
 
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 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
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…