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

Getc using timeout feature problems

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



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

Getc using timeout feature problems
PostPosted: Mon Jul 25, 2005 8:56 am     Reply with quote

Hi,

Is there a better way for getc to timeout after some time, the one given in CCS example seems to make the PIC go haywire...

Also what value of delay time should I use for 1200 bits/sec

thanks
arunb
Ttelmah
Guest







PostPosted: Mon Jul 25, 2005 3:44 pm     Reply with quote

Personally, I just use a interrupt driven receive, and a hardware timer set to the interval I require.
The bps rate, only has a small bearing on the timout interval, unless you are looking to send all characters 'nose to tail' without pauses.
You need to be looking at your own timings throughout the system, likely reasons for gaps, and how you want to recover.
For instance, in another situation, I deal on a 'packet' basis, the serial just scans looking for an STX character, and when this is received, assumes a packet is starting. The packet is 16 characters, plus a header, checksum and ETX charater. The data is sent over a wireless link, with a 50mSec 'turnround'. When STX is seen, it implies the link should be in receive mode, and the packet should follow. However the PC at the other end, is quite capable of being multi-tasking, and taking perhaps a 18mSec break at some point in the output. Hence I allow 20 character times (in my case at 9600bps, 20.1mSec), plus the possibility of another 18mSec break, to give a total time of 38.1 mSec in which a packet should be completed. I use 40mSec, and only if this has passed without the packet completing, then restart scanning, and trigger a new request for data.
On the PC itself, the timeout value if used, is normally set to 10mSec plus the character time.
So, you need to be thinking what the worst case 'legitimate' break is, and trigger the timeout after this interval.

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