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 support@ccsinfo.com

i2c vs rs232

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



Joined: 21 Nov 2006
Posts: 129

View user's profile Send private message

i2c vs rs232
PostPosted: Tue Aug 18, 2009 11:16 pm     Reply with quote

Hi,

Is there a way to send data using i2c that takes less time away from the processor than using rs232 and #int_tbe? I mean, it seems to send data with i2c, for every byte of data you want to send, you have to use i2c_write. Even though the data is being transmitted quickly this way, what can be quicker than simply writing a byte to the uart?

Hopefully the question makes sense, and is valid. Basically, if choosing i2c, for a tightly run program, will i2c take longer in overhead to send out the data than taking advantage of the buffer of the rs232 uart?
Ttelmah
Guest







PostPosted: Wed Aug 19, 2009 2:30 am     Reply with quote

Quicker, no, depending on the clock rate actually being used.
As quick, yes.

It is a 'fault' of the CCS internal functions, that in several cases, they do unnecessary work. This applies particularly to I2C_WRITE, putc, and the SPI functions, when used inside interrupts.
You can simply declare the I2C buffer address, and in the interrupt, when servicing a write, just write the byte to the I2C buffer, without using the CCS functions, and exit the function ASAP. Obviously the potential transfer rate of I2C (and even more so, with SPI), should send the byte faster than would normally be done with RS232, which would then potentially give an improvement in overall performance.

I'm using I2C, over 30m runs, at 12v, with the P82B96L buffers, at 400KHz, using a custom 'INT_GLOBAL' (a search here will find why this is important), and direct writing to the buffer, to send 50 byte packets, in 1.2mSec.

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