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

get string with spi

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



Joined: 28 Aug 2007
Posts: 45

View user's profile Send private message

get string with spi
PostPosted: Fri Aug 08, 2008 10:24 am     Reply with quote

Hi all
How can I get string with spi? Is there any function for that?
Ttelmah
Guest







PostPosted: Sat Aug 09, 2008 2:59 pm     Reply with quote

No.
First thing to remember, is that SPI, is a bi-directional interface, so the idea of just 'receiving' something like a string, isn't really logical. Most devices require communications in each direction, to control what is going on.

However if you are just using your own pair of devices, and want to receive a 'string', then simply look at input.c, and the function 'get_string'. Simply copy this, and substitute the spi function for the getc. For a master, use spi_read(0), so a 'dummy' byte is clocked over the interface, or for a slave device, just using spi_read. Get rid of the putc's (these are designed to allow 'backspace' to be handled), and you have a routine to handle the reception of a CR terminated 'string'.

Best Wishes
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