Design your own single-chip minimum system

Publisher:qin199099Latest update time:2018-01-05 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Determine the task
and develop the minimum system of the single-chip microcomputer
. 2. Task analysis:
The functions of this system:
(1) It has a 2-digit LED digital tube display function.
(2) It has eight-way light-emitting diodes to display various running lights.
(3) It can complete various sound-generating experiments such as playing music and alarming.
(4) It has a reset function.
3. Functional analysis
(1) For the two-digit LED digital tube display function, we can use the P0 port of the single-chip microcomputer to connect two digital tubes to realize this function;
(2) For the eight-way light -emitting diode display, we can use the P1 port to connect eight light-emitting diodes to realize this function;
(3) Various sound-generating functions such as playing music and alarming can be realized by connecting a buzzer to the P2.0 pin.
(4) The 9th pin of the single-chip microcomputer can be designed as a reset system, and we use a button reset; the 18th and 19th pins of the single-chip microcomputer can be designed as a clock circuit , and we use the internal oscillation method of the single-chip microcomputer to design it.
4. Design block diagram

Electronic Production World--Microcontroller Minimum System


 
5. Hardware circuit design
Based on the functions of this system and the working conditions of the microcontroller, we designed the following circuit diagram.
 

Electronic Production World--Microcontroller Minimum System Circuit Diagram


6. Determination of the component list:
Digital tube: 2 common cathodes (discrete)
Electrolytic capacitors : 10UF 2
30PF capacitors 9
220 ohm resistors 1
4.7K resistor 1 1.2K resistor
1 4.7K
resistor 1
12M Hz crystal oscillator 1
active 5V buzzer 1
AT89S51 microcontroller 1 normally
open button switch 1
locking socket (easy to remove the core, green)
8 LEDs (5MM red)
15*17CM universal board circuit board
S8550 transistor 1
4.5V battery box, several wires.
7. Soldering
of the hardware circuit Solder the above components according to the schematic diagram, and the detailed steps are omitted.
8. Related program writing
According to the above circuit schematic diagram, design the detailed functions of this system:
(1) The first LED lights up and the digital tube displays "1".
(2) The second LED lights up and the digital tube displays "2".
(3) The eighth LED lights up and the digital tube displays "8".
The above is the effect of a running light .
(4) All the LEDs go out and the digital tube displays "0".
(5) The digital tube displays "1". (
6) The digital tube displays "2, ..." until "9, A, B, C, D, E, F, Y".
(7) After the buzzer sounds nine alarms, repeat all the above steps. (8)
The program is as follows:
ORG 0000H; pseudo-instruction, define the following program code (machine code) to be stored in the unit with address 0000H.
LJMP START; jump to the place marked START for execution.
ORG 0030H; pseudo-instruction, define the following program code (machine code) to be stored in the unit with address 0030H.
START:MOV P1,#0FEH; light up the first LED.
CLR P2.7; send a low level to the first digital tube to turn on the digital tube.
CLR P2.6; send low level to the second digital tube, turn on the digital tube.
MOV P0,#06H; let the digital tube display "1".
LCALL DELAY; call the delay subroutine to achieve the purpose of delay.
MOV P1,#0FDH; light up the second LED.
MOV P0,#5bH; let the digital tube display "2".
LCALL DELAY; call the delay subroutine to achieve the purpose of delay.
MOV P1,#0FBH; light up the third LED.
MOV P0,#4fH; let the digital tube display "3".
LCALL DELAY; call the delay subroutine to achieve the purpose of delay.
MOV P1,#0F7H; light up the fourth LED.
MOV P0,#66H; let the digital tube display "4".
LCALL DELAY; call the delay subroutine to achieve the purpose of delay.
MOV P1,#0EFH; light up the fifth LED.
MOV P0,#6dH; Let the digital tube display "5".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P1,#0DFH; Light up the sixth LED.
MOV P0,#7dH; Let the digital tube display "6".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P1,#0BFH; Light up the seventh LED.
MOV P0,#07H; Let the digital tube display "7".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P1,#7FH; Light up the eighth LED.
MOV P0,#7fH; Let the digital tube display "8".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P1,#00H; Turn off all the LEDs.
MOV P0,#3FH; Let the digital tube display "0".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P0,#06H; Let the digital tube display "1".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P0,#5bH; Let the digital tube display "2".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P0,#4fH; Let the digital tube display "3".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P0,#66H; Let the digital tube display "4".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P0,#6dH; Let the digital tube display "5".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P0,#7dH; Let the digital tube display "6".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P0,#07H; Let the digital tube display "7".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P0,#7fH; Let the digital tube display "8".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV P0,#6fH; Let the digital tube display "9".
LCALL DELAY; Call the delay subroutine to achieve the purpose of delay.
MOV R4, #9; send the alarm count to the buzzer.
LOOP: SETB P2.0; no sound
LCALL DELAY; call the delay subroutine to achieve the purpose of delay.
CLR P2.0; sound.
LCALL DELAY; call the delay subroutine to achieve the purpose of delay.
DJNZ R4, LOOP; execute downward after sounding nine times.
SETB P2.0; turn off the sound
LJMP START; jump to the label START to execute and loop this program.
DELAY: MOV R7, #200; this is the delay subroutine.
D1: MOV R6, #200
D2: MOV R5, #200
D3: DJNZ R5, D3
DJNZ R6, D2
DJNZ R7, D1
RET; return instruction of the delay subroutine.
END; end pseudo instruction.
9. Use KEIL C51 software to debug and compile the above program to generate *.HEX files so that they can be written into the microcontroller chip using a programmer.
10. Use of the programmer: Use the programmer to write the *.HEX files generated in the computer into the chip.
11. Product debugging: Connect a 4.5V (three-cell battery) power supply to debug the system. If there are no errors, it can work normally.


Reference address:Design your own single-chip minimum system

Previous article:Method of directly driving LED digital tube by 51 MCU IO port
Next article:Design of low-cost ECG monitoring system based on 51 single-chip microcomputer

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号