Many of the commercial serial servo and serial LCD modules require you to
send out a preamble byte - Usually it is 0x55, which if you look at it is
an alternating set of '1' and '0'. This will allow you to time the bit
pattern and figure out how you should sample the bit cells, this means you
calibrate every time you get an input. This is rather simple if you bit
bang, if you use a hardware UART you need to have one that has an
auto-baud sync option to set up the bit timing. When I do my bit banging
I await the start bit and then set my sample time to be 1.5 bits after
that. This gives me a lot of margin.
DLC
> You could try some adaptive software to work out the baud rate ?
>
> We wanted to use a cheap internal osc so had the PC send out some 55H
> characters before transmission.
> The PIC measured the bits and used the value as the length of a bit.
> It then could match itself to the rx and tx of the PC.
>
> www.ckp-railways.talktalk.net/pcbcad21.htm
>
>
>
> ----- Original Message ----
> From: Mike Harrison <mike@whitewing.co.uk>
> To: AVR-Chat@yahoogroups.com
> Sent: Thursday, 31 May, 2007 10:45:55 PM
> Subject: Re: [AVR-Chat] Re: What serial speed (RS232) can I achieve using
> the built-in osc...
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Thu, 31 May 2007 15:27:21 -0600 (MDT), you wrote:
>
>
>
>> That is a brilliant tuning suggestion! I never thought of that one
>
>><chuckle>. Another "gotcha" when using the internal RC oscillators is
>
>>that they are not as stable over temperature
>
>
>
> ..or voltage
>
>
>
>>as a resonator or crystal.
>
>>As long as you stay pretty close to the 20-25C temperature range they
>
>>are fine, otherwise they can drift (see data sheet for the drift rate).
>
>
>
> There can also be significant jitter - seems to be worse on some parts
> than others - not sure if
>
> Microchip's tolerance specs take this into account or not.
>
>
>
>>DLC
>
>>
>
>>> Hi guys,
>
>>>
>
>>> Only bit of advice that I can give from my own experience is that the
>
>>> on chip RC oscillator is FINE for UART when your running on a accurate
>
>>> 5V supply AND you program the OSCCAL register with the correct value.
>
>>>
>
>>> If your VCC is low (3V or 3.3V) etc, you can still use the UART by
>
>>> setting the value of OSCCAL correctly (Not the value that the
>
>>> programmer gives you), I have done this by entering into a loop where
>
>>> I increment the OSCCAL register, then output it's value out the serial
>
>>> port, as soon as you can read the value, you know you have a value for
>
>>> OSCCAL that will allow the UART to work correctly. This is NOT a good
>
>>> way to do things for mass production, but is fine for homers and
>
>>> on-offs. The loop looks something like:
>
>>>
>
>>> OSCCAL = 0;
>
>>> while(OSCCAL < 255){
>
>>>
>
>>> OSCCAL++;
>
>>> UART_Write_Number( OSCCAL);
>
>>> }
>
>>>
>
>>>
>
>>> Cheers
>
>>> Hein B
>
>>> Auckland, New Zealand
>
>>>
>
>>> --- In AVR-Chat@yahoogroup s.com, dlc@... wrote:
>
>>>>
>
>>>> > On 5/30/07, dlc <dlc@...> wrote:
>
>>>> >> I've gotten 9600 baud to work well with the internal 1MHz
>
>>> oscillators of
>
>>>> >> the Tiny11. You can handle quite a bit of slop reading serial
>
>>> data if
>
>>>> >> your baud rate is low enough.
>
>>>> >
>
>>>> > Unfortunately, clock speed error is proportional, so 5% error is 5%
>
>>>> > error in baud rate, no matter what baud rate you pick. But, as the
>
>>>> > baud rates get higher, the granularity of the steps in the UBRR
>
>>>> > setting get proportionally larger (ie: 20 vs 21 is smaller error
>>>> than
>
>>>> > 3 vs 2)
>
>>>>
>
>>>> There is no hardware UART in these small chips, I bit bang my serial
>
>>>> there and that seems to be more tolerant of bit slip and stretch.
>>>> Being
>
>>>> in software gives me the option of very high granularity. The
>>>> hardware
>
>>>> UARTS are not as tolerant of error. That is probably the difference.
>
>>>>
>
>>>> DLC
>
>>>> --
>
>>>> Dennis Clark
>
>>>>
>
>>>
>
>>>
>
>>>
>
>>>
>
>>>
>
>>> Yahoo! Groups Links
>
>>>
>
>>>
>
>>>
>
>>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>Yahoo! Groups Links
>
>>
>
>>
>
>>
>
>
>
>
>
>
>
>
>
>
>
>
> <!--
>
> #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean,
> sans-serif;}
> #ygrp-mlmsg table {font-size:inherit;font:100%;}
> #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean,
> sans-serif;}
> #ygrp-mlmsg pre, code {font:115% monospace;}
> #ygrp-mlmsg * {line-height:1.22em;}
> #ygrp-text{
> font-family:Georgia;
> }
> #ygrp-text p{
> margin:0 0 1em 0;}
> #ygrp-tpmsgs{
> font-family:Arial;
> clear:both;}
> #ygrp-vitnav{
> padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
> #ygrp-vitnav a{
> padding:0 1px;}
> #ygrp-actbar{
> clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
> #ygrp-actbar .left{
> float:left;white-space:nowrap;}
> .bld{font-weight:bold;}
> #ygrp-grft{
> font-family:Verdana;font-size:77%;padding:15px 0;}
> #ygrp-ft{
> font-family:verdana;font-size:77%;border-top:1px solid #666;
> padding:5px 0;
> }
> #ygrp-mlmsg #logo{
> padding-bottom:10px;}
>
> #ygrp-vital{
> background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
> #ygrp-vital #vithd{
> font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
> #ygrp-vital ul{
> padding:0;margin:2px 0;}
> #ygrp-vital ul li{
> list-style-type:none;clear:both;border:1px solid #e0ecee;
> }
> #ygrp-vital ul li .ct{
> font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
> #ygrp-vital ul li .cat{
> font-weight:bold;}
> #ygrp-vital a {
> text-decoration:none;}
>
> #ygrp-vital a:hover{
> text-decoration:underline;}
>
> #ygrp-sponsor #hd{
> color:#999;font-size:77%;}
> #ygrp-sponsor #ov{
> padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
> #ygrp-sponsor #ov ul{
> padding:0 0 0 8px;margin:0;}
> #ygrp-sponsor #ov li{
> list-style-type:square;padding:6px 0;font-size:77%;}
> #ygrp-sponsor #ov li a{
> text-decoration:none;font-size:130%;}
> #ygrp-sponsor #nc {
> background-color:#eee;margin-bottom:20px;padding:0 8px;}
> #ygrp-sponsor .ad{
> padding:8px 0;}
> #ygrp-sponsor .ad #hd1{
> font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
> #ygrp-sponsor .ad a{
> text-decoration:none;}
> #ygrp-sponsor .ad a:hover{
> text-decoration:underline;}
> #ygrp-sponsor .ad p{
> margin:0;}
> o {font-size:0;}
> .MsoNormal {
> margin:0 0 0 0;}
> #ygrp-text tt{
> font-size:120%;}
> blockquote{margin:0 0 0 4px;}
> .replbq {margin:4;}
> -->
>
>
>
>
>
>
>
>
>
> ___________________________________________________________
> Copy addresses and emails from any email account to Yahoo! Mail - quick,
> easy and free. http://uk.docs.yahoo.com/trueswitch2.html
>
> [Non-text portions of this message have been removed]
>
>
>
>
> Yahoo! Groups Links
>
>
>
>Message
Re: [AVR-Chat] Re: What serial speed (RS232) can I achieve using the built-in osc...
2007-05-31 by dlc@frii.com
Attachments
- No local attachments were found for this message.