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

i2C_Stream

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



Joined: 13 Nov 2007
Posts: 15

View user's profile Send private message

i2C_Stream
PostPosted: Wed Feb 13, 2008 3:36 pm     Reply with quote

Hello

Someone could post a example code of i2c communication using "Stream".

thanks
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Feb 14, 2008 9:52 am     Reply with quote

As far as I know, STREAM is only available with the RS232, not the I2C.

Ronald
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 14, 2008 11:43 am     Reply with quote

Streams can be specified in the #use i2c() statement in vs. 4 of the
compiler. See the current manual:
http://www.ccsinfo.com/downloads/CReferenceManual.pdf


To answer the question, specify the name of the stream in the #use i2c()
statement. Do this in the same way as a stream is specified in a
#use rs232() statement. Then, in every i2c function, specify the stream
that you're using.

Instead of doing this:
Quote:
i2c_write (data);

You would do this:
Quote:
i2c_write (stream, data);


All the rest of the i2c functions must also have a stream parameter
(if you are using streams). Example:
Code:

i2c_poll(stream);
data = i2c_read(stream);
data = i2c_read(stream, ack);
i2c_start(stream);
i2c_start(stream, restart);
i2c_stop(stream);
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