Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 16th May 2008, 02:52 AM   (permalink)
Experienced Member
Suraj143 is on a distinguished road
Talking BandGap Value Problem - Working Speedily

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?
Suraj143 is offline   Reply With Quote
Old 16th May 2008, 03:04 AM   (permalink)
Experienced Member
 
Blog Entries: 4
blueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to behold
Send a message via Skype™ to blueroomelectronics
Default

http://www.best-microcontroller-proj...bration_value.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 16th May 2008, 03:43 AM   (permalink)
Experienced Member
Suraj143 is on a distinguished road
Default

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.
Suraj143 is offline   Reply With Quote
Old 16th May 2008, 07:05 AM   (permalink)
Experienced Member
 
geko is just really nicegeko is just really nicegeko is just really nice
Default

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
__________________
Pete
picprojects.org.uk
geko is offline   Reply With Quote
Old 16th May 2008, 07:42 AM   (permalink)
Experienced Member
Suraj143 is on a distinguished road
Default

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?
Suraj143 is offline   Reply With Quote
Old 16th May 2008, 08:00 AM   (permalink)
Experienced Member
Suraj143 is on a distinguished road
Default

Changing oscillator calibration word will cause my program to work speedily?
Suraj143 is offline   Reply With Quote
Old 16th May 2008, 08:45 AM   (permalink)
Experienced Member
 
geko is just really nicegeko is just really nicegeko is just really nice
Default

Quote:
Changing oscillator calibration word will cause my program to work speedily?
Or more slowly, depends which way you change it.

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
__________________
Pete
picprojects.org.uk
geko is offline   Reply With Quote
Old 16th May 2008, 08:57 AM   (permalink)
Experienced Member
Suraj143 is on a distinguished road
Default

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.
Suraj143 is offline   Reply With Quote
Old 16th May 2008, 09:01 AM   (permalink)
Super Moderator
 
Nigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to behold
Default

Quote:
Originally Posted by Suraj143 View Post
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.
It's a value measured in the factory to make the oscillator as accurate as possible - different PIC's will obviously usually have different values.

Your programming software should automatically read, save, and restore the value during programming or erasing.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 16th May 2008, 09:10 AM   (permalink)
Experienced Member
Suraj143 is on a distinguished road
Default

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.
Suraj143 is offline   Reply With Quote
Old 16th May 2008, 10:17 AM   (permalink)
Experienced Member
 
geko is just really nicegeko is just really nicegeko is just really nice
Default

Quote:
Originally Posted by Suraj143 View Post
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.
Again, read the data sheet, page 16, 2.2.2.7 OSSCAL regsister.

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.
__________________
Pete
picprojects.org.uk
geko is offline   Reply With Quote
Old 17th May 2008, 01:51 AM   (permalink)
Experienced Member
 
Blog Entries: 4
blueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to behold
Send a message via Skype™ to blueroomelectronics
Default

geko your projects are always well written & very cool.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
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



All times are GMT. The time now is 05:47 AM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.