introduction
With the rapid development of electronic technology, the emergence of single-chip microcomputer technology has brought a new technological revolution to the field of modern industrial measurement and control. At present, single-chip microcomputers are widely used in many fields such as industrial control systems, data acquisition systems, intelligent instruments and meters, office automation, etc. due to their high reliability and high performance-price ratio. They have also entered households, washing machines, air conditioners, etc., and single-chip microcomputers can be seen everywhere.
Among the many members of the single-chip microcomputer family, the MCS51 series of single-chip microcomputers has quickly occupied the main market of industrial measurement and control and automation engineering applications with its superior performance, mature technology, high reliability and high performance-price ratio, and has become the mainstream in the field of domestic single-chip microcomputer applications. Major single-chip microcomputer manufacturers in the world have invested a lot of money and manpower in MCS51, and have derived many varieties around the 51 core to enhance the various functions of the 51 single-chip microcomputer. The MCS51 family is currently the fastest growing variety in the field of single-chip microcomputers.
What I want to recommend to you here is the cost-effective STC89 series microcontroller recently launched by STC.
Performance of STC89 series microcontrollers
The STC89 series MCU is a derivative product of the MCS-51 series MCU. They are fully compatible with the standard 8052 MCU in terms of instruction system, hardware structure and on-chip resources. The DIP40 package series is pin-to-pin compatible with the 8051. The STC89 series MCU is high-speed (maximum clock frequency 90MHz), low power consumption, in-system/in-application programmable (ISP, IAP), and does not occupy user resources. The following table is a list of STC89 series MCU resources.
model |
Maximum clock Frequency Hz |
Flash Memory |
RAM |
Serial UART |
Interrupt Sources |
Priority |
Data pointer |
Reduce EMI |
Low voltage reset |
Watchdog |
Double Speed |
P4 port |
SPI |
ISP |
IAP |
A/D |
|
5V |
3V |
||||||||||||||||
STC89C516 RD |
40M |
|
64K+8K |
1KB |
1ch+ |
8 |
4 |
2 |
ü |
ü |
ü |
ü |
|
|
ü |
ü |
|
STC89LV516 RD |
|
33M |
64K+8K |
1KB |
1ch+ |
8 |
4 |
2 |
ü |
ü |
ü |
ü |
|
|
ü |
ü |
|
STC89C8 RD |
40M |
|
64K+8K |
1KB |
1ch+ |
8 |
4 |
2 |
ü |
ü |
ü |
ü |
|
|
ü |
ü |
|
STC89LV8 RD |
|
33M |
64K+8K |
1KB |
1ch+ |
8 |
4 |
2 |
ü |
ü |
ü |
ü |
|
|
ü |
ü |
|
STC89C8RD2 |
40M |
|
64K+8K |
1KB |
1ch+ |
10 |
4 |
2 |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
|
STC89LV58RD2 |
|
33M |
64K+8K |
1KB |
1ch+ |
10 |
4 |
2 |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
|
STC89C54RD2 |
40M |
|
64K+8K |
1KB |
1ch+ |
10 |
4 |
2 |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
|
STC89LV54RD2 |
|
33M |
64K+8K |
1KB |
1ch+ |
10 |
4 |
2 |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
|
STC89C52RD2 |
40M |
|
64K+8K |
1KB |
1ch+ |
10 |
4 |
2 |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
|
STC89LV52RD2 |
|
33M |
64K+8K |
1KB |
1ch+ |
10 |
4 |
2 |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
ü |
|
STC89C51 |
40M |
|
64K+8K |
128 |
1ch |
8 |
2 |
1 |
ü |
|
|
|
|
|
|
|
|
STC89C516RD |
2.4-3.6V,45/90M |
64K+8K |
512 |
1ch+ |
8 |
4 |
2 |
ü |
|
ü |
ü |
|
|
ü |
|
ü |
Key Features:
u 80C51 core processor unit;
u 3V/5V operating voltage, operating frequency 0~33MHz (STC89LE516AD can reach up to 90MHz); 5V operating voltage, operating frequency 0~40MHz;
u Large capacity internal data RAM: 1K bytes RAM;
u 64/32/16/8kB on-chip Flash program memory, with In-Application Programmable (IAP) and In-System Programmable (ISP), enabling remote software upgrades without a programmer;
u Support 12-clock (default) or 6-clock mode;
u Dual DPTR data pointer;
u SPI (Serial Peripheral Interface) and enhanced UART;
u PCA (Programmable Counter Array), with PWM capture/compare function;
u 4 8-bit I/O ports, including 3 high-current P1 ports, which can directly drive LEDs;
u 3 16-bit timers/counters;
u Programmable watchdog timer (WDT);
u Low EMI mode (ALE disabled);
u Compatible with TTL and COMS logic levels;
u Power-off detection and low power mode, etc. [page]
The following mainly introduces the features of the STC89 series of microcontrollers and things that need attention.
1. 1k bit on-chip RAM (data memory)
The common 8051 series single chip and on-chip RAM are only 128 (8051) or 256 (8052) bytes.
1. The lower 128 bytes (address: 00H~7FH) can be addressed directly or indirectly;
2. The upper 128 bytes (address: 80H~FFH) can only be addressed indirectly;
The STC89 series of MCUs have an additional 768 bytes of on-chip extended RAM to solve the problem of severe lack of RAM resources for many technicians when programming.
The 768-byte on-chip extended RAM (address: 000H~2FFH) overlaps with the external extended RAM address. The microcontroller can set AUXR.1 through software to decide whether to use the on-chip extended RAM to prevent possible conflicts with the external extended RAM. The default is to use the on-chip extended RAM.
The on-chip extended RAM is accessed using indirect addressing.
①, MOVX A, @DPTR or MOVX @DPTR , A instruction accesses the on-chip extended RAM (00H~2FFH, a total of 768 bytes);
②、MOVX A,@Ri or MOVX @Ri,A instruction accesses the on-chip extended RAM (00H~FFH, 256 bytes in total).
When DPTR≥300H, the system accesses the external expansion RAM.
Note: When using the second instruction, pay special attention to whether to use MOV or MOVX. MOV accesses the on-chip RAM, and MOVX accesses the on-chip extended RAM. Technicians who have just come into contact with this type of microcontroller are most likely to make mistakes here.
2. 64/32/16/8K on-chip Flash (program memory) and ISP function
STC89 series MCUs have 64/32/16/8K on-chip Flash, divided into two Flash storage blocks: Block0 and Block1. Physically, Block0 is in front and Block1 is in the back. The Flash block can be relocated through the REMAP function. The following figure shows the program memory structure of STC89C58
Users who have used SST89 series MCU should pay attention to the differences from STC89:
①, Block1 size is different;
②, Block sector sizes are different;
③. Differences between instructions and SFRs.
STC89 has two configuration bits, SC0 and SC1, which control whether the program starts from Block0 or Block1 after power-on reset/external reset.
①For STC89C58, SC0 and SC1 work at the same time:
SC1, SC0=0, 0 The program is started from Block0;
SC1, SC0 = 1, 1 The program is started from Block1. At this time, Block1 is physically in the last 8K (E000H ~ FFFFH) and logically imaged to the first 8K (0000H ~ 1FFFH). The first 8K of Block0 is not visible to the PC pointer.
②For STC89C16, only SC0 works:
SC0=0 The program is started from Block0;
SC0=1 The program is started from Block1. At this time, Block1 is logically imaged to the first 8K (0000H~1FFFH), overwriting the first 8K unit of Block0.
model |
Block0 address space |
Block1 first 4k address |
4k address after Block1 |
STC89C52RD2/89LV52RD2 |
0000 - 1FFFH |
E000 - EFFFH |
F000 - FFFFH |
STC89C54RD2/89LV54RD2 |
0000 - 3FFFH |
E000 - EFFFH |
F000 - FFFFH |
STC89C58RD2/89LV58RD2 |
0000 – 7FFFH |
E000 - EFFFH |
F000 - FFFFH |
STC89C58RD/89LV58RD |
0000 – 7FFFH |
E000 - EFFFH |
F000 - FFFFH |
STC89C516RD/89LV516RD |
0000 - FFFFH |
0000 – 0FFFH |
1000 – 1FFFH |
Technicians who have just come into contact with the STC89 series of microcontrollers may not understand its REMAP function. By understanding ISP, they will understand the role of REMAP.
ISP is mainly used for online (or remote) upgrades. It rewrites the user program by executing the ISP boot code, without the need for a programmer or on-site presence. When the STC89 series microcontrollers leave the factory, the ISP boot code has been burned into the chip, occupying the first 2K bytes of the program space of Block1 and set to start from Block1. When starting, the ISP boot code is first executed to confirm whether it is a program download or a normal startup. Regardless of whether it is a program download or a normal startup, the ISP boot code will always cancel REMAP at the end, restore the address space of Block0 in the first 8K, and then execute the user program in Block0, that is, the user program is always placed in the unit starting from 00H of Block0, unless the user modifies the ISP boot code by himself. [page]
3. STC89 series MCU IAP technology
The IAP function is programmable in the application. By using this function, a microcontroller that does not have EEPROM can have the function equivalent to EEPROM, and the storage space is much larger than EEPROM. IAP cannot program the block in which it is located, that is, when the program runs in Block0, Block1 can be programmed; when the program runs in Block1, Block0 can be programmed. Based on this feature, the size of the Flash programmed in the application can be set through the REMAP function. For STV89C58,
①. When the program runs in Block 0, it can have 6~8k Flash EEPROM (general use);
② When the program runs in Block 1, it can have nearly 32k Flash EEPROM (requires skills or changes to the ISP boot code);
Tips: For users who want to use 32K Flash EEPROM but do not want to change the ISP boot code, you can design the program like this: at the beginning of the user program, use the REMAP function to image Block1 to the first 8K, and burn the program after the image instruction into Block1. Program flow positioning: Block1 (ISP boot code) à Block0 (user program REMAP part) à Block1 (user program)
To use the IAP function, you must enable the IAP function. Bit 6 of the STC89 super flash configuration memory SFCF is used to turn the IAP function on and off, 0 is off, 1 is on, and it is off by default when the program starts.
The SFRs involved in the IAP function are:
SFCF DATA 0B1H; Super Flash configuration memory
SFCM DATA 0B2H ; Super Flash command memory
SFAL DATA 0B3H ; Super Flash address low byte memory
SFAH DATA 0B4H ; Super Flash address high byte memory
SFDT DATA 0B5H; Super Flash data memory
SFST DATA 0B6H ; Super Flash status memory
(I) The main functions of IAP are:
(1) Chip erase. Command format:
ORL SFCF, #040H; Start IAP
MOV SFDT, #55H
MOV SFCM, #01H; write command word
; Query SFST.2 and wait for the chip to be erased.
(2) Block erase. Command format:
ORL SFCF, #040H; Start IAP
MOV SFAH, #0F0H/#00H; wipe block0/block1
MOV SFDT, #55H
MOV SFCM, #0DH; write command word
; Query SFST.2 and wait for the chip to be erased.
(3) Sector erase. Command format:
ORL SFCF, #040H; Start IAP
MOV SFAH, segment address high byte
MOV SFAL, segment address low byte
MOV SFCM, #0BH; write command word
; Query SFST.2 and wait for the chip to be erased.
(4) Byte programming. Command format:
ORL SFCF, #040H; Start IAP
MOV SFAH, to program the high byte of the address
MOV SFAL, to program the low byte of the address
MOV SFDT, data to be programmed
MOV SFCM, #0EH; write command word
; Query SFST.2 and wait for the chip to be erased.
(5) Byte check. Command format:
ORL SFCF, #040H; Start IAP
MOV SFAH, the address high byte of the data to be verified
MOV SFAH, the low byte of the address of the data to be verified
MOV SFCM, #0CH; write command word
NOP
MOV A, SFDT; A saves the content read from the specified unit address [page]
(II) Note when using IAP:
1. Please use ORL instruction to start IAP, and try not to use MOV instruction, otherwise (especially for the first time to use this microcontroller) and it is easy to cause system software reset, program memory REMAP, etc.;
2. When reading data programmed by IAP, please use the byte check instruction and avoid using the MOVC instruction. The MOVC instruction cannot read the correct value in many cases in IAP (especially where there is address overlap);
3. Don’t forget to turn on the IAP function during IAP programming (also required when reading data).
(III) Purpose of IAP function:
①. Through the IAP function, you can do MCU experiments without a programmer. This is very convenient for people who are learning MCU for the first time, especially for the teaching of MCU in schools. It is a MCU development method with the lowest cost.
②. The software of the product can be upgraded. No external monitoring chip is needed. The product upgrade software in the PC can be downloaded to the product through the serial port to achieve product software upgrade. In your own laboratory, you can upgrade the software of the remote product through the modem. This will be the inevitable trend of electronic products in the future.
③. You can also modify product parameters online. It can realize online storage of on-site historical data, curve parameter correction and other functions. It is suitable for some application products that need to change data frequently (such as meters, access control systems and products that need to be upgraded, etc.) and products that need to change equipment parameters remotely (remote control equipment, etc.).
4. Programmable Counter Array
The 8051 microcontroller has two timers/counters on the chip, while the 8052 has three, which meet the general needs of supporters, but are slightly resource-constrained in some special occasions. The STC89 additionally provides a programmable counter array (PCA) that can work independently without the participation of the CPU.
The STC89 Programmable Counter Array (PCA) is a 16-bit timer with five 16-bit capture/compare modules, each of which can have the following modes:
n Rising edge and/or falling edge capture;
n Software timer;
n High-speed output;
n Watchdog timer (module 4 only);
Pulse Width Modulator (PWM)
The clock to the programmable counter array can be selected as follows:
Programmable Counter Arrays provide more timing functions than ordinary timer/counters with little CPU overhead. Its advantages include reduced software overhead and improved accuracy.
PCA can provide the functions provided by T0, T1, and T2 timers except baud rate generator.
The PCA capture function can capture both the rising and falling edges of the input pulse, which is very suitable for detecting pulse width and frequency. It performs very well when software decoding PT2262, saving a lot of CPU management time.
Because of the rising edge capture function, PCA can also be used as a rising edge interrupt to make up for the defect that 8052 only has falling edge interrupts. In 8052, sometimes you have to add an inverter to meet the requirements of MCS51.
The PWM function can be used to control the motor speed, etc.
5. Reset Circuit
STC89 adds multiple reset functions based on 8051 to improve the anti-interference ability of the microcontroller.
1. Power-on reset: basically similar to 8051, but with an additional function, that is, the software can be programmed to output 32 reset pulses from the REST pin during reset to reset external devices, ensure the synchronization of external devices, and save external reset circuits;
2. Software reset: 8051 does not have a software reset function. Technicians generally need to set more SFR values by themselves to simulate software reset. STC89 only needs to change one bit state to complete software reset, reducing software overhead.
3. Undervoltage detection and reset
8051 does not have undervoltage detection function. When encountering undervoltage, the microcontroller cannot work normally, the port status is uncertain, and it is very easy to cause damage to peripheral devices. STC89's undervoltage detection and reset can avoid such incidents to a certain extent. STC89 generates an interrupt notification or a reset signal when it detects an undervoltage condition to reset the microcontroller. Undervoltage interrupt notification is a very practical function. Since there is still some time from power failure notification to power failure, it allows the program to save the necessary parameters in time when the power is about to fail, avoiding unnecessary losses.
Conclusion
The advantages of STC89 cannot be explained in a few words. For more information, please refer to the STC89 data sheet.
STC89 adds many functions based on 8051, greatly improving the performance of MCS51 family. STC89 is designed in the United States and produced in Taiwan. It is currently the most affordable product under the same performance conditions. The high performance and low price of STC89 will definitely bring considerable technical and economic benefits to technicians using MCS51 family products. Of course, for a new product, its new features, new functions and reliability still need to be practiced and explored.
Reference: 1. STC89C51 DATASHEET;
2. STC89 series microcontroller user guide;
Previous article:Design of intelligent street lamp energy-saving device based on single chip microcomputer control
Next article:Variable speed temperature control system based on 8051
Recommended ReadingLatest update time:2024-11-16 18:05
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Development and application based on NUCLEO-F746ZG motor] 2. Based on SDK5.4.5-project construction
- [Live Preview] The old hands of the electronics competition say | The second live broadcast of Puyuan Jingdian's electronics competition coaching
- What is "j" in the resultant vector formula of three-phase symmetrical sinusoidal current?
- Understand millimeter wave in 7 minutes - the new weapon of 5G
- Linux Network Programming-How does a TCP client obtain the server IP to connect to?
- The Difference Between Oscilloscope Channel Coupling and Trigger Coupling
- Official Pioneer Tips: Unlocking the 400Mhz GPIO Flip Frequency of the HPM6700 Series
- Why are three-layer PCBs rarely seen?
- I was badly hurt by "RZ7888"!!!
- I feel good today