View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 04, 2011 12:00 pm |
|
|
I made a test program that uses the "rom" keyword that Ttelmah refers to.
It displays the following output in the MPLAB simulator for vs. 4.119.
This output is correct.
Quote: |
ptr = 0fef
PRODUCT ID V1.01
PRODUCT ID V1.01 |
Code: | #include <16F1824.h>
#fuses INTRC_IO,NOWDT
#use delay(clock=4000000)
#use rs232(baud=9600, UART1, ERRORS)
char rom version[] = "PRODUCT ID V1.01";
char rom *ptr;
void display_string(rom *str)
{
printf("%s \r", str);
}
//=====================
void main()
{
ptr = version;
printf("ptr = %lx \r", ptr);
display_string(version);
display_string(ptr);
while(1);
} |
|
|
|
Pekub
Joined: 20 Dec 2005 Posts: 16
|
|
Posted: Tue Apr 05, 2011 3:11 am |
|
|
Thank you PCM programmer and Ttelmah also. This is what I needed.
In my opinion, use keyword "rom" is not sufficiently explained in the manual. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Tue Apr 05, 2011 3:39 am |
|
|
The 'best' explanation, is the _readme_ with the compiler. This covers things that are relatively recent (though 'ROM' has been used for over a year!), and not fully in the manual. This gives the current syntax for ROM, and the keywords to change between the ROM, and const behaviour.
To work with a PIC, and CCS, you need to use the following bits of paperwork:
The C programming language or a near equivalent.
The chip's data sheet
The CCS manual
The readme.txt, and fuses.txt
The Microchip reference manuals for the specific peripherals and chip versions.
You then 'have a chance'!....
Best Wishes |
|
|
|