|
|
View previous topic :: View next topic |
Author |
Message |
Skipper
Joined: 20 Nov 2004 Posts: 12 Location: Austria
|
Memory Location with #locate |
Posted: Thu Nov 25, 2004 3:03 am |
|
|
Is this correct to place an area with Datas (Bytes) in the rom of the PIC16F684 at Position 0x0100 ?
In which output file of the compiler can I see the Position of the Datas,
Because in the PICkit Classic the data´s are on the beginning of the Programm Memory.
[/code]
BYTE const table[50]={0xAA, 0xBB, 0xCC, 0xDD, 0xFF,
0xAA, 0xBB, 0xCC, 0xDD, 0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xFF,
0xAA, 0xBB, 0xCC, 0xDD, 0xFF,
0xAA, 0xBB, 0xCC, 0xDD, 0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xFF,
};
#locate table = 0x0100
|
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Nov 25, 2004 3:48 am |
|
|
Quote: | In which output file of the compiler can I see the Position of the Datas |
In the symbol file: *.sym |
|
|
Ttelmah Guest
|
|
Posted: Thu Nov 25, 2004 4:15 am |
|
|
Key problem here, is that what is put at 0x100, won't just be the table. If you define a 'const' table, then the compiler places the code to access it, followed by the data table, at the address. In the case of a chip like the 688 (which supports direct reading of the flash), the data following the program, will be as expected. In the case of older chips without these instructions, the program will be followed by a series of 'retlw' instructions to return the data. If you require actual data to sit at a specific location, then use the #rom directive instead, and access the data using the read_program_memory instruction on chips supporting this (on chips that don't support this, you cannot directly 'read' an address in the ROM.
You can't have 'data' at the start of program memory, in any PIC, since the first instruction, is where the processor goes on boot (you can have it immediately after this, if you are not using interrupts - otherwse a few more instruction have to be missed to allow for the interrupt vectors.
Best Wishes |
|
|
UKH2 Guest
|
Table at ROM |
Posted: Fri Mar 11, 2005 1:49 am |
|
|
What can I do to build at table of bytes in FLASH-ROM. For my application it's senseless where this table will be located, BUT I would like to know where it is placed because I want to read and write it with read_/write_program_memory.
In older applications in which such functionallity was needed too I've used
the #ROM directive with a fixed-address, so read_ or write to programm-memory was easy because of the known address. But this solution isn't nice in each case.
Has someone made any experiences with another solution.
Thanks in advance.
UKH. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 11, 2005 2:12 am |
|
|
If you have a modern version of the compiler, you can use the
label_address() function to get the address of the data in a const array.
See the example near the start of this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=22070 |
|
|
|
|
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
|