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

reading rom data program

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



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

reading rom data program
PostPosted: Mon Jan 28, 2008 8:55 am     Reply with quote

Hi ti all,

I decided to use SQTP programmer option to have in defined location unique data. SQTP write data in rom with retlw instruction. After program I found in location defined 0x3401 (mnemonic retlw 0x01). Which way I have to use to read data in rom location ? I use pIC16F630 and ccs. V3.249.

Thanks for help,

Regards,
Fabri
Ttelmah
Guest







PostPosted: Mon Jan 28, 2008 11:24 am     Reply with quote

The RETLW instruction, is used to write a byte into a word in the program memory, which can then be called, to return this value. If the location where the data is being put, is inside the program memory (below 0x3FF), then something like:
Code:

int8 return_val(void) {
   int8 temp;
   #asm
   call 0x380 //changed to suit the required address
   movwf temp
   #endasm
   return(temp);
}

If instead the data was put at address 0x2100 to 0x21FF,then you cuold use the EEPROM read functions to access it.
The code above, is basically how the compiler accesses 'const' data tables in the ROM.

Best Wishes
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Tue Jan 29, 2008 1:22 am     Reply with quote

Thanks Ttelmah,

I'ts a long time I didn't use assembler that I ever thought to use call instruction to read rom location.

Regards,
Fabri
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