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

Address of ROM-Table

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







Address of ROM-Table
PostPosted: Wed Jul 30, 2003 1:03 am     Reply with quote

I've placed some tables in the Program Memory (FLASH
of the PIC 18F45x). I'm looking for a good solution
to find the startaddress of this table. It isn't
0x5E00 because of the sequence of table-read made
by the compiler. This sequence starts at 0x5E00, the
data follows them. Now I'm afraid to take a fix offset
of 0x1E to find the real startaddress 0x5E1E !!!

Has someone a better idea ??

Thanks a lot.
Uwe


.................... #org 0x5E00, 0x7FFF
.................... #org 0x5E00
....................
.................... byte const DE2_MESS[5][10][36] =
.................... {
.................... { {"DIE-Stoermeldung DE2-ADR.00 ST01\x00\x00\x00"},
.................... {"DIE-Stoermeldung DE2-ADR.00 ST02\x00\x00\x00"},
.................... {"DIE-Stoermeldung DE2-ADR.00 ST03\x00\x00\x00"},
.................... {"DIE-Stoermeldung DE2-ADR.00 ST04\x00\x00\x00"},
.................... {"DIE-Stoermeldung DE2-ADR.00 ST05\x00\x00\x00"},
.................... {"DIE-Stoermeldung DE2-ADR.00 ST06\x00\x00\x00"},
.................... {"DIE-Stoermeldung DE2-ADR.00 ST07\x00\x00\x00"},
.................... {"DIE-Stoermeldung DE2-ADR.00 ST08\x00\x00\x00"},
.................... {"DIE-Stoermeldung DE2-ADR.00 ST09\x00\x00\x00"},
.................... {"DIE-Stoermeldung DE2-ADR.00 ST10\x00\x00\x00"} },
:
:
:
.................... };
*
5E1E: DATA 44,49
5E20: DATA 45,2D
5E22: DATA 53,74
:
:
:
5E00: NOP(FFFF)
5E02: MOVFF INTCON,0E
5E06: BCF INTCON.7
5E08: ADDLW 1E
5E0A: MOVWF TBLPTRL
5E0C: MOVLW 5E
5E0E: ADDWFC TBLPTRH,F
5E10: TBLRD*+
5E12: NOP(FFFF)
5E14: MOVF TABLAT,W
5E16: BTFSC 0E.7
5E18: BSF INTCON.7
5E1A: RETURN 0
5E1C: NOP(FFFF)
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516488
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Address of ROM-Table
PostPosted: Wed Jul 30, 2003 12:55 pm     Reply with quote

:=I've placed some tables in the Program Memory (FLASH
:=of the PIC 18F45x). I'm looking for a good solution
:=to find the startaddress of this table.
-------------------------------------------------------

Do you want to put data into ROM, but without having the
compiler insert the "fetch" code at the beginning of the data ?

If so, I made this small test program which does that.
The #rom statements insert the data, and the #org statement
protects those rom addresses from being used by the compiler
for regular code.

So with this method, you know the exact address of your data.


#include "c:\Program Files\Picc\Devices\16F877.H"
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 8000000)

void main()
{


while(1);
}

#org 0x1800, 0x18FF
#rom 0x1800 = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
#rom 0x1820 = {"1234567890"}
#rom 0x1830 = {"This is a test"}

___________________________
This message was ported from CCS's old forum
Original Post ID: 144516498
Uwe Koch
Guest







Re: Address of ROM-Table
PostPosted: Wed Aug 06, 2003 2:40 am     Reply with quote

:=:=I've placed some tables in the Program Memory (FLASH
:=:=of the PIC 18F45x). I'm looking for a good solution
:=:=to find the startaddress of this table.
:=-------------------------------------------------------
:=
:=Do you want to put data into ROM, but without having the
:=compiler insert the "fetch" code at the beginning of the data ?
:=
:=If so, I made this small test program which does that.
:=The #rom statements insert the data, and the #org statement
:=protects those rom addresses from being used by the compiler
:=for regular code.
:=
:=So with this method, you know the exact address of your data.
:=
:=
:=#include "c:\Program Files\Picc\Devices\16F877.H"
:=#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
:=#use delay(clock = 8000000)
:=
:=void main()
:={
:=
:=
:=while(1);
:=}
:=
:=#org 0x1800, 0x18FF
:=#rom 0x1800 = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
:=#rom 0x1820 = {"1234567890"}
:=#rom 0x1830 = {"This is a test"}
:=

Ok, but I want to have arrays with more than one index, for example:

#org 0x5E00, 0x7FFF
#org 0x5E00

byte const DE2_MESS[5][10][36] =
{
{ {"123456789012345678901234567890 ST01\x00\x00\x00"},
{"123456789012345678901234567890 ST01\x00\x00\x00"},
{"123456789012345678901234567890 ST01\x00\x00\x00"},
{"123456789012345678901234567890 ST01\x00\x00\x00"},
:
:
},
:
:
};

I've several tables in the area 0x5E00....0x7FFF. I've used the
segment element of the ORG command because I want that the compiler calculates each start-address. In your solution I have to calculate each size of an array to set the correct ROM-address. It's too much work and the compiler should make it better. On the other hand the contents and size of my arrays can change sometimes. Therefore such calculations must be made several times.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516703
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