![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Experienced Member
|
This is my problem! I’m using PIC12F675.
When I use external RC the code works nicely (4.7K & 22pF). But when I use internal RC the code works very speedily. I don’t know what is “band gap”. I just placed a value in the last location retlw 20h & called that in the beginning & move it to OSCCAL. What value to move to last location? Is that the problem to work speedily? |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
Hi thanks for that.
But its the way I'm loading the value.I couldn't solve my problem yet. By the way I still don't know whats the meaning of bandgap value. |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
You're confusing the Oscillator calibration word with the band gap.
The band gap is used to set the reference voltage used by the Brown-out-detect and Power-on-reset circuits. It is held in the configuration word as two bits and needs to be read out before you erase the device. See 12F675 datasheet page 52 The oscillator calibration word is held at the top of program memory and again needs to be read out before the device is erased or you lose it. You can recalibrate the oscillator using a PICKit2 with S/W 2.50. If you haven't got a PICKit2 I designed this little project some time ago that will work out the calibration word PIC 12F629 / 12F675 internal oscillator recalibration utility By the way Bill, the link to saving the calibration word by writing on the pins comes from my site Saving the oscillator calibration setting for PIC 12F629 & 12F675 |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
Hi Pete thanks for clearing that two things "band gap" & "oscillator calibration word "
But if I buy a brand new PIC I dont need to change the oscillator calibration word.I need to call in first part in my program. Then will it work exactly 4MHz? |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
Changing oscillator calibration word will cause my program to work speedily?
|
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
It will run at 4Mhz +/- 1% if you run it at the same temperatue and voltage that it was calibrated at. I seem to recall reading somewhere that Microchip calibrate at 3.5volts / 25degC See Figure 13-15 and 13-16 on page 112 of the 12F675 datasheet for a graphs of frequency variation vs supply voltage and temperature. To set the OSCCAL register just use the code below and off you go. Code:
bsf STATUS, RP0 ;Bank 1 call 3FFh ;Get the cal value movwf OSCCAL ;Calibrate bcf STATUS, RP0 ;Bank 0 |
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
Ya thats how I call but I'm still struggling what is this "oscillator calibration word "?
I know factory comes with a value.When I read a brand new PIC it shows 3440H (retlw 40h). I mean whats the relationship between this value & the operating frequency? This is the place I need to know. |
|
|
|
|
|
(permalink) | |
|
Super Moderator
|
Quote:
Your programming software should automatically read, save, and restore the value during programming or erasing. |
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
I see now.Then of course changing this value will vary the frequency a lot.
I think that will be one problem to speed up the output than I expect. Better checkout the CLKOUT frequency with a frequency meter & tuned the OSCCAL value. |
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
The register uses the 6 high order bits to adjust the oscillator frequency with 111111xx being highest frequency it can adjust to and 000000xx the lowest. 100000xx is the centre of adjustment but not neccesarily the point at which the oscillator will run at 4Mhz. There is no specifc relationship between the value and the frequency - you can't say an increment of 1 will increase the freqency by 15Hz if that's what you mean. Even if you find some relationship between the OSCCAL values and clock frequency for a particular device it may not hold for devices from another batch. |
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
geko your projects are always well written & very cool.
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| cd4541 timer schematic problem. | muddasserniaz | General Electronics Chat | 5 | 27th February 2007 09:51 AM |
| Mysterious Problem! | matasoft | Micro Controllers | 15 | 11th September 2004 07:49 PM |
| Creative live 5.1 problem... | nassus | General Electronics Chat | 9 | 10th June 2004 05:50 AM |
| Ballast / Igniter Problem | O B 1 KNooB | Electronic Projects Design/Ideas/Reviews | 1 | 6th March 2003 09:22 PM |
| How to diagnose a problem | Weasel | General Electronics Chat | 1 | 1st January 2003 03:40 AM |