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

IAR to CCS

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



Joined: 04 May 2006
Posts: 5

View user's profile Send private message

IAR to CCS
PostPosted: Tue May 09, 2006 1:27 pm     Reply with quote

Hi friends,
I'm trying to convert some IAR code to CCS and have confusions with data declarations.For example what can I use in CCS for

__eeprom __no_init <identifier> ;


Thanx in advance,
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Tue May 09, 2006 2:19 pm     Reply with quote

What does __eeprom __no_init do?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 09, 2006 2:46 pm     Reply with quote

See page 14 in this IAR reference guide:
http://www.ee.oulu.fi/~terva/Embedded2003/pdf/cavr.pdf
(The official IAR download page at http://www.iar.com/ is too slow)

Use the CCS typemod directive to do this. In the March 2006
CCS manual, see page 87 (in the Acrobat reader) for an example.
Download the CCS manual from this page:
http://www.ccsinfo.com/downloads.php
bjerkely12



Joined: 04 May 2006
Posts: 5

View user's profile Send private message

PostPosted: Wed May 10, 2006 5:18 pm     Reply with quote

In CCS manual it says that pointer to constand is not allowed ,ok but how can I handle this

const char *str;
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 10, 2006 5:31 pm     Reply with quote

You could have a global array in RAM, and copy a string into it
by using the CCS strcpy() function and then pass the address
of the RAM array to your function. Example:
Code:

#include <16F877.H>
#device *=16
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

char const msg1[]= {"Hello World"};
char const msg2[]= {"ABCD"};
char const msg3[]= {"Last message"};

char string_buffer[96];

void display_message(char *ptr)
{
printf("%s\n\r", ptr);
}

//===========================
void main()
{
strcpy(string_buffer, msg1);
display_message(string_buffer);

strcpy(string_buffer, msg2);
display_message(string_buffer);

strcpy(string_buffer, msg3);
display_message(string_buffer);

while(1);
}
 
 


Also see this post which uses the switch-case method to work around
the problem of no pointers to constant strings:
http://www.ccsinfo.com/forum/viewtopic.php?t=25483&start=7
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