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

pointer to ROM

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



Joined: 21 Jul 2014
Posts: 35

View user's profile Send private message

pointer to ROM
PostPosted: Fri Jul 25, 2014 7:22 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 25, 2014 7:41 am     Reply with quote

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:
Quote:
Hello test
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