Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
David Prentice
01/09/12 11:41
Modified:
  01/09/12 12:43

Read: 460 times
Wormshill
England


 
#185396 - Use Timer2 since a S52 has a timer2
Responding to: ???'s previous message
From the bible:
RCAP2 = 65536 - F_CPU / 32 / 31250
this is 65525 for 11.059MHz
i.e. 31418 baud

Incidentally, now that I have had a play, I see that you can do the sum very easily. e.g.
7.3728MHz -> RCAP2 = 65536 - 7 -> 7.3728/7 = +5.3%
11.059MHz -> RCAP2 = 65536 - 11 -> 11.059/11 = +0.54%
14.7456MHz -> RCAP2 = 65536 - 15 -> 14.7456/15 = -1.7%
18.432MHz -> RCAP2 = 65536 - 18 -> 18.432/18 = +2.4%%

UARTs need to be within +-2% of your desired baud rate. I would be quite happy with 0.5%. It looks as if 11.059 is your only viable choice. 14.74Mhz should just work.

I am sure there are some tables somewhere. I just got the calculator out.

Anyway, why are you worrying about the F_CPU? You simply choose the best crystal for your critical peripherals. Then scale all your non-hardware calculations.

David.

List of 6 messages in thread
TopicAuthorDate
31.25K Baud Rate w/Crystals Other Than 6, 12 or 24MHz      Jon Wilder      01/09/12 11:22      
   Use Timer2 since a S52 has a timer2      David Prentice      01/09/12 11:41      
      Timer2 Baud Rate      Jon Wilder      01/09/12 12:49      
         Your maths look fine      David Prentice      01/09/12 13:55      
            I just got the calculator out      KONSTANTINOS L. ANGELIS      01/09/12 14:27      
               It Works!!!      Jon Wilder      01/09/12 17:12      

Back to Subject List