|
|
View previous topic :: View next topic |
Author |
Message |
gfbankston
Joined: 21 Jul 2014 Posts: 35
|
pointer to ROM |
Posted: Fri Jul 25, 2014 7:22 am |
|
|
Hello,
THe following works in CodeVision and XC8 compiler, but not in CCS
const unsigned char Test_Msg[]={"Hello test"};
void flash2LCD(const unsigned char *);
....
flash2LCD(Test_Msg);
Of course, to print to my graphic LCD, I must do a lot. I have designed fonts as well and only send 8 bits at a time, and 'draw' the characters.
ROM pointer arithmetic is critical for this code.
I saw in the manual how to do a one time simple data access to a table, but how does one pass the pointer to a routine. The manual indicates you cannot, but other compilers do it (in PIC XC8 works fine).
TIA
GlenB |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 25, 2014 7:41 am |
|
|
The quickest way to solve this one is to add the line shown in bold below:
Quote: |
#include <18F4520.h>
#device PASS_STRINGS=IN_RAM
#fuses INTRC_IO, BROWNOUT, PUT, NOWDT
#use delay(clock=4M)
#use rs232(baud=9600, UART1, ERRORS)
const unsigned char Test_Msg[]={"Hello test"};
void flash2LCD(unsigned char *msg)
{
printf(msg);
}
//==========================
void main()
{
flash2LCD(Test_Msg);
while(1);
} |
If you do that, it will compile and you will get this output in MPLAB simulator:
|
|
|
|
|
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
|