摘要:多種原因會促使我們把以前使用高速微控制器(DS80C310/DS80C320/DS80C323/DS8xC520)的8051設計升級到新的超高速閃存微控制器(DS89C430/DS89C450)。促使產品升級的原因是:更高的性能、增值服務和外設以及靈活的內部閃存存儲器。本應用筆記討論了兩個微控制器系列的重要差異,說明如何從高速升級到超高速器件。
通過同樣的方式,超高速閃存微控制器可以替換高速微控制器設計進行升級。這些功能更強大的新型微控制器包括DS89C430/DS89C450,重要改進包括:擴展了內部程序閃存存儲器(達到64kB),重新設計的超高速微控制器核工作在單時鐘周期指令,速度是早期8051設計的12倍。
本應用筆記討論如何從高速微控制器升級到超高速閃存器件,介紹在升級設計時必須考慮的函數集、引腳的變動以及SFR的差異。
表4. SFR功能區別
從DS80C310/DS80C320/DS80C323向DS89C430/DS89C450移植時,存儲在外部ROM、閃存或EPROM存儲器的應用程序可以重新放置到超高速處理器的內部閃存。DS89C430提供與DS89xC520相同的內部程序存儲器(16kB),存儲在DS8xC520中的所有應用程序都可以放入DS89C430,無需調整。對于外部程序存儲器的應用,可以將程序裝載到DS89C450的64kB內部閃存,只要沒有占用端口擴展64kB的程序存儲空間。
最后,由于DS89C430/DS89C450支持標準的8051復用地址總線,必要時,還可以使用外部程序存儲器。
DS89C430/DS89C450增加了串口裝載器,從而改進了編程過程。該功能容許程序存儲器通過一個簡單的基于ASCII的協議重新裝載程序。串口裝載器利用微控制器內部ROM實現,不會占用程序空間。另外,FCNTL和FDATA寄存器可以用于IAP,部分閃存可以在用戶控制下進行擦除和重寫。
但是,與P2和P3口不同,P0口采用漏極開路輸出驅動器。這意味著如果這些端口被用作輸出,它們必須接上拉電阻。如果P0口用作輸入(由外部驅動),則不需要上拉電阻。
概述
Maxim的高速微控制器系列包括多種不同的8051微控制器,與早期的8051每機器周期12個時鐘相比,它們可以達到每機器周期4個時鐘的更高速度。有些高速微控制器完全利用外部程序存儲器,比如DS80C310;有些控制器包含內部EPROM或ROM程序存儲器,比如DS87C520/DS83C520。這些高速器件都與現有的8051微控制器引腳兼容,所以在大部分情況下,更換一個快速器件并做很少的軟件調整,就可以很容易升級設計。通過同樣的方式,超高速閃存微控制器可以替換高速微控制器設計進行升級。這些功能更強大的新型微控制器包括DS89C430/DS89C450,重要改進包括:擴展了內部程序閃存存儲器(達到64kB),重新設計的超高速微控制器核工作在單時鐘周期指令,速度是早期8051設計的12倍。
本應用筆記討論如何從高速微控制器升級到超高速閃存器件,介紹在升級設計時必須考慮的函數集、引腳的變動以及SFR的差異。
通用參考文獻
下列器件的編程指南可以參考高速微控制器用戶指南(PDF,English only)。- DS80C310高速微控制器
- DS80C320高速低功耗微控制器
- DS80C323高速低功耗微控制器
- DS83C520高速ROM微控制器
- DS87C520高速EPROM微控制器
- DS89C430超高速閃存微控制器
- DS89C450超高速閃存微控制器
器件的基本功能
表1. 器件功能比較Feature | DS80C310 | DS80C320 DS80C323 |
DS87C520 DS83C520 |
DS89C430 DS89C450 |
Clocks per Machine Cycle | 4 | 4 | 4 | 1 |
Operating Voltage Range (V) | 4.5 to 5.5 | 4.25 to 5.5 (DS80C320) 2.7 to 5.5 (DS80C323) |
4.5 to 5.5 | 4.5 to 5.5 |
Clock Rate (MHz, max) | 33 | 33 (DS80C320) 18 (DS80C323) |
33 | 33 |
Instruction Execution Time (ns, min) | 121 | 121 (DS80C320) 222 (DS80C323) |
121 | 30 |
Crystal Multiplier | ? | ? | ? | √ (x2 or x4) |
Ring Oscillator | ? | √ | √ | √ |
Internal Program Memory | None | None | 16kB | 16kB (DS89C430) 64kB (DS89C450) |
Internal Register Memory (Bytes) | 256 | 256 | 256 | 256 |
Internal MOVX Memory | None | None | 1kB | 1kB |
Serial Ports (UARTs) | 1 | 2 | 2 | 2 |
External Interrupts | 6 | 6 | 6 | 6 |
Port Pins (with Bus Active) | 16 | 16 | 16 | 16 |
Port Pins (max) | 16 | 16 | 32 | 32 |
Timer/Counters | Three/16-bit | Three/16-bit | Three/16-bit | Three/16-bit |
Watchdog | ? | √ | √ | √ |
Dual Data Pointers | √ | √ | √ | √ |
Autoincrement/Decrement | ? | ? | ? | √ |
Stop Mode | √ | √ | √ | √ |
Power-On Reset | √ | √ | √ | √ |
Power-Fail Interrupt | ? | √ | √ | √ |
器件引腳排列
表2. 器件引腳的差異DIP | PLCC | TQFP | DS80C310 | DS80C320 DS80C323 |
DS87C520 DS83C520 |
DS89C430 DS89C450 |
1 | 2 | 40 | P1.0 (T2) | P1.0 (T2) | P1.0 (T2) | P1.0 (T2) |
2 | 3 | 41 | P1.1 (T2EX) | P1.1 (T2EX) | P1.1 (T2EX) | P1.1 (T2EX) |
3 | 4 | 42 | P1.2 | P1.2 (RXD1) | P1.2 (RXD1) | P1.2 (RXD1) |
4 | 5 | 43 | P1.3 | P1.3 (TXD1) | P1.3 (TXD1) | P1.3 (TXD1) |
5 | 6 | 44 | P1.4 (INT2) | P1.4 (INT2) | P1.4 (INT2) | P1.4 (INT2) |
6 | 7 | 1 | P1.5 (nINT3) | P1.5 (nINT3) | P1.5 (nINT3) | P1.5 (nINT3) |
7 | 8 | 2 | P1.6 (INT4) | P1.6 (INT4) | P1.6 (INT4) | P1.6 (INT4) |
8 | 9 | 3 | P1.7 (nINT5) | P1.7 (nINT5) | P1.7 (nINT5) | P1.7 (nINT5) |
9 | 10 | 4 | RST | RST | RST | RST |
10 | 11 | 5 | P3.0 (RXD0) | P3.0 (RXD0) | P3.0 (RXD0) | P3.0 (RXD0) |
11 | 13 | 7 | P3.1 (TXD0) | P3.1 (TXD0) | P3.1 (TXD0) | P3.1 (TXD0) |
12 | 14 | 8 | P3.2 (nINT0) | P3.2 (nINT0) | P3.2 (nINT0) | P3.2 (nINT0) |
13 | 15 | 9 | P3.3 (nINT1) | P3.3 (nINT1) | P3.3 (nINT1) | P3.3 (nINT1) |
14 | 16 | 10 | P3.4 (T0) | P3.4 (T0) | P3.4 (T0) | P3.4 (T0) |
15 | 17 | 11 | P3.5 (T1) | P3.5 (T1) | P3.5 (T1) | P3.5 (T1) |
16 | 18 | 12 | P3.6 (nWR) | P3.6 (nWR) | P3.6 (nWR) | P3.6 (nWR) |
17 | 19 | 13 | P3.7 (nRD) | P3.7 (nRD) | P3.7 (nRD) | P3.7 (nRD) |
18 | 20 | 14 | XTAL2 | XTAL2 | XTAL2 | XTAL2 |
19 | 21 | 15 | XTAL1 | XTAL1 | XTAL1 | XTAL1 |
20 | 22, 23 | 16, 17 | GND | GND | GND | GND |
– | 1 | 39 | GND | N/C (can be connected to GND if desired) | GND | GND |
21 | 24 | 18 | A8 (P2.0) | A8 (P2.0) | A8 (P2.0) | A8 (P2.0) |
22 | 25 | 19 | A9 (P2.1) | A9 (P2.1) | A9 (P2.1) | A9 (P2.1) |
23 | 26 | 20 | A10 (P2.2) | A10 (P2.2) | A10 (P2.2) | A10 (P2.2) |
24 | 27 | 21 | A11 (P2.3) | A11 (P2.3) | A11 (P2.3) | A11 (P2.3) |
25 | 28 | 22 | A12 (P2.4) | A12 (P2.4) | A12 (P2.4) | A12 (P2.4) |
26 | 29 | 23 | A13 (P2.5) | A13 (P2.5) | A13 (P2.5) | A13 (P2.5) |
27 | 30 | 24 | A14 (P2.6) | A14 (P2.6) | A14 (P2.6) | A14 (P2.6) |
28 | 31 | 25 | A15 (P2.7) | A15 (P2.7) | A15 (P2.7) | A15 (P2.7) |
29 | 32 | 26 | nPSEN | nPSEN | nPSEN | nPSEN |
30 | 33 | 27 | ALE | ALE | ALE | ALE/nPROG |
31 | 35 | 29 | nEA | nEA | nEA | nEA |
32 | 36 | 30 | AD7 | AD7 | AD7 (P0.7) | AD7 (P0.7) |
33 | 37 | 31 | AD6 | AD6 | AD6 (P0.6) | AD6 (P0.6) |
34 | 38 | 32 | AD5 | AD5 | AD5 (P0.5) | AD5 (P0.5) |
35 | 39 | 33 | AD4 | AD4 | AD4 (P0.4) | AD4 (P0.4) |
36 | 40 | 34 | AD3 | AD3 | AD3 (P0.3) | AD3 (P0.3) |
37 | 41 | 35 | AD2 | AD2 | AD2 (P0.2) | AD2 (P0.2) |
38 | 42 | 36 | AD1 | AD1 | AD1 (P0.1) | AD1 (P0.1) |
39 | 43 | 37 | AD0 | AD0 | AD0 (P0.0) | AD0 (P0.0) |
40 | 44 | 38 | VCC (+5V) | VCC +5V (DS80C320) VCC +3V (DS80C323) |
VCC (+5V) | VCC (+5V) |
– | 12 | 6 | N/C | N/C | N/C | VCC (+5V) |
– | 34 | 28 | N/C | N/C | N/C | GND |
器件寄存器
表3. SFR映射比較Address | DS80C310 | DS80C320 DS80C323 |
DS87C520 DS83C520 |
DS89C430 DS89C450 |
80h | – | – | P0 | P0 |
81h | SP | SP | SP | SP |
82h | DPL | DPL | DPL | DPL |
83h | DPH | DPH | DPH | DPH |
84h | DPL1 | DPL1 | DPL1 | DPL1 |
85h | DPH1 | DPH1 | DPH1 | DPH1 |
86h | DPS | DPS | DPS | DPS |
87h | PCON | PCON | PCON | PCON |
88h | TCON | TCON | TCON | TCON |
89h | TMOD | TMOD | TMOD | TMOD |
8Ah | TL0 | TL0 | TL0 | TL0 |
8Bh | TL1 | TL1 | TL1 | TL1 |
8Ch | TH0 | TH0 | TH0 | TH0 |
8Dh | TH1 | TH1 | TH1 | TH1 |
8Eh | CKCON | CKCON | CKCON | CKCON |
90h | P1 | P1 | P1 | P1 |
91h | EXIF | EXIF | EXIF | EXIF |
96h | – | – | – | CKMOD |
98h | SCON | SCON0 | SCON0 | SCON0 |
99h | SBUF | SBUF0 | SBUF0 | SBUF0 |
9Dh | – | – | – | ACON |
A0h | P2 | P2 | P2 | P2 |
A8h | IE | IE | IE | IE |
A9h | SADDR0 | SADDR0 | SADDR0 | SADDR0 |
AAh | – | SADDR1 | SADDR1 | SADDR1 |
B0h | P3 | P3 | P3 | P3 |
B1h | – | – | – | IP1 |
B8h | IP | IP | IP | IP0 |
B9h | SADEN0 | SADEN0 | SADEN0 | SADEN0 |
BAh | – | SADEN1 | SADEN1 | SADEN1 |
C0h | – | SCON1 | SCON1 | SCON1 |
C1h | – | SBUF1 | SBUF1 | SBUF1 |
C2h | – | – | ROMSIZE | ROMSIZE |
C4h | – | – | PMR | PMR |
C5h | STATUS | STATUS | STATUS | STATUS |
C7h | – | TA | TA | TA |
C8h | T2CON | T2CON | T2CON | T2CON |
C9h | T2MOD | T2MOD | T2MOD | T2MOD |
CAh | RCAP2L | RCAP2L | RCAP2L | RCAP2L |
CBh | RCAP2H | RCAP2H | RCAP2H | RCAP2H |
CCh | TL2 | TL2 | TL2 | TL2 |
CDh | TH2 | TH2 | TH2 | TH2 |
D0h | PSW | PSW | PSW | PSW |
D5h | – | – | – | FCNTL |
D6h | – | – | – | FDATA |
D8h | WDCON | WDCON | WDCON | WDCON |
E0h | ACC | ACC | ACC | ACC |
E8h | EIE | EIE | EIE | EIE |
F0h | B | B | B | B |
F1h | – | – | – | EIP1 |
F8h | EIP | EIP | EIP | EIP0 |
表4. SFR功能區別
SFR | Bit(s) | Differences |
P0 | – | DS8xC520/DS89C430/DS89C450 only; controls Port 0 pins. |
DPS | 4 (AID) | DS89C430/DS89C450 only; controls the autoincrement/decrement function for the active data pointer. |
5 (TSL) | DS89C430/DS89C450 only; enables automatic toggling between data pointers after certain opcodes. | |
6 (ID0) | DS89C430/DS89C450 only; controls the effect of INC DPTR (increment or decrement) on DPTR. | |
7 (ID1) | DS89C430/DS89C450 only; controls the effect of INC DPTR (increment or decrement) on DPTR1. | |
PCON | 4 (OFDE) | DS89C430/DS89C450 only; crystal oscillator fail detection enable. |
5 (OFDF) | DS89C430/DS89C450 only; crystal oscillator fail detection flag. | |
CKCON | 7 (WD1) 6 (WD0) |
On all devices except the DS80C310; these bits control the watchdog timer period. |
EXIF | 0 (BGS) | On all devices except the DS80C310; this bit enables/disables the bandgap reference during stop mode. |
1 (RGSL) | On all devices except the DS80C310; this bit controls execution from the ring oscillator during the crystal warmup period. | |
2 (RGMD) | On all devices except the DS80C310; this flag indicates the current clock source (ring or crystal). | |
3 | DS8xC520 (XT/nRG); selects the ring oscillator or crystal as the desired clock source. DS89C430/DS89C450 (CKRY); indicates that the crystal oscillator or crystal multiplier has completed its warmup period. | |
CKMOD | 3 (T0MH) | DS89C430/DS89C450 only; allows Timer 0 to run directly from the system clock (clock/1). |
4 (T1MH) | DS89C430/DS89C450 only; allows Timer 1 to run directly from the system clock (clock/1). | |
5 (T2MH) | DS89C430/DS89C450 only; allows Timer 2 to run directly from the system clock (clock/1). | |
ACON | 5 (PAGES0) 6 (PAGES1) |
DS89C430/DS89C450 only; selects the page-mode configuration for external bus operations. |
7 (PAGEE) | DS89C430/DS89C450 only; enables page mode (as opposed to the standard 8051 expanded bus mode) for external bus operations. | |
IE | 6 (ES1) | On all devices except the DS80C310; this bit enables/disables the serial port 1 interrupt. |
SADDR1 | – | On all devices except the DS80C310; this register controls the slave address for serial port 1. |
IP1 | – | DS89C430/DS89C450 only; this register combines with the settings in IP0/IP to provide four priority-level settings for each interrupt (as opposed to two settings with IP only). |
SADEN1 | – | On all devices except the DS80C310; this register sets the slave address mask for serial port 1. |
SCON1 | – | On all devices except the DS80C310; this register controls mode settings for serial port 1. |
SBUF1 | – | On all devices except the DS80C310; this register provides the input/output buffer for serial port 1. |
ROMSIZE | 2:0 (RMS2:0) | DS8xC520/DS89C430/DS89C450 only; selects the range of on-chip EPROM/flash that maps into program space. |
3 (PRAME) | DS89C430/DS89C450 only; enables/disables mapping of the 1kB internal RAM into program space. | |
PMR | 1:0 (DME1:0) | DS8xC520/DS89C430/DS89C450 only; controls mapping of internal data memory into data space. |
2 | DS8xC520 (ALEOFF); when set to 1, disables ALE during on-board memory access. DS89C430/DS89C450 (ALEON); when set to 0, disables ALE during on-board memory access. | |
3 | DS8xC520 (XTOFF); when set to 1, disables the crystal oscillator (must run from ring). DS89C430/DS89C450 (4X/n2X); sets the mode for the crystal multiplier. | |
4 (CTM) | DS89C430/DS89C450 only; when set to 1, enables the crystal multiplier. | |
5 (SWB) | DS8xC520/DS89C430/DS89C450 only; when set to 1, enables automatic switchback mode. | |
7:6 (CD1:0) | DS8xC520/DS89C430/DS89C450 only; controls the clock division or multiplier mode. Note that the available settings are different on the DS8xC520/DS89C430/DS89C450. | |
STATUS | 0 (SPRA0) | DS8xC520/DS89C430/DS89C450 only; indicates that a character is currently being received on serial port 0. |
1 (SPTA0) | DS8xC520/DS9C430/DS89C450 only; indicates that a character is currently being transmitted on serial port 0. | |
2 (SPRA1) | DS8xC520/DS89C430/DS89C450 only; indicates that a character is currently being received on serial port 1. | |
3 (SPTA0) | DS8xC520/DS89C430/DS89C450 only; indicates that a character is currently being transmitted on serial port 1. | |
4 (XTUP) | DS8xC520 only; indicates whether the crystal oscillator has completed its warmup cycle. | |
5 (LIP) | DS80C320/DS80C323/DS8xC520 only; indicates that a low-priority interrupt is currently being serviced. | |
6 (HIP) | DS80C320/DS80C323/DS8xC520 only; indicates that a high-priority interrupt is currently being serviced. | |
7 (PIP) | DS80C320/DS80C323/DS8xC520 only; indicates that a power-fail priority interrupt is currently being serviced. | |
7:5 (PIS2:0) | DS89C430/DS89C450 only; indicates that the priority level of the interrupt is being serviced. | |
TA | – | On all except the DS80C310; controls the Timed Access register protection mechanism. |
WDCON | 0 (RWT) | On all devices except the DS80C310; resets the watchdog timer. |
1 (EWT) | On all devices except the DS80C310; enables/disables the watchdog timer. | |
2 (WTRF) | On all devices except the DS80C310; indicates that a watchdog timer reset has occurred. | |
3 (WDIF) | On all devices except the DS80C310; indicates that a watchdog timer interrupt has occurred. | |
4 (PFI) | On all devices except the DS80C310; indicates that a power-fail interrupt has occurred. | |
5 (EPFI) | On all devices except the DS80C310; enables/disables the power-fail interrupt. | |
6 (POR) | On all devices; indicates that a power-on reset has occurred. | |
7 (SMOD_1) | On all devices except the DS80C310; enables/disables baud-rate doubling mode for serial port 1. | |
EIE | 4 (EWDI) | On all devices except the DS80C310; enables/disables interrupts from the watchdog timer. |
EIP | 3:0 (PX5:2) | On all devices except the DS89C430/DS89C450; sets high/low priority for external interrupts 2, 3, 4, and 5. |
4 (PWDI) | DS80C320/DS80C323/DS8xC520 only; sets high/low priority for the watchdog timer interrupt. | |
EIP1, EIP0 | – | DS89C430/DS89C450 only; these registers set priority levels 0–3 for the watchdog timer interrupt and external interrupts 2, 3, 4, and 5. |
單周期指令
超高速DS89C430/DS89C450處理器工作在單周期指令,執行一條指令只需一個時鐘周期,DS80C310/DS80C320/DS80C323/DS8xC520高速處理器需要四個時鐘周期完成一個機器周期,相比之下速度提高4倍。時鐘速度的不同意味著相同晶體頻率下,用DS89C430/DS89C450替代高速器件就將速度提升4倍。非易失存儲器
DS80C310/DS80C320/DS80C323沒有內部程序存儲器,需要外部存儲器存儲程序。DS8xC520改進了存儲器方案,包含16kB的程序EPROM。從DS80C310/DS80C320/DS80C323向DS89C430/DS89C450移植時,存儲在外部ROM、閃存或EPROM存儲器的應用程序可以重新放置到超高速處理器的內部閃存。DS89C430提供與DS89xC520相同的內部程序存儲器(16kB),存儲在DS8xC520中的所有應用程序都可以放入DS89C430,無需調整。對于外部程序存儲器的應用,可以將程序裝載到DS89C450的64kB內部閃存,只要沒有占用端口擴展64kB的程序存儲空間。
最后,由于DS89C430/DS89C450支持標準的8051復用地址總線,必要時,還可以使用外部程序存儲器。
串口裝載器
雖然DS8xC520包含內部EPROM程序存儲器,但不支持在系統或在應用編程(IAP)。必須用獨立的編程器裝載EPROM,而且DS8xC520重新編程時必須斷開(或電氣隔離)與系統其它電路的連接(但是,有可能在DS8xC520上設計一個用戶裝載器,以允許外部程序或數據EPROM或非易失RAM在系統控制下重新加載。更多信息請參考應用筆記102,"Using the High-Speed Microcontroller as a Bootstrap Loader")。DS89C430/DS89C450增加了串口裝載器,從而改進了編程過程。該功能容許程序存儲器通過一個簡單的基于ASCII的協議重新裝載程序。串口裝載器利用微控制器內部ROM實現,不會占用程序空間。另外,FCNTL和FDATA寄存器可以用于IAP,部分閃存可以在用戶控制下進行擦除和重寫。
GPIO端口0
由于DS89C430/DS89C450 (類似于DS8xC520)可以在沒有外部程序和數據存儲器的情況下工作,所以它們的8個P0口(復用總線有效時作為AD[7:0])可以用作通用I/O (GPIO)。不使用外部總線時,還有一些I/O引腳可以重新定義為通用I/O:8個P2口(P2[7:0])、P3.6 (nWR)和P3.7 (nRD)引腳。但是,與P2和P3口不同,P0口采用漏極開路輸出驅動器。這意味著如果這些端口被用作輸出,它們必須接上拉電阻。如果P0口用作輸入(由外部驅動),則不需要上拉電阻。
評論
查看更多