You should set the OSCCON register in your code. There are a lot of speed options for your chip, from 8mhz to 32khz. Looks like it defaults to 8mhz if left untouched.
You should set the OSCCON register in your code. There are a lot of speed options for your chip, from 8mhz to 32khz. Looks like it defaults to 8mhz if left untouched.
http://www.scalerobotics.com
Thanks for the input guys
As it goes (out of desperation), I tried a few permutations of OSCCON prior to posting (but wasn't too sure whether the OSCCON setting overode the define command or not)
I have to say all the config setting surrounding something as elementary as setting an oscillator up is very confusing!
So having got the fuse correct ( _INTRC_OSC_NOCLKOUT ...at least that's what's in the 16f690.inc MPSAM file)
Having got the define correct. (define osc 4 ....4Mhz)
The OSCCON still needs setting? (bear with me here - I seldom change this stuff.....if OSCCON still needs setting what's the purpose of the DEFINE command?)
I tried getting the interal oscillator presented on the associated IO pins (to see if I could scope them - failed! IS there something unique about the clock that makes it invisible? lol)
I tried a whole heap of permutations - the Hserout settings I posted were derived from Mr E's calculator.
The weird things is ...when on internal oscialltor, most of the 'format' of the text onscreen was almost there (eg tabs were in the right places, therefore forming columns as the lines wrapped ...just gobbledegook when on the internal oscillator). I'll come back to this later, but for the time being I'll stick with 20Mhz!
Incidentally, when I scope the PICs OSC pins when using an external resonator - I can't scope the signal either ....I'm starting to think this is personal & that the clock oscillator from just me!!!!! (not saying I'm paranoid - I used to play rugby but gave up becuase everytime there was a scrum, I thought they were talking about me)
Last edited by HankMcSpank; - 10th October 2010 at 16:49.
Last edited by ScaleRobotics; - 10th October 2010 at 17:43.
http://www.scalerobotics.com
Hi,
DEFINE OSC 4 doesn't do anything with the PICs registers or config "fuses". It simply tells the compiler that you are intending to run the chip at 4Mhz so it knows how to calculate the correct amount of cycles for your PAUSE 250 etc.
The internal oscillator on the '690 is fixed* at 8Mhz but the postscaler (controlled by bits 4, 5 and 6 in the OSCCON register) defaults to a divide by 2 ratio so you end up with 4Mhz as the default. So really, it should be running at 4Mhz.
* The "fixed" 8Mhz oscillator can be tuned by changing the OSCTUNE register.
When you tried to get the CLKOUT to work, did you set the pin to output? (TRISA.4 = 0)
/Henrik.
EDIT: Running at 4Mhz you should see a 1Mhz signal on the CLKOUT pin.
Great stuff Henrik - like I say, in the end I went back to 20Mhz (& all the associated pin rejigging that entails from having to put back in the an external resonator!)...I don't have the heart or inner strength to now 'rejg' my 'rejig' so to speak ......but I *will* revisit this with the advice/knowledge gained here (I'd dearly love to see some form of clock coming out of the pesky pins - if for no other reason to establish that the PIC isn't holding a grudge against me!)
A hearty thanks!
Hey Hank, when you do have the heart to re-visit this, use the int_osc clk_out fuse instead of no clk out. This should put the clock on whatever pin it says. As for rejigging pins, can you just pull your resonator to test between internal and external?
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Bookmarks