PIC16F883 internal oscillator - Page 1
Forum section: electronics / general

author: davorin
author_rank: Unknown
timestamp: October 18, 2014, 07:38:08 am
content: Trying now almost a whole day to get the internal oscillator of the PIC16F883 working correctly...Regardless of the _CONFIG1 settings and OSCCON programming, the CLKOUT is always 32kHz/4....Did I miss something during initialisation?Code:__CONFIG _CONFIG1, _INTOSC & _WDT_OFF & _LVP_OFForg 0; start code at 0Start:BANKSEL OSCCONBSF OSCCON,IRCF2BSF OSCCON,IRCF1BSF OSCCON,IRCF0BSF OSCCON,SCSMOVWF OSCCON......

author: David_AVD
author_rank: Super Contributor
timestamp: October 18, 2014, 07:49:02 am
content: Why are you settings some bits in OSCCON then moving W (some unknown value) into OSCCON overwriting it?

author: davorin
author_rank: Unknown
timestamp: October 18, 2014, 08:35:47 am
content: Jesus...I must be still really tired this morning ;-)The MOVWF is some leftover when I set the value with an advance MOVLW statement....but didn't succeed yesterday...Maybe also to do that the PIC16F883 requires indeed the PGM pin been tied low during programming via a resistor....Now to the next problem why I can't display anything on the HDSP-2111 module...same code which works on PIC18F4550 (besides different ports)..* davorin grabs some more coffee (o;

author: David_AVD
author_rank: Super Contributor
timestamp: October 18, 2014, 08:45:00 am
content: Port related issues are often the result of not disabling a peripheral (A2D, comparator, etc) that shares the port and has a higher priority.

author: mikerj
author_rank: Super Contributor
timestamp: October 18, 2014, 10:43:07 am
content: Quote from: David_AVD on October 18, 2014, 08:45:00 amAlso the 14 bit core devices are prone to read-modify-write issues if you perform bitwise operations on the ports, which isn't a problem on the 18F devices if you use the LATx registers.

author: davorin
author_rank: Unknown
timestamp: October 18, 2014, 01:08:34 pm
content: Ports are all working normally (o;But what I see is a high jitter on the CLKOUT pin....internal clock set to 4MHz....so output is 1MHzAnyone can explain why the internal oscillator drifts off badly and comes back to 1MHz?Nothing done in the code...just OSCCON/PORT initialisation and then an endless loop doing nothing...Power supply is fine...HP 6632B...and no noise on the VCC rail....

author: dannyf
author_rank: Super Contributor
timestamp: October 18, 2014, 01:28:48 pm
content: QuoteNature of the beast that is a relaxation oscillator.It is also why it is very useful for generating random numbers.

author: davorin
author_rank: Unknown
timestamp: October 18, 2014, 01:31:27 pm
content: Adding more capacitors helped a little.....but still see jitter on CLKOUT....Interestingly setting voltage down to 4V stops it completely....Hmm..when I remove the HDSP-2111 LED display....clock is rock solid....

author: David_AVD
author_rank: Super Contributor
timestamp: October 19, 2014, 12:43:52 am
content: Sounds like insufficient decoupling on the PIC Vdd pin(s). They need to be nice and close to the chip.

author: dannyf
author_rank: Super Contributor
timestamp: October 19, 2014, 01:11:26 pm
content: QuoteI guess what's "rock solid" is relative: rc oscillators are known to exhibit large phase noise, which makes them quite useful in some applications.

author: davorin
author_rank: Unknown
timestamp: October 19, 2014, 01:32:58 pm
content: It's not the RC oscillator...when you choose a frequency above 32kHz, the quartz is used instead...And yes...decoupling is an issue here, especially with the HDSP-2111 current peaks...but not easy to handle on a breadboard (o;At least the DCF77 code from a 16F628 runs nicely now.....just needed to compare the UTC messages with a DCF77 reference ;-)