STC89 series high performance single chip microcomputer and its application

Publisher:GoldenEclipseLatest update time:2012-03-14 Source: 微计算机信息 Keywords:MCS51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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;

Keywords:MCS51 Reference address:STC89 series high performance single chip microcomputer and its application

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

Multi-cycle Fully Synchronous Frequency Measurement Technology Based on Single Chip Microcomputer
Frequency measurement is a common problem in electronic measurement. How to improve the accuracy of frequency measurement is the key. Commonly used methods include low-frequency end measurement, high-frequency end measurement, and multi-cycle synchronous frequency measurement. When using low-frequency end measurement,
[Microcontroller]
Multi-cycle Fully Synchronous Frequency Measurement Technology Based on Single Chip Microcomputer
LED display program design for mcs-51 single chip microcomputer
Entry: Put the numbers to be displayed in the display buffer 60H-65H, a total of 6 units, and correspond to each digital tube LED0-LED5.  Exit: Convert the 6 numbers preset in the display buffer into corresponding display glyph codes, and then output them to the digital tube display for display.  The program of LED
[Microcontroller]
Application of DS1302 clock chip in single chip perpetual calendar
The production of perpetual calendar based on DS1302 clock chip Contains temperature sensor, temperature display Button operation, infrared remote control Perpetual calendar time power failure record 12864 LCD display shows perpetual calendar, etc. ------------------------------------------------- Five y
[Microcontroller]
Application of DS1302 clock chip in single chip perpetual calendar
Design of solar charging system based on C8051F920 microcontroller
In today's world of energy shortages and increasingly serious environmental pollution, how to effectively utilize clean solar energy is becoming an energy strategy for sustainable development in various countries. At present, most lighting equipment still uses traditional energy for lighting, so making full use of sol
[Microcontroller]
Design of solar charging system based on C8051F920 microcontroller
AVR MCU initial value calculation
Use chip AT Mega16 external crystal oscillator 4.00MHz Timer 1 (16-bit timer) Register TCCR1B = 0x04 Set 256 pre-division To use the timer for 1 second 1 , 4000000 / 256 = 15625 means the timer will trigger an interrupt every 1/15625 second 2, 65535 - 15625 = 49910 Calculate how many times to accumulate to trigger the
[Microcontroller]
Low frequency transceiver MCU interface solution based on TMS37157
TI's TMS37157 combines a low-frequency transceiver interface and an SPI interface with power management for a connected microcontroller. It is an ideal device for hardware configuration, data logging, and sensor remote control applications. The transceiver's memory can be accessed via SPI and LF, and can operate wit
[Microcontroller]
Low frequency transceiver MCU interface solution based on TMS37157
[51 MCU] EEPROM 24c02 [I2C code package-save to realize running light]
Here, EEPROM 24c02 is packaged and can be directly called in the future. Its connection method is: SDA-P2.1; SCL-P2.0; WP-VCC _ :i2c.c   1 /*-----------------------------------------------   2 Name: IIC Protocol    3 Content: The function uses software delay method to generate SCL pulse, so it is necessary to make
[Microcontroller]
Application of PIC microcontroller in automobile electric window controller
With the development of automotive electronic technology, more and more electronic products are installed in cars, which greatly improves the power and comfort of cars. At the same time, it also increases the difficulty and cost of wiring in the car. CAN (Controller Area Network) is a serial data communication bus.
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号