Chapter 1: Overview of the course "Single Chip Microcomputer"
I have studied the course of "Single Chip Microcomputer" for one semester. During this semester's study, I didn't know much about programming at first, but gradually I can not only read programs, but also write programs. I'm really glad that I've studied hard for one semester.
How to learn MCU? I often see people say that they have been studying for months, but they just haven't made any progress. Of course, due to the difference of everyone's education level and personal understanding ability, the learning speed will also be different, but I think the most important thing is the learning method. A good learning method can make you get twice the result with half the effort. The following is my experience and method of learning single chip microcomputer.
I think that the first thing to learn a single-chip microcomputer is to understand C language, because most single-chip microcomputers are realized by programs, and it is difficult to learn a single-chip microcomputer well without knowing programs or programs. To learn MCU, we must first understand how a program works and fully understand the meaning of each step of the program. Secondly, to understand the meaning of each instruction, we should not blindly go to the backrest instruction. This is not reliable to remember, and the most important thing is to understand. The most important thing to learn single chip microcomputer is to have a comprehensive understanding of the internal structure of 89C5 1 chip. Only by understanding 89C5 1 can we know what functions and functions are realized by single chip microcomputer and have a deeper understanding of single chip microcomputer. Through a semester's study of the course "Single Chip Microcomputer", I also gained a lot of spiritual gains from it.
I have to share it with you.
Everything is difficult at the beginning, so take the first step bravely. At the beginning, don't always make excuses for yourself, don't say that the program of single chip microcomputer is all in English, you can't understand it. If you encounter difficulties, you should overcome them one by one. If you don't understand the instructions, you should study hard. If you don't know the program, you should learn it first. There are many online tutorials in this field. Just look around and do it a few times. Then you can refer to other people's programs It doesn't matter if you copy them. Write the simplest one, let it run, cultivate your feelings first, and know what it is like to write a program. Whether you write a big program or a small program, the process to be done will not be much worse. Then build a program, add it to the project, and then write the code, compile and run it. You must be familiar with this process. Personally, learning board is still necessary. Write a good program, run it and see the results. The learning effect will be much better. Simulator depends on individual needs. Single-chip microcomputer pays attention to theory and practice, and you can't learn without reading.
Knowledge points are only learned when they are used, and those that are not used are temporarily put aside. A thick book makes people dizzy. After learning the latter, the previous estimate is almost forgotten. Therefore, it is best to read it in combination with the actual program. Needless to say, you must read the book from the first page and write a program after reading it. For example, writing a running water lamp is completely unnecessary to read the knowledge of interruption. Just concentrate on learning running water lamp. This is to break the whole book into pieces and chew it bit by bit. Don't just read and write programs, you must write them yourself. At the beginning, if you don't know anything, you can copy other people's programs to see what each sentence is for, what purpose it achieves, and what consequences it will have after running. After you understand it, you have to write it yourself. You will find it easy to understand other people's programs, but you can't write a word when you write it yourself. This is the gap. When you can write it yourself, it means that you really understand.
You must learn how to debug the program. Many people write programs and codes.
Then running is not what I want, and I feel dizzy. Then I ran to the forum to publish the program and asked: Why can't my program run normally? Then wait for others to analyze it themselves. This is a very bad behavior. You should learn to find problems and learn how to solve them yourself. This requires learning the methods of debugging programs, such as breakpoints in KEIL and checking the contents of registers. These are all means of debugging programs. When you find that the running result of the program you wrote is different from your imagination, you can step by step, or break points, and then track and check the contents of relevant registers to see if there are any deviations during the running of the program, find out the places that affect the results and correct them. This process is very important. By debugging the program, you can learn knowledge that is not available in books.
Finding ideas to solve problems is more important than finding code. It is a topic that we use single chip microcomputer to control peripheral equipment to achieve our expected purpose, and how to write a program to control the equipment to run according to your desired results is the way to solve the problem. To write a program, you must first find a solution to the problem. It is more important for you to learn to find this solution than to find the code. Many people like to find other people's code, and some even copy the code directly into their own programs. It can be said that this is not a learning attitude and will not help you improve your programming level.
I hardly read other people's code. Most of the time, I look at other people's thoughts. It's better to have a block diagram, if not, a text description will do. It is difficult to see other people's thinking in dealing with problems from the code, especially for large programs, which seems very tiring. So now I understand that the program flow chart I said in my previous reading is very important, but now I know. When you know how to solve a problem, all that remains is that you arrange the code to complete it, which is no longer a problem.
Use your head and use various methods to constantly optimize your program. Think about different ways to achieve the same function. This is a process of practice and improvement. Once you solve a problem, then think about it. Can you write it in another way to achieve the same function? Or, can you simplify the code you write to make the program more efficient? This process is a progressive process. A lot of knowledge and experience can not be obtained by writing directly in books for you to read. You need practice and brains to accumulate experience and improve your programming level.
Watch other people's programs and understand their thoughts. This is very useful at the beginning of learning. By looking at other people's programs, especially those written by teachers with a certain level, you can quickly improve your programming level. At the same time, you can also combine other people's programming skills with your own ideas to write more advanced programs and make progress from them. But be careful not to turn learning into plagiarism, and don't think that learning after plagiarism will only make you go backwards.
Try to write a comprehensive application. Start with running the lamp, then scan dynamically, and then interrupt, and then try to write a comprehensive clock application. Do not underestimate the clock. Writing it well is not an easy task. It includes most knowledge of single chip microcomputer, such as key pressing (IO reading), dynamic scanning (IO output), interruption, etc. How to coordinate the normal work of each functional module is what programmers need to learn. When you write it alone, but mix it with other functions, how to make each part work normally in the whole program operation is not as easy as writing a key to read it, and the functional modules may affect each other. For example, you need to let the digital tube display and process the key reading. How to make these two parts work normally is a coordinated process. When you have this ability to deal with coordination, you begin.
Focus on developing problem-solving skills, not how many programs you write or what you do. "The focus of learning single chip microcomputer is to learn how to solve problems, not limited to specific chip types and languages" has always been my motto, which I realized after learning single chip microcomputer. The real ability is not how many realizable programs you have written, but: "When you encounter an unsolved problem, you can use what you have learned to find a solution to the problem quickly." This is the ability.
When facing a new program, use your own brain more, and don't rush to find someone else's program.
When many people face a new program, the first thing they think of is to find the program written by others on the Internet, then copy a paragraph, write a few more words by themselves, and complete the task together. Although this may save time, it is certainly not good for your study. When you receive a program, you should first conceive the architecture of the whole program and think about how to complete it. If possible, draw a flow chart, which can be simply drawn in your mind, make preliminary arrangements for the data and variables used in the program, and then write it yourself. If there is no way to solve it, ask your teacher or classmates, or see how others deal with it, so at least you have thought about it yourself and have your own ideas. If you watch other people's programs from the beginning, your thinking will be limited by other people's thinking, and it will be more difficult for you to innovate again, so you can never improve yourself because you are walking in the shadow of others.
Learn to ask questions. Generally speaking, most people will encounter problems during your study, so if you don't understand anything, you can ask the teacher. I think the most important thing in learning MCU is to ask more questions. For a program I don't know very well, I have to ask more questions, which will not only deepen my impression, but also learn a lot from other people's methods.
After studying the course of "Single Chip Microcomputer" for one semester, I not only learned a lot of programming knowledge, but also learned many useful learning methods for myself. Summing up my study this semester, I feel that I have made great progress in programming, and I know how to learn MCU programs with the correct learning method without memorizing instructions. Therefore, I think that learning should constantly sum up learning methods so as to make my study progress.
Traffic signal lamp design report
Experimental purpose: Use P 1 port and write a delay program.
Experimental requirements: at an intersection, it is divided into four directions: east, west, north and south, and the signals work in the following state order:
(1) The initial state is 0, and the red lights in the east, west, north and south directions are all on. Delay for a certain time;
(2) Status 1, the north-south green light is on, and the east-west red light is on, with a certain delay;
(3) State 2, the north-south green light flashes yellow several times, but the east-west light is still red, with a certain delay.
Time;
(4) State 3, the north-south red light and the east-west green light pass, with a certain delay;
(5) State 4, the north and south are still red, and the east and west green lights blink several times and turn yellow, with a certain delay.
Time;
(6) Cycle to state 1 and continue.
Experimental circuit and flow chart:
(1) hardware circuit
Traffic light training equipment consists of minimum system board and signal lamp.
2. Software programming
If the interval between the lights on and off at each intersection is 2s, the interval between the lights flashing is 0.5s Using the software delay method, when the crystal frequency is 12MHz, one machine cycle is 1us.
Traffic light programming:
Write the main program, use R7 as the counter of the main program, and determine that the call delay time is 0.5s, so as to get the switching time of the traffic lights.
Chapter two: learning summary of "single chip microcomputer"
How time flies! In the blink of an eye, a semester is over, and this semester's MCU course is over. But through this study of single-chip microcomputer, I not only deepened my understanding of single-chip microcomputer theory and applied it to practice well, but also learned how to cultivate our innovative spirit, so as to constantly overcome and surpass ourselves. Innovation can be improved on the original basis, so that its functions can be continuously improved and become something loyal to itself.
Nowadays, with the development of electronic technology, especially the appearance of large-scale integrated circuits, people's lives have undergone fundamental changes. If the appearance of microcomputer has made a qualitative leap in modern scientific research, then the appearance of programmable controller has brought a new revolution to the field of modern industrial control and measurement. In modern society, temperature control is not only applied to factory production, but also its function is reflected in all aspects. This semester, we studied the course of single chip microcomputer, which is a bit difficult. I don't know how the whole learning process came about, but time waits for no one.
When I first started studying, I knew nothing about single chip microcomputer. I didn't know what a single chip microcomputer was or what its function was. Through study, I have a general understanding of some knowledge of single chip microcomputer. Single-chip microcomputer is a microcomputer with a certain scale integrated on an integrated circuit chip. Abbreviation: single chip microcomputer or single chip microcomputer. The application of single-chip microcomputer can be seen everywhere, with a wide range of applications, mainly in intelligent instruments, real-time control, communication, household appliances and so on. Single chip microcomputer is formed by integrating CPU, RAM, ROM, I/O interface, timer/counter and serial communication interface on one chip. It has a wide range of applications, including data acquisition and measurement and control technology in industrial automation.
Intelligent instruments use digital oscilloscope, digital signal source and ATM. Among consumer electronic products, there are air conditioners, televisions, microwave ovens, mobile phones, ic cards, automotive electronic equipment and so on. Applications in communication include mobile phones and PHS. In terms of weapons and equipment, there are planes, tanks, missiles, space shuttles and intelligent weapons. At first, I could only copy other people's successful programs and write them over and over again. I can start simple and accumulate gradually. I can combine small programs into more complex programs step by step. But don't just look at other people's programs, you must write them yourself. Only when you can write it yourself can you really understand it. When I first came into contact with KEIL, it was really a headache. With KEIL, I can't build projects or use experimental boards. Then you can refer to the successful program, copy it, write the simplest one, and let it run. First, cultivate your own feelings, first build a project, then configure the project, then build a program, join the project, then write code, compile, generate HEX, brush it into the single chip microcomputer and run it. In fact, when you encounter a problem, you must try to solve it yourself. You can't ask others when you encounter problems. You must master the methods and ideas to solve it. When considering a new project, you must think more and don't rush to see what others write. You should first think about the framework of the program and how to complete it. Then write by yourself and clear your mind, so it's easier to improve yourself.
Anyone familiar with single-chip microcomputer knows that it is not easy to learn single-chip microcomputer well, not because it is difficult to learn single-chip microcomputer, but because it is difficult to find teaching materials specially written for beginners of single-chip microcomputer. Take a look at the teaching material of single chip microcomputer, which seems to be written for people who already know single chip microcomputer. Generally, the hardware structure and instruction system of single-chip microcomputer are introduced first, then the system expansion and peripheral equipment are introduced, and some application designs are mentioned by the way (by the way, the circuit design in many books is outdated, and some programs are still wrong). If you want to develop products according to this learning method, you must master all the knowledge before you can apply it to practice. Learning to use single-chip microcomputer can only be achieved by gradual accumulation. Although the single-chip microcomputer course only took a few classes before I went to work, I got some understanding in the process of learning. Here is a brief introduction to my learning process and experience of single chip microcomputer.
Learning single-chip microcomputer must first have a certain foundation: it must have the theoretical basis of digital circuits and analog circuits in electronic technology, especially digital circuits; Programming language needs assembly language or C language. If you want to be a master of single chip microcomputer, it is suggested that beginners learn assembly language first, and then turn to C language after learning almost. Although assembly language is a low-level language with low programming efficiency, compared with C language, it has the advantages of shorter object code, less memory occupation and faster execution speed. More importantly, it can make beginners familiar with the internal structure of single chip microcomputer as soon as possible and control it accurately. Single-chip microcomputer teaching materials will involve assembly language, so you don't need to buy teaching materials separately. C language is a knowledge, there are many professional books to explain it, and it is absolutely beneficial to our future programming career. Therefore, we should study deeply, and don't think that we have mastered the C language just because we have seen XXX's video tutorial, which is only a part of the C language. Here I'd like to recommend a reference book for programming in C language of single chip microcomputer. Ma Zhongmei is waiting. The C language application program design of single chip microcomputer published by Beihang University Press requires a C language foundation. If you haven't studied C language, I suggest learning C language programming written by Tsinghua University Tan Haoqiang. This book is well written and easy to understand.
Secondly, it is the choice of single chip microcomputer teaching materials. Single chip microcomputer is a technology that pays great attention to practice. You can't always read books, but to learn it, you should first read books and have a certain understanding and sensory understanding of the pins, internal structure, registers and principles of single chip microcomputer. How does it work and what can it do? At first, you may not understand it, but it doesn't matter because you still lack practical experience. Now the application of single-chip microcomputer is very extensive, so all manufacturers have introduced their own single-chip microcomputer, so we don't need to learn everything! Because their programming methods are similar to debugging process and internal instruction structure, just master one! Especially when programming in C language, there is almost no need to divide factions, but to choose a representative with wide knowledge, easy entry and many books. Generally speaking, MCS-5 1 series single-chip computers have been widely promoted and applied, and there are many materials and people on the market. I recommend some reference books to you. Only one book is enough to study. Application Design of New MCS-5 1 Single Chip Microcomputer, published by Harbin Institute of Technology, Zhang; Principle and Application of Single Chip Microcomputer, Higher Education Press, Zhang et al. Title: Advanced Course of Single Chip Microcomputer: Application and Design, Beijing University of Aeronautics and Astronautics Press, by He Limin. There are many related textbooks, so I won't list them here.
Then, it is the choice of development tools and development environment. Choosing the right learning board is usually unacceptable for beginners. If economic conditions permit, I am interested in single-chip microcomputer and have the intention to engage in related work. I encourage everyone to buy it. By the way, the learning board needs too many functions, such as running light, digital tube, independent keyboard, matrix keyboard, AD or DA, LCD, buzzer and so on. After all, the full-featured price is relatively high. Simulators are both familiar and unfamiliar to beginners of single chip microcomputer, mainly because the price of traditional simulators in the market is above 1000 yuan, which is a big expense for those who are not well off. At the same time, the simulator is used to improve the efficiency of program debugging, and it is not necessary. If you don't have an emulator, when you encounter a program error, you must think hard and write and debug it repeatedly.
Welcome to recommend the 5 1tracer emulator of Lin Xue Electronics Company. Interested friends can pay attention. Use the single-chip microcomputer tutorial board, read the instructions first, and be familiar with the learning board. It is beneficial to open this book. In the future, you should practice by yourself, connect the learning board with the computer, learn how to use the development software first, and then start with the simplest running water lamp experiment and control the running water lamp according to your own wishes. When you finish it, you will find how pleasant it is. It's so funny, you will feel that this is not studying, but playing. When you find that the single chip microcomputer can work according to the program you wrote, you will feel very excited and happier than doing anything, so you will gradually fall in love with the single chip microcomputer, really. Many websites say that after completing an experiment, they will tell you a compliment, "Congratulations, you have learned". This is a bit ridiculous, which only shows that you have passed the test, have a certain understanding of single chip microcomputer and can use it. However, there are too many functions that can be accomplished by single chip microcomputer, especially the control of peripheral equipment, which can design many unexpected products together. Therefore, in addition to getting started, never say it easily.
Finally, after mastering and applying it skillfully, it can be said that you have started to learn the hardware of single chip microcomputer, and the rest is to practice designing and developing various themes by yourself and accumulate experience continuously. In the end, you will completely design your own personal style theme and products, making you a master of single chip microcomputer. As long as you pass the first level, the road behind you will be much easier, and everything is difficult at the beginning. Everyone may have heard of it.
Sometimes the study of single-chip microcomputer is monotonous, and some knowledge is abstract and not easy to understand, so you can only adapt slowly. While learning theoretical knowledge, we can write programs and brush them into the single chip microcomputer for debugging. Only in this way can we learn MCU faster. I will strengthen my confidence in learning and make persistent efforts. I believe I can further deepen my understanding of single chip microcomputer and go further on the learning road of single chip microcomputer!
;