|
|
View previous topic :: View next topic |
Author |
Message |
Manel28
Joined: 06 May 2010 Posts: 33
|
FPUTC execute time |
Posted: Wed Jun 02, 2010 9:19 am |
|
|
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: 19515
|
|
Posted: Wed Jun 02, 2010 9:33 am |
|
|
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 |
|
|
|
|
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
|