|
|
View previous topic :: View next topic |
Author |
Message |
mulligan
Joined: 20 Sep 2003 Posts: 5
|
RS232 on the 12F675 |
Posted: Tue Feb 17, 2004 6:13 pm |
|
|
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
|
|
Posted: Tue Feb 17, 2004 7:06 pm |
|
|
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
|
|
Posted: Tue Feb 17, 2004 8:25 pm |
|
|
That is helpful. Thanks for listing the variables as well. |
|
|
mulligan
Joined: 20 Sep 2003 Posts: 5
|
|
Posted: Tue Feb 17, 2004 8:27 pm |
|
|
btw, 'guest' is Mulligan |
|
|
Ttelmah Guest
|
|
Posted: Wed Feb 18, 2004 5:43 am |
|
|
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
|
|
Posted: Wed Feb 18, 2004 3:38 pm |
|
|
Thank you very much for the detailed analysis. |
|
|
|
|
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
|