View previous topic :: View next topic |
Author |
Message |
brutus
Joined: 14 Apr 2004 Posts: 12
|
Problem on programming 16F506 |
Posted: Thu Jan 13, 2011 5:01 am |
|
|
Hi,
I've read a thread ( http://www.ccsinfo.com/forum/viewtopic.php?t=43815 ) about some problems with 16F506. I have the same problem: at the address 0x3FF I get 0x00, and while programming I get this message in MpLab:
ICDWarn0044: Target has an invalid calibration memory value (0x0). Continue?
According to me is a problem connected with the internal oscillator.
Does anyone knows what shoul be the right value at the address memory 0x3FF value?
I'm using MpLab IDE 8.60 + ICD2 or PIKkit3
Any suggestion?
Thanks,
C |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19541
|
|
Posted: Thu Jan 13, 2011 7:57 am |
|
|
For the calibration value, There is no 'right value'. It varies from chip to chip.
This value is programmed at the factory, and _must_ be read from the chip, and written back each time the chip is programmed. Page 22 in the data sheet. Programmers normally have an option to 'preserve calibration value' (or some similar wording), that does this automatically.
Unfortunately, if you program a chip _without_ using this option, the value will have been destroyed.
Some programmers (Mach-X for example), have an option to calculate the value for you. They load a value, test how fast the clock runs, then adjust the value to get the speed right. Otherwise, you are going to have to do this yourself. Start with 0x0c0000, which will set the chip to it's centre frequency. Then test using a stopwatch and a long delay, and adjust the last two bytes to increase of decrease the frequency.
Best Wishes |
|
|
brutus
Joined: 14 Apr 2004 Posts: 12
|
|
Posted: Thu Jan 13, 2011 8:18 am |
|
|
Thanks,
I supposed it. I'm not sure why it was 0. In any case for me is not important a perfect calibration, in my application I don't need a great precision.
The problem is that also setting it to a default value (0x0c0000) it doesn't seem to work at all...the oscillator seems blocked.
Claudio. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 13, 2011 12:42 pm |
|
|
Quote: |
The problem is that also setting it to a default value (0x0c0000)
it doesn't seem to work. |
That number is not correct. Instruction words are only 12 bits wide in
the 16F506. It would be 0xC00 for the "MOVLW 0x00" instruction at
address 0x3FF.
MPLAB has the ability to re-program the calibration memory.
Go to this menu in MPLAB:
Quote: | Programmer / Settings / Calibration Memory tab |
There is a tickbox that says:
Quote: | Allow ICD2 to program calibration memory |
You can select that tickbox, and enter a new value for the calibration
memory. Note: MPLAB will handle the opcode part of the instruction.
This the 0xC part. You only need to enter the data, which should be 0x00
initially. |
|
|
|