abstract: when using an 8051-based microcontroller, care must be taken in selecting an external clock reference to ensure that the timing requirements the controller's serial interface are met. typically, the 8051 serial port is used with an rs-232 transmitter/receiver to provide a serial communication link to another processor or host processor. the rs-232 specification has specific timing requirements, which must be met to guarantee communication to all other devices using this protocol. 8051-based processors generate their serial port timing using a combination of external timing reference (crystal or clock) and internal programmable divider chains. this application note demonstrates how the external clock requirements can be met using an econoscillator and provides calculation assistance in programming the 8051 internal serial port control registers.
introductioneconoscillators have an internal oscillator that provides a base frequency, and they use a built-in divider chain to lower a base frequency to the desired rate. each part number can divide down four base frequency rates (60mhz, 66.67mhz, 80mhz, or 100mhz) for adjustments up to 2052 times slower than the base part frequency. econoscillators can be used for any type of clocked logic, including microprocessor, fpga, and cpld circuits, depending on system requirements.
8051 microprocessors and rs-232 serial communicationwhen selecting a clock, two factors deserve careful consideration: clock rate and clock accuracy over the operational life span. in an 8051 microprocessor system, the use of rs-232 serial communications often determines the system clock rate. consider, for example, asynchronous mode 1 serial communication using a 12mhz clock (the maximum clock rate for the original 8051). table 1 shows the timer 1 auto reload values required to establish standard baud rates.
table 1. baud rate and baud rate error using a 12mhz crystal for an original 8051
timer 1 auto reload value
actual baud rate
(desired baud rate)
baud rate error
255
31250 (28800)
8.5%
254
15625 (14400)
8.5%
253
10417 (9600)
8.4%
249 / 250
4464 / 5208 (4800)
7% / 8.5%
243
2404 (2400)
0.16%
the actual baud rates in table 1 were calculated using the following formula (reproduced from dallas semiconductor's high-speed microcontroller user's guide):
the table numbers are based on these timer 1 conditions:
set to increment 12 clock cycles per timer (ds87c520 can increment timer 1 each 4 or 12 clock cycles)
auto reload mode enabled
baud rate doubler (smod=0) disabled. most users of rs-232 serial communication agree that any baud rate error over 3% is likely to cause communication errors, which occur in spite of synchronization of the start and stop bits during data transfer. a 3% allowable error limits the maximum communication rate with a 12mhz crystal to 2400 baud—not bad for the early 1990s, but a little slow for today's standards. luckily, there are crystals that cater to 8051 serial communications: either an 11.059mhz or 22.118mhz crystal. microprocessors using these crystals see a considerable improvement in baud rate (table 2), achieving data transfer rates up to 57.6 kbps (115.2 kbps with a ds87c520 using the baud rate doubler, smod=1), which is respectable for most of today's microprocessor systems.
table 2. baud rates generated using crystal frequencies selected for rs-232 serial
timer 1 auto-reload value
baud rate with
focc = 11.059mhz
baud rate with
focc = 22.118mhz
255
28.799.5
57598.9
254
14399.7
28799.5
253
9599.8
19199.6
250
4799.91
9599.83
244
2399.95
4799.91
232
1199.98
2399.95
208
599.98
1199.98
160
299.99
599.99
64
149.99
299.99
note:
requiring the baud rate to be within 3% of the specified rate also places an accuracy requirement upon your clock. even with an ideal clock rate selected for rs-232 communication, if the clock varies more than 3%, you may not be able to communicate consistently.
using the ds1077 econoscillator to clock an 8051 microprocessor the ds1077 comes in various base varieties, with the internal oscillators running at 133, 125, 120, 100, and 66.667mhz. using the internal divider chain to slow them down enough for an 8051 application, in theory any of these parts could be used. however, if you plan to use the serial port of your 8051, you should select the base part that best fits your microprocessor's needs, depending on both the baud rate required and baud rate generation formula provided with your microprocessor.
in the case of the 8051 microprocessor in our example, oscillator frequencies of 11.059mhz and 22.118mhz were desirable, and an approximately 3% error rate was tolerable for baud rate generation. if you use the 66.667mhz base part (ds1077-66), you would be able to divide the base frequency by six (6) down to 11.111mhz. this has a small error from the ideal frequency of 11.059mhz (0.47%), and the error remains acceptably low even with a worst-case deviation of 1.25% from the programmed frequency. thus, the ds1077-66 allows a maximum error of 1.72% from the desired frequency of 11.059mhz, which is adequate for communication at rates up to 28.8kbps.
if you are using an 8051 with a higher allowable clock rate such as the ds87c520 (33mhz maximum clock rate), you could simply divide the clock rate by three to 22.222mhz. the maximum error is still fine for communication at any of the 22.118mhz baud rates. the higher clock rate also provides a higher level of processor performance for your other application needs.
the big advantage in using the ds1077 for an 8051 design is flexibility. a design that started out using an original or equivalent 8051 microprocessor (12mhz maximum clock rate) can be simply upgraded by reprogramming the oscillator and replacing the microprocessor. depending on the design, you may even be able to reprogram the ds1077 in-socket. if you are using the 40-pin dip version of the 8051 microprocessor, maxim and many other companies make several 100% compatible replacement chips. the fastest of them all, maxim's ds89c430, offers a 50x performance increase over the original 8051 design, and has several resources available, including watch-dog timers and power management, that were not available on the original 8051. other chips, such as the ds87c520, can provide up to an 11x-performance increase. (maxim also makes other versions of the 8051 that have pwm and adcs for control applications, but they are not available in the 40-pin dip package.)
hardware setupto use the ds1077, you will need to establish a way to program its eeprom registers. once the ds1077 is programmed, the schematic shown in figure 1 shows how to wire the ds1077 for proper operation with an 8051 microprocessor. note that the output of the ds1077 goes into xtal1, and xtal2 is not connected. xtal2 is normally the crystal oscillator output of the 8051. connecting anything to this pin will just load the microprocessor down, which is not necessary when any auxiliary clocked device can be connected in parallel with the microprocessor on xtal1. (this is assuming that the joint loading of the auxiliary device and the 8051 does not exceed the output current specification of the ds1077.)
figure 1. hardware setup for using a ds1077 oscillator to clock an 8051 microprocessor.
econoscillator is a trademark of maxim integrated products, inc.
微功率AC-DC为智能家居提供电源动力
传感器的基本概念和特性详解
太阳辐射传感器的相关介绍
KUKA工具/基础管理窗口
cect是什么手机品牌
Using a EconOscillator to Cloc
MSPM0L1306开发板教程- NVM(FLASH)
OPPO Reno3 5G手机系列轻薄亮相,7.7mm+171g超薄体验
新唐在彩色显示应用解决了哪些问题
dfrobot12V168P 齿轮电机简介
交换机延时
网络安全威胁与日俱增,想要从根源上解决问题势必需要全球共建网络安全
PLC自动程序编程方法
中国移动启动5G二期工程设备集采
浅析楼宇BAS系统、BMS系统、IBMS系统之间联系与区别
联想发布首款自研工业机器人——“晨星”,专为国产大飞机制造而工作
敬老院环境的网络化智能监控系统设计
FPGA系统的集成式电源管理单元简化
3D建模服务三维扫描测量CAD画图服务
西门子变频器与S7-300/400 的PROFIBUS-DP通讯过程