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

Silly question about RS232 speed and times

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



Joined: 09 Oct 2003
Posts: 39
Location: LA PLATA, ARGENTINA

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

Silly question about RS232 speed and times
PostPosted: Fri Feb 27, 2004 5:09 pm     Reply with quote

Hello everyone,

I�ve managed to communicate an 16F628 with a PC, at 115200.
It downloads a 24LC256 eeprom full of sampled data from certain sensor.
While the 16F628 is sending data, it doesn�t do other tasks.
It gets 33 - 34 seconds to download all data, so, aprox. 1kb second.
Sholudn�t it be more than this ??

115200b/sec / 11b is aprox = 15200bytes/sec

Or am I doing something wrong ??

Thanks in advance.-
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 27, 2004 6:35 pm     Reply with quote

Quote:
It gets 33 - 34 seconds to download all data, so, aprox. 1kb second.
Sholudn�t it be more than this ??

It takes time to read the bytes from the EEPROM.
If you use the CCS function, read_ext_eeprom(), it will take
approximately 50 bits of i2c transmission just to read one byte.
The 16F628 does not have a MSSP module, so you have to
use software i2c.

The CCS software routines probably do not run at 100 KHz.
Here is some information from an old post of mine.
I think these tests were done with vs. 2.7xx of the compiler.

4 MHz crystal = 40 KHz i2c clock
8 MHz crystal = 62.5 KHz i2c clock
10 MHz crystal = 80 KHz i2c clock

Let's say you're using a 20 MHz crystal. Then you can probably
get the full 100 KHz standard i2c clock speed. To do 50 bits
on the i2c bus, would take 50/100,000 = .5 ms.

So this is where your delay is coming from.

You can eliminate most of this delay by using the "Sequential Read"
mode with the 24LC256. You just need to write a routine to use
that method, instead of the read_ext_eeprom() function.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Fri Feb 27, 2004 6:50 pm     Reply with quote

Hola Gabriel,

Assuming 8N1 you get:
(1/115200) * 10 = 0.000086 sec/byte

Max room for 24LC256 = 32768 bytes

32768 bytes * 0.000086 sec/byte = 2.8180 sec

That�s the minimum theorical data transfer time, you didn't post your code so may be you need to re-check it.
Also you will check with a scope your xtal freq and the bit width in Tx line.

regards,

Humberto
Gabriel Caffese



Joined: 09 Oct 2003
Posts: 39
Location: LA PLATA, ARGENTINA

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

Thanks a lot !
PostPosted: Fri Feb 27, 2004 11:35 pm     Reply with quote

PCM Programmer,

Thank you very much. I�working at 4Mhz. Uhhh !!!
I�ve thought it would be an EEPROM speed limit that may be causing it, but never thought I2C "soft transfer" speed would be as low as 40Khz !

Humberto,

Gracias. El problema evidentemente est� en que el bus I2C lo implemento por software, y la velocidad de transferencia es extremadamente baja. De Capital ? Yo estoy en La Plata.

Thank you both.-
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