View previous topic :: View next topic |
Author |
Message |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
reading rom data program |
Posted: Mon Jan 28, 2008 8:55 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Mon Jan 28, 2008 11:24 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Tue Jan 29, 2008 1:22 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|