PDA

View Full Version : 16F688 Internal clock and MCLR



manxman
- 18th August 2007, 13:05
Using tips from this forum my 16F188 program starts with the following code:

CMCON0=%0000111 'Comparators off. (NOTE: CMCON=7 does not work!)
OSCCON.3=1 'Use internal clock. NOTE: PIC defaults to this, even if not specified!

The device is then programmed with the oscillator configured as INTOSCIO and the MCLR pin function as RESET.

Now 2 questions: First, how do I ensure that the internal clock is 8MHz and not 32KHz? Second, is the usual MCLR pullup resistor still needed, since the datasheet indicates that the 16F688 has an internal one? My circuit starts and runs OK with or without one.

mackrackit
- 18th August 2007, 16:14
At the beginning of the program.


DEFINE OSC 8


If MCLR is set for External the usual RC applies.
If MCLR is set for Internal then the pin becomes an input.

manxman
- 18th August 2007, 17:47
Thanks for the speedy reply. I'll set the clock as you suggest.

With the MeLABS programmer the options are MCLR Pin Function = Reset or =Input Pin. Do you mean that the programmer should be configured with this pin as an Input Pin to make the internal MCLR pull up active? To minimise components I want to avoid having to use an external 4.7K resistor. Sorry not be be entirely clear!

dhouston
- 18th August 2007, 18:18
The 16F688 datasheet says it defaults to 4MHz after reset so you need to set OSCCON for 8MHz. You also need to wait until the oscillator is stable. See the OSCCON section of the datasheet for details.

mackrackit
- 18th August 2007, 18:38
With the MeLABS programmer the options are MCLR Pin Function = Reset or =Input Pin. Do you mean that the programmer should be configured with this pin as an Input Pin to make the internal MCLR pull up active? To minimise components I want to avoid having to use an external 4.7K resistor. Sorry not be be entirely clear!
Sorry, I can not help with that one as I do not use a MeLABS programmers.