CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem on programming 16F506

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
brutus



Joined: 14 Apr 2004
Posts: 12

View user's profile Send private message

Problem on programming 16F506
PostPosted: Thu Jan 13, 2011 5:01 am     Reply with quote

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: 19540

View user's profile Send private message

PostPosted: Thu Jan 13, 2011 7:57 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jan 13, 2011 8:18 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jan 13, 2011 12:42 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group