1. Project Introduction
STC89C52RC is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of Flash program memory, 512 bytes of RAM data memory, and instruction code fully compatible with traditional 8051 microcontrollers. It is cheap, high-speed and reliable, low-power, and highly anti-interference. Therefore, we design a minimum system of STC89C52RC compatible with DIP-40 package, which can be applied to locking sockets, perforated boards and breadboards, which is convenient and practical, and easy for project development and verification.
2. Onboard resources
Figure 2-1 STC89C52RC core board resource diagram Main
control chip: STC89C52RC, LQFP-44;
Power interface: TYPE C, plug-in 2Pin;
LED: 1 power indicator, 1 status display light;
Button: 1 system reset button, 1 function button;
Debug interface: USB to TTL serial port burning method, 4Pin curved pin header;
External pins: lead out programmable IO port, 2 1×20Pin straight pin headers;
3. Advantages and features
Figure 3-1 STC89C52RC core board size diagram
The board is compact in appearance, with a size of only 53.34mm*22.86mm (2100mil*900mil);
compatible with STC89C52RC's DIP-40 package, suitable for locking seat, perforated board and breadboard;
cheap, ultra-low power consumption, rich functional pins, high cost performance;
use Jiali Chuang's high-quality PCB and genuine components to ensure product quality;
4. Circuit analysis
Figure 4-1 SCH_STC89C52RC minimum system
1. Power supply
circuit The power supply circuit is mainly composed of TYPE-C power supply circuit, using 2Pin TYPE-C interface, simple and convenient, easy to weld, C1/C2 is power supply filter capacitor.
Figure 4-2 TYPE-C power supply circuit
2. Main control circuit The main control
microcontroller uses STC89C52RC (LQFP-44 package), with an operating voltage of 3.3~5.5V and an operating frequency range of 0~40MHz, equivalent to 0~80MHz of ordinary 8051, and the actual operating frequency can reach 48MHz. The Flash program memory space size is 8K bytes, which can be erased and written more than 100,000 times. It integrates 512 bytes of RAM data memory on the chip, and the operating temperature range is -40~85℃.
Figure 4-3 STC89C52RC (LQFP-44 and DIP-40) pin definition diagram
STC89C51RC/RD+ series has HD and 90C versions, which can be identified by the last few letters in the bottom line of text on the surface of the microcontroller.
The HD version does not have P4.4/P4.5/P4.6 ports, the RESET pin has a 45~100K pull-down resistor inside, and the EA# pin is pulled up to VCC inside.
The 90C version does not have EA and PSEN pins, but has P4.4/P4.5/P4.6 ports. The ALE/P4.5 pin is used as the ALE pin by default. When used as the P4.5 port, it needs to be set in the STC-ISP programmer when burning the user program.
Figure 4-4 Pin function arrangement of STC89C52RC core board
Figure 1-1 Definition of STC89C52RC core board pins Explanation of reuse
Pin
description
P0.0~P0.7, P1.0~P1.7
P2.0~P2.7, P3.0~P3.7
P4.2~P4.6
Standard I/O port
RST
Reset pin
RXD
Serial port 1 data receiving end
TXD Serial
port 1 data transmitting end
T0/T1/T2
External input of timer/counter
T2EX
Trigger control of timer/counter 2 capture/reload mode
INT#
External interrupt, falling edge interrupt or low level interrupt
WR#
External data memory write pulse
RD#
External data memory read pulse
EA#
Internal and external memory selection pin
ALE
Address latch enable signal output pin/programming pulse input pin
PSEN#
External program memory selection signal output pin
All STC89C52RC pins are brought out to facilitate expansion of project development. The capacitor here is for filtering. When drawing the PCB, it should be placed as close to the chip pins as possible. The connection method of the main control circuit pins is shown in Figure 4-5.
Figure 4-5 STC89C52RC main control circuit
P0 port can be used as an I/O port or as an address/data multiplexing bus. P0 port is an open-drain output. When used as a bus extension, no pull-up resistor is required. When used as an I/O port, a 4.7K~10K pull-up resistor must be connected externally. Here, two 10K pull-up resistors are pulled up on the P0 port.
Figure 4-6 P0 port pull-up resistor
3. Crystal oscillator circuit
The function of the crystal oscillator is to provide a clock signal for the minimum system. The function of the capacitor next to the crystal oscillator is to ensure that the output oscillation frequency is more stable.
Figure 4-7 Crystal oscillator circuit
4. Reset circuit
Reset is also called restart. Press the SW1 button and the main control RST pin is pulled high; release the SW1 button and the RST pin is pulled low, generating an external reset pulse to reset the system.
Figure 4-8 Reset circuit
5.
When the peripheral circuit is powered on, the power indicator (red) lights up, proving that the power supply part of the minimum system is working properly. The test status display light (blue) is used to test the P4.3 pin of the microcontroller, and the test light is turned on and off through the program.
Figure 4-9 The LED indicator circuit
reserves a user function button, which can customize the button function and is connected to the microcontroller P4.2. It is used to test the blue light of P4.3.
Figure 4-10 The button circuit
adopts the USB to TTL serial port burning method, and reserves a 1x4Pin bent pin header interface for debugging and downloading programs.
Figure 4-11 The download circuit
is convenient for expanding projects and verifying various functions. It uses two 1x20Pin 2.54mm pin headers to lead out the I/O pins of the microcontroller, which is compatible with the pin arrangement of other mainstream microcontroller core boards.
Figure 4-12 External IO port
V. Bill of Materials
BOM_STC89C52RC Minimum System
Serial
Name
Parameter Device
Position Number
Quantity
Package
Item Number
1
Resistor
10kΩ
R1~R3
3
R0603
C99198
10kΩ
RN1,RN2
2
C107374
2
Resistor
10kΩ
RN1,RN2
2
R0603x4
C107374
3
Capacitor
10uF
C1,C3
2
C0603
C85713
100nF
C2,C4
2
C1591
22pF
C5,C6
2
C91701
4
LED
Red Light
LED1
1
LED0603
C72044
Blue Light
LED2
1
C72041
5
Button
PTS815SJK250SMTRLFS
SW1,SW2
2
KEY-SMD_4P
C918859
6
Crystal Oscillator
11.0592MHz
X1
1
HC-49US-2P
C258977
7
MCU
STC89C52RC
U1
1
LQFP-44
C8707
8
Pin
2.54mm 1x4P Bend
H1
1
HDR-TH_4P-P2.54
C2935929
2.54mm 1x20P Straight
H2,H3
2
HDR-TH_20P-P2.54
C429964
9
USB
TYPE-C-2Pin
USB1
1
TYPE-C-TH-2Pin
C2848624VI
. Matters Needing Attention
In drawing the schematic diagram, attention should be paid to:
drawing according to the module circuit division, indicating the circuit function;
filling in the project name and other information in the drawing attributes;
attention should be paid to purchasing materials:
first filter the materials in stock, then filter the price sorting for purchase;
try to purchase materials from the same warehouse, choose the warehouse close to shorten the delivery time;
when purchasing multiple orders, you can save shipping costs by binding orders;
in PCB Things to note in Layout:
The filter capacitor should pay attention to the direction of current flow and try to be closer to the component to be filtered;
the crystal oscillator should be as close to the chip as possible, and no routing should be done at the bottom to prevent signal crosstalk;
routing should be straight first, and obtuse angles or arcs should be used where turns are required;
after drawing and adjusting the PCB, add teardrops to make the board more beautiful and stable;
add silk screen logos and annotate the interface functions;
JLCJLCJLCJLC designated customer silk screen can be hidden under the device to make the board beautiful;
Figure 6-1-1 PCB routing reference diagram-top layer
Figure 6-1-2 PCB routing reference diagram-bottom layer
Things to note in welding:
When welding, you can click the welding auxiliary tool in the toolbar of Jiali Chuang EDA, and interact in real time to facilitate welding;
when welding the top layer, it is recommended to weld the main control chip first to avoid other devices affecting welding; when
welding the pin header, you can use an empty board or a perforated board to support it to prevent welding from slanting and affecting use;
the welding sequence should follow the principle of from low to high to avoid affecting the welding of small devices;
Figure 6-2-1 PCB empty board-top layer
Figure 6-2-2 PCB blank board - bottom surface
diagram 6-3-1 PCBA physical picture - top surface
diagram 6-3-2 PCBA physical picture - bottom surface
diagram 6-4 3D rendering diagram
Attention should be paid during debugging:
Before power-on debugging, check whether there are problems such as cold soldering and short circuit in the welding. Only after checking that there are no problems can the power-on test be carried out;
use STC-ISP to download the programming and burning software, the official download address is: http://www.stcmcudata.com/
Use the USB to TTL serial port burning tool to download the program to the microcontroller, and the RXD end of the USB to TTL line is connected to the TXD end of the microcontroller, and the TXD end is connected to the RXD end of the microcontroller;
after clicking download/programming, you need to re-plug VCC to power on, and it will show that the handshake operation is successful, that is, the user code is successfully downloaded.
Figure 6-5 STC89C52RC minimum system working diagram