PDA

View Full Version : Calibration Word & Processor Speed



cyberroth
- 25th February 2014, 14:32
Hi,

I'm new to PICs & PicBasic Pro, but not new to microcontrollers in general. Atmel, ST9, Picaxe,8051

I was recently given a (legal) copy of PBP 2.46,.Microcode Studio, MPLAB 7.11 and and (2) ICD2 Programmers, along with a box full of PIC16F684 and 12F688 PICs. I am slowly muddling my way through the toolchain and getting fimilar with the little idiosyncracies.

After building a programming board for use with the ICD2 I got an LED to blink after a couple of hours of trial an error. Not bad. It took me 3 days with an ST9B ...:smile:.

Thanks to information posted in this forum, I was able to quickly figure out how to change/modify the configuration word bits, as I want to try using using a 20Mhz crystal instead of the internal RC oscillator, However ......

I have a question about the factory loaded "calibration word" loaded at 2009h.

How can this be changed or reloaded if, for example, it gets overwritten? I have searched and found no information on how to do this with an ICD2. To the best of my limited knowledge, the ICD2 does not have a stand alone programming app, and its "operating system" is programmed to leave this data alone.

Also, the PIC 16F684 has a default 8Mhz internal clock, yet PBP by default slows it down to 4Mhz. ...Why is this?. Does 8Mhz not work well or cause some PBP features to misbehave?

I changed the clock to 8Mhz with "DEFINE OSC 8" but see no obvious improvement in performance. How can I easily tell if the oscillator speed actually changed ? Is there a simple way to test the performance with PBP or MPLAB ?

Thanks in advance.

cyberroth

grahamg
- 25th February 2014, 15:55
The Define OSC 8 does not change the oscillator speed. I only tell the compiler the speed so that internal delays are calculated correctly. To change the internal oscillator speed the osccon register should be modified in you code. The define OSC x should then be set to match your selection as defined in the osccon register.

cyberroth
- 27th February 2014, 12:41
Thanks, I should have know that !

Amoque
- 27th February 2014, 13:19
Thanks, I should have know that !

I don't see how. I mean no disrespect and not to be argumentative, but it is a frustration to me that there is this gray area in many procedures where PBP does some of the setup and leaves other parts to be done by the user. After some time I am catching on to the pattern and learning where to look when things don't work as expected, but ... from a beginner's standpoint... I could wish the manual was more clear in some respects on this. That said, I really enjoy using PBP and the process of learning it is enjoyable to me. Between reading carefully, scratching my head, and the outstanding help in these forums it is getting easier. After not too long it seems I might actually be able to create the things I envision! I hope you find this to be the case as well... and welcome to the forums!

cyberroth
- 27th February 2014, 14:44
Not argumentative at all.

I should have know that because I have considerable experience with another PIC based BASIC system where you can peek / poke the OSCON register to change the internal RC oscillator frequency. And , I did not read the PBP manual very thoroughly before starting.

I do agree that the manual leaves a bit to be desired from a beginners standpoint. Aside from being unclear in places, I find some of the examples inadequate or irrelevant and not very "real word". But such is the case with a lot of products. Most of the effort goes into the software & marketing, while manuals / datasheets are an afterthought or a necessary inconvenience given a back seat . Good tech writing seems to be becoming a lost art.

I have found that looking at others well commented code is a really good way to learn.