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

FPUTC execute time

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



Joined: 06 May 2010
Posts: 33

View user's profile Send private message

FPUTC execute time
PostPosted: Wed Jun 02, 2010 9:19 am     Reply with quote

Hi, Im havin some troubles using fputc command.
Im trying to simulate a transmission of bytes by using a 18F8722 and proteus isis. The thing ist that my scheme must meet some time conditions between bytes, I mean, the time between bytes should be less than 700microsec. Ive seen in proteus that the time of the fputc execution is more than expected. when I do :

for(i=0;i<=lenbuff-1;i++)
fputc( buff[i],dirCam );

Than it takes like 1 msec to execute fputc and i would like to reduce the time interval. I was thinking of increasing the clock frequency since im working right now at 4Mhz but even at 20Mhz it seems to take the same time in proteus. some suggestions? Thank u
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Wed Jun 02, 2010 9:33 am     Reply with quote

The time is totally determined by the serial port baud rate.
The first time you call fputc, the byte is immediately transferred into the output shift register. The second time, it goes into the one character buffer. The third time, fputc, has to wait for the _first_ byte to complete sending, before it can be sent. From this point on, every write takes one charachter time.
Look at ex_stisr.c
This shows how to implement an interrupt driven software buffer to send data out the port. Transfer times of a few uSec (provided you have buffer space).

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