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 support@ccsinfo.com

osccal register

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



Joined: 07 Sep 2003
Posts: 56

View user's profile Send private message Send e-mail

osccal register
PostPosted: Mon Feb 23, 2004 4:56 am     Reply with quote

Hello
I have a pic 16f630 which I erased its calibration data( the "retlw k" instruction in address 0x3ff)


I want to re-program that location
I want that in program memory address 0x3ff will be :"retlw 0x80"

I tryed:

#org 0x3fd,0x3ff
char const cal[1]={0x80};

but this generated the code:

address 0x3fd: addwf pcl,f
address 0x3fe: retlw0x80
address 0x3ff: retlw 0x0

I tryed :
#org 0x3ff
#asm
retlw 0x80
#endasm


but the compiler asked me about a decleration ("expecting a decleration")

how can I do that?
Doug
Guest







PostPosted: Mon Feb 23, 2004 12:49 pm     Reply with quote

If 0x80 is the factory calibration value then you can put this at the top of your program:

Code:
#ROM 0x3FF={0x3480}


0x3FF is the last program memory address if it is a 1K rom. A 2K rom will be 0x7FF and so on..

0X34 is the RETWL opcode.

0x80 is the factory calibration value.

Hope this helps.
Guard



Joined: 20 Jan 2005
Posts: 43

View user's profile Send private message

PostPosted: Fri Jan 21, 2005 8:45 am     Reply with quote

hi,

Does the program function if retwl dosn't exist ? ( I erased all memory ) ???
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Jan 21, 2005 9:07 am     Reply with quote

If you use the internal OSC and that location is blank, then no. It will just loop. It expects a return there. The instuction will act as a NOP and the PC will roll to 0 and the program start over. Most programmers protect this space and won't even allow you to save to it.
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