Title Timer Design
Class Telecommunication 093
Student No. 090301334
Surname Zhou Jian
Time 2010.12.20
Achievements
Instructor Shi Qiaoyun
Catalog
I, Preface ........................... .............................. ...............1
Introduction to Microcontroller Applications ......... .............................. ..................1
II. Purpose and Requirements of Course Design ...... .............................. ............2
(i) Purpose of course design ............ .............................. ......... 2
(ii) Basic requirements for course design ............... .............................. 3
III. Overall Design ........................ .............................. ............3
(I) Working principle ............ .............................. .................. 3
(ii) Hardware overall design ...... .............................. .................. 4
(iii) Software overall design ...... .............................. .................. 5
IV. Integrated debugging ...... .............................. .............................. 7
(I) keil debugging ........................ .............................. ...... 8
(ii) Proteus debugging .................. .............................. ......... 9
V. Conclusion .................. .............................. ..................... 9
VI.References ... .............................. .............................. ...10
Preface
Introduction of the application of microcontroller
Microcontroller, also known as a single microcontroller, is not a chip that accomplishes a certain logical function, but rather integrates a computer system onto a single chip. To summarize: a chip becomes a computer. Its small size, light weight, inexpensive, for learning, application and development to provide a convenient condition. At the same time, learning to use a microcontroller is the best choice to understand the principles and structure of the computer.
Microcontroller refers to a complete computer system integrated on a chip. Although most of his functions are integrated in a small chip, but it has a complete computer needs most of the components: CPU, memory, internal and external bus system, most of the current will have external memory. At the same time integrated peripherals such as communication interfaces, timers, real-time clock. The most powerful microcontroller systems today can even integrate sound, graphics, networking, and complex input/output systems on a single chip.
At present, microcontrollers penetrate into all areas of our lives, and it is almost difficult to find any field without a trace of microcontrollers. Missile navigation devices, aircraft control of a variety of instruments, computer network communications and data transmission, industrial automation process of real-time control and data processing, the widespread use of a variety of intelligent IC cards, civilian limousine safety systems, video recorders, cameras, automatic washing machine control, and program-controlled toys, electronic pets, etc., these are inseparable from the microcontroller. Not to mention the automatic control field of robotics, intelligent meters, medical equipment. Therefore, the study, development and application of microcontroller will create a number of computer applications microcontroller applications
Microcontroller, also known as a single microcontroller, it is not the completion of a logical function of the chip, but a computer system integrated into a chip. To summarize: a chip becomes a computer. Its small size, light weight, inexpensive, for learning, application and development to provide a convenient condition. At the same time, learning to use a microcontroller is the best choice to understand the principles and structure of the computer.
Microcontroller refers to a complete computer system integrated on a chip. Although most of his functions are integrated in a small chip, but it has a complete computer needs most of the components: CPU, memory, internal and external bus system, most of the current will have external memory. At the same time integrated peripherals such as communication interfaces, timers, real-time clock. The most powerful microcontroller systems today can even integrate sound, graphics, networking, and complex input/output systems on a single chip.
At present, microcontrollers penetrate into all areas of our lives, and it is almost difficult to find any field without a trace of microcontrollers. Missile navigation devices, aircraft control of a variety of instruments, computer network communications and data transmission, industrial automation process of real-time control and data processing, the widespread use of a variety of intelligent IC cards, civilian limousine safety systems, video recorders, cameras, automatic washing machine control, and program-controlled toys, electronic pets, etc., these are inseparable from the microcontroller. Not to mention the automatic control field of robotics, intelligent meters, medical equipment. Therefore, the study, development and application of microcontroller will create a number of computers should
Intelligent control of scientists, engineers.
Scientists and engineers with intelligent control.
Microcontroller is widely used in instrumentation, household appliances, medical equipment, aerospace, special equipment, intelligent management and process control and other fields, can be roughly divided into the following categories:
(1) in the application of intelligent instrumentation
(2) in the application of industrial control
(3) in the application of household electrical appliances
(4) in the field of computer networks and communications
(5) microcontroller in the field of medical equipment
(6) in a variety of large-scale appliances in the modular application
In addition, the microcontroller in the industrial and commercial, financial, scientific research, education, national defense, aerospace and other fields have a very wide range of uses.
II. Purpose and requirements of the course design
(a) The purpose of the course design
1. To further familiarize with and master the structure and working principle of 8051 microcontroller.
2. Master the interface technology of the microcontroller and related peripheral chip external characteristics, control methods
3. Through the course design, master the core of the microcontroller circuit design of the basic methods and techniques, to understand the table off the circuit parameters of the calculation method.
4. Through the actual program design and debugging, and gradually master the modular program design methods and debugging techniques.
5. Through the completion of a complete process including circuit design and program development, so that students understand the whole process of developing a microcontroller application system for the future engaged in laying the foundation for the corresponding.
(ii) the basic requirements of the course design
with the AT89C51 microcontroller timing / counter T0 to generate a one-second timing time, as a second counting time, but a second is generated, the second count plus 1, the second count plus 60, automatically start from zero. Microcontroller crystal frequency of 12MHz.
Two, the overall design
(I) principle of operation
LED display structure and principle
1, structure type
Seven-segment LED displays (digital tubes) is a type of light-emitting devices. Commonly used LED light-emitting device has two types: digital tube and dot matrix. Digital tube inside the seven bar-shaped light-emitting diodes and a small dot light-emitting diode composition, according to the light and dark of the tube composed of characters. Common digital tube has 10 pins. The arrangement of the pins is shown in Figure (a) below. COM for the public **** end, according to the internal light-emitting diode wiring form can be divided into *** cathode and *** anode two. As shown in the following figure (b) (c), when in use, *** cathode digital tube public **** end ground, *** anode digital tube public **** end connected to the power supply. The LED requires a driving current of 5~10mA to emit light normally, and a current limiting resistor is generally required to control the current size.
2, display principle
LED digital tube a ~ g seven light-emitting diodes. Plus positive voltage light-emitting plus zero voltage can not be light-emitting, different combinations of light and dark can form different characters, this combination is called font code. *** anode and *** cathode font code is different, as shown below.
9 0 1 1 0 1 1 1 1 1 1 6FH 90H
(II) Hardware Overall Design
1. Selection of Main Components
The models and quantities of the main components selected are as follows:
1 AT89C51 (MCU) 1 CRYSTAL (crystal oscillator) 2 CAP (capacitor)
3 RES (resistors) 2 7SEG-COM-CATHOD (*** cathode digital tube)
1 CAP-ELEC (electrolytic capacitors)
2, the system board hardware connectivity
(1.) Put the "microcontroller system" in the area of P0.0/AD0 -P0.7/P0.7/P0.7/AD0. P0.7/AD7 ports in the "microcontroller system" area with 8-core wires connected to the "four-way static digital display module" in the region of any one of the a-h ports; Requirements: P0.0/AD0 corresponds to a, P0.1/AD1 corresponds to b, P0.1/AD1 corresponds to b, P0.1/AD1 corresponds to b, P0.1/AD1 corresponds to b, P0.1/AD1 corresponds to b. ......, P0.7/AD7 corresponds to h.
(2) Connect the ports P2.0/A8-P2.7/A15 in the area of "Microcontroller System" to the ports P2.0/A8-P2.7/A15 of "Quad Static Digital System" with an 8-core cable to the ports P2.0/A8-P2.7/A15 in the area of "Quad Static Digital System" with an 8-core cable. Connect the P2.0/A8-P2.7/A15 ports in the "Microcontroller System" area with 8-core wires to any one of the a-h ports in the "Quad Static Digital Display Module" area; Requirements: P2.0/A8 corresponds to a, P2.1/A9 corresponds to b, ......, and P2.7/A15 corresponds to h.
3. /p>
3. Timer electrical schematic diagram
(C) software overall design
1. Programming content
(1. During the design process we use a memory cell as a second counting unit, when a second comes, let the second counting unit add 1, when the second count reaches 60, it will automatically return to 0, from the new second count.
(2. For the data in the second counting unit to separate it from the number of digits and the number of digits, the method is still used to divide by 10 and balance by 10.
(3. Display on the digital, still done by looking up the table.
(4) the generation of a second of time here we use the software to accurately delay the method to complete, after accurate calculation to get 1 second time for 1.002 seconds.
2, delay 1 second subroutine
DELY1S: MOV R5,#100
D2: MOV R6,#20
D1: MOV R7,#248
DJNZ R7,$
DJNZ R6,D1
DJNZ R5,D2
RET
3、Program Flow Chart
4、Assembly Source Programming
Second EQU 30H
ORG 0
START: MOV Second,#00H ;Set the initial value of the display to 00
NEXT: MOV A,Second
MOV B,#10
DIV AB ;Ten digits are stored in A, single digits are stored in B
MOV DPTR,#TABLE ;Font code address is sent to DPTR
MOVC A,@A+DPTR ;Check the ten-digit font code
MOV P1,A ;Send to the P1 port for display
MOV A ,B
MOVC A,@A+DPTR ;Check digit font code
MOV P2,A ;Send to P2 port to display
LCALL DELY1S ;Call delay 1 second subroutine DELY1S
INC Second ;Display the value plus 1
MOV A,Second
MOV A,Second
LJMP START ;Return to main program
DELY1S: MOV R5,#100 ;1S delay subroutine
D2: MOV R6,#20
D1: MOV R7,#248
D1: MOV R7,#248
< p> DJNZ R7,$DJNZ R6,D1
DJNZ R5,D2
RET
TABLE: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH ;**** Negative Digitizer Font Code
END
Four, integrated debugging
(a) Keil debugging
Program debugging completed diagram
(b) Proteus debugging
Five, concluding remarks
Completion: after two weeks of hard work, we a group of members have finally completed the design of the stopwatch control program, mainly with the AT89C51 MCU to realize the 0-99 seconds timer control program. This design also contains a digital tube display part, can directly display the time can be convenient to observe. Through this course design, I got a comprehensive and systematic exercise to analyze and solve problems with professional knowledge and professional skills. So that I in the basic principles of microcontroller, microcontroller application system development process, as well as the idea of designing programs in assembly language skills and other aspects can be a big step forward, for the future to become a qualified application-oriented talents to lay a good foundation.
VI. References
[1]. Jiang Li, edited by Jiang Li, Microcontroller Principles and Application Technology, Tsinghua University Press, 6th printing, April 2008
[2]. Cai Jun, edited by Cai Jun, Microcontroller Experiment Guide Tutorial, Anhui University Press, First Printing, July 2008
[3].