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

RS232 on the 12F675

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



Joined: 20 Sep 2003
Posts: 5

View user's profile Send private message

RS232 on the 12F675
PostPosted: Tue Feb 17, 2004 6:13 pm     Reply with quote

How much luck have people had using RS232 on the 12F675 using the internal 4MHz oscillator? What is a useful maximum baud rate?

I'll experiment, but I wanted some "real-life" input as well.

Thanks.
languer



Joined: 09 Jan 2004
Posts: 144
Location: USA

View user's profile Send private message

PostPosted: Tue Feb 17, 2004 7:06 pm     Reply with quote

I have used 9600 without problems. But my packets are short and few, do not repeat much, and this is only at room temp and fixed voltage.

Hope this helps,
languer.
Guest








PostPosted: Tue Feb 17, 2004 8:25 pm     Reply with quote

That is helpful. Thanks for listing the variables as well.
mulligan



Joined: 20 Sep 2003
Posts: 5

View user's profile Send private message

PostPosted: Tue Feb 17, 2004 8:27 pm     Reply with quote

btw, 'guest' is Mulligan
Ttelmah
Guest







PostPosted: Wed Feb 18, 2004 5:43 am     Reply with quote

languer wrote:
I have used 9600 without problems. But my packets are short and few, do not repeat much, and this is only at room temp and fixed voltage.

Hope this helps,
languer.

Yes. I think this is the 'key'. The accuracy of the internal oscillator changes with the supply voltage, and temperature. Provided the unit is being used in a 'normal' temperature enviroment, and the supply voltage is accurately controlled, the overall accuracy and stability is very reasonable. However if the supply rail is less well regulated, or the temperature range is larger, then the internal oscillator may become more dubious. Now the accuracy needed for serial communications, depends on a lot of variables. With the 'soft' UART (and with units with a hardware serial), there are inherent 'errors' in the timings to begin with. If (for instance), you try to send at very high rates (57600bps etc), it may well be impossible to get the timing 'right' with an integer number of instruction cycles, so the code will allways generate a percentage error in the timings. At 57600, each 'bit time', is 17.36 instruction times. Hence if the compiler generates a 17 instruction loop to generate/scan the bits, the code timing will allready be over 2% in error, even if the oscillator frequency is perfect. Conversely, at 9600bps, it should be possible to get this error down to about 0.2%. How much error is acceptable, will depend on any timing errors in the other device, the sampling strategy chosen by the device, and any other effects produced by the drivers/signal lines. In general, provided the error is less than about 2.5 to 3%, comms should be reliable. Now taking this as an 'allowable' margin, you can see that at the 57600 rate, only a very small clock error is needed to go beyond this margin (1.03/1.02=1.0098 - this is a less than 1% clock error).
The quoted errors, are about 2%, for the full temperature range of the chip (at 5v), and just over 5% for the full temperature/supply range. The latter will allmost certainly cause major problems whatever rate is chosen, while the former will work OK, provided the baud rate is selected to keep the 'initial' error reasonable.
I have used the 12F675, as a programmable monostable, to handle bit masking on serial streams at 19200bps, without the error being unreasonable over a commercial temperature range, excpet for a few specific chip versions in the early days, that seemed to have oscillators that performed well outside their specified rates...
In general rates up to perhaps 9600bps, should work fine, over a reasonable temperature range, provided the supply is stable.

Best Wishes
mulligan



Joined: 20 Sep 2003
Posts: 5

View user's profile Send private message

PostPosted: Wed Feb 18, 2004 3:38 pm     Reply with quote

Thank you very much for the detailed analysis.
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