{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 8051 Calculations for Baud Rate Generator\n", "\n", "Desired baud rate is 9600. What oscillator frequencies and timer settings can we use in order to generate that baud rate with acceptable error?\n", "\n", "$BaudRate = \\frac{K \\;\\times\\; OscillatorFreq}{32 \\;\\times\\; 12 \\;\\times\\; (256 - TH1)}$\n", "\n", "$TH1 = 256 - \\frac{K \\;\\times\\; OscillatorFreq}{32 \\;\\times\\; 12 \\;\\times\\; BaudRate}$\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | F (MHz) | \n", "K | \n", "TH1 | \n", "Baud | \n", "% Error | \n", "
---|---|---|---|---|---|
0 | \n", "1.843200 | \n", "2 | \n", "255 | \n", "9600.000000 | \n", "0.000000 | \n", "
1 | \n", "3.579545 | \n", "1 | \n", "255 | \n", "9321.731771 | \n", "-2.898627 | \n", "
2 | \n", "3.579545 | \n", "2 | \n", "254 | \n", "9321.731771 | \n", "-2.898627 | \n", "
3 | \n", "3.686400 | \n", "1 | \n", "255 | \n", "9600.000000 | \n", "0.000000 | \n", "
4 | \n", "3.686400 | \n", "2 | \n", "254 | \n", "9600.000000 | \n", "0.000000 | \n", "
5 | \n", "7.372800 | \n", "1 | \n", "254 | \n", "9600.000000 | \n", "0.000000 | \n", "
6 | \n", "7.372800 | \n", "2 | \n", "252 | \n", "9600.000000 | \n", "0.000000 | \n", "
7 | \n", "11.059200 | \n", "1 | \n", "253 | \n", "9600.000000 | \n", "0.000000 | \n", "
8 | \n", "11.059200 | \n", "2 | \n", "250 | \n", "9600.000000 | \n", "0.000000 | \n", "