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

Translating Microchip C18 C to CCS C

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



Joined: 15 Nov 2004
Posts: 18

View user's profile Send private message

Translating Microchip C18 C to CCS C
PostPosted: Mon Jun 28, 2010 6:39 pm     Reply with quote

I am in the process of translating software for the CC2420 radio from C18 C to CCS C.

My question for this moment is: what do the back slashes mean. See code fragment below.

Code:

#define _SPI_WRITE(cmd) \
SSPBUF = cmd; \
if ( SSPCON1 & 0x80 ) \
return ( -1 ); \
else \
{ while( !SSPSTATbits.BF ); }


Regards,

Klaus de Jong
sjb



Joined: 13 Apr 2010
Posts: 34
Location: UK

View user's profile Send private message

PostPosted: Mon Jun 28, 2010 6:57 pm     Reply with quote

They are line continuation markers. They should be exactly the last character on the line.

In this case it allows the #define to be written over several lines rather than having to put the whole statement on one line as would normally be the case with #define.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 28, 2010 7:06 pm     Reply with quote

You can substitute the CCS function spi_write() for their _SPI_WRITE()
function.
klausdejong



Joined: 15 Nov 2004
Posts: 18

View user's profile Send private message

PostPosted: Tue Jun 29, 2010 6:41 am     Reply with quote

So, the code snippet I posted is their definition for the CCS spi_write()

OK, thanks
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