In the previous section, we explained why we wanted to do such a project, and we proposed requirements, and based on the specific requirements analysis, we converted them into hardware design and drew a specific schematic diagram. However, there are still many issues that have not been explained clearly, such as the pin determination of the digital tube. Which 8 of the 12 pins are the segment code of the digital tube? Which 4 are the bit code of the digital tube? We didn't know this when we just bought it, and we still need to measure it. This requires the use of a multimeter. Set the multimeter to the diode position. The diode has unidirectional conductivity. We know that the digital tube is composed of 8 small lights. If we buy a common anode digital tube, it is as shown in the following figure:
If we connect the red probe of the multimeter to any one of the 12 pins, and the black probe to any one of the remaining 11 pins, if the small light is on, it means that the pin of the red probe is the bit code of the digital tube, and we have four digital tubes, so there are 4 bit codes, which can be found by lighting the small light. After finding the bit code, write it down, and then we start to find the segment code of the digital tube one by one. The segment code of the digital tube is arranged in the order shown in the figure below:
The anodes of each small lamp are connected together, so it is called a common anode digital tube. DB0-DB7 are the cathodes of the 8 small lamps respectively. Has anyone noticed that there is no DB7? DB7 is a decimal point, which is generally not added in the schematic diagram.
Now that we have figured out the pin definition, we need to look at the data sheets of the relevant components and start drawing the package. Generally, the components need to be purchased and measured with a vernier caliper. Many components have data sheets provided by the manufacturer, which have package dimensions. We just need to draw one according to the data sheets. There are also some common packages.
Drawing components requires drawing software. Many people used 99SE in the past. I used this old software when I was in school. Many old engineers still use it. I am used to using AD13, which is more powerful. Of course, the installation file is relatively large and the computer requirements are relatively high. In fact, it is a tool. The one that suits you is good. Since this document mainly focuses on the study of single-chip microcomputers, as for the production of schematics and PCBs, as well as schematic packaging, PCB packaging, wiring, etc., a separate post will be opened in the future. This is not something that can be learned with a simple introduction, so this process is omitted here. If you need it, you can search for relevant tutorials to learn. Okay, the drawn PCB is shown in the figure below: DRC online check, after confirming that there are no errors, we can send it to the PCB manufacturer to make a sample. Post a PCB3D photo. If you want to make one, you can refer to the component layout diagram and component shape we provide, draw one by yourself, and practice.
It takes about 3-7 days to get the drawn PCB for proofing.
After getting the PCB, we start soldering. Of course, we don’t solder all the components, but test whether the PCB is defective or the packaging position of the components is correct. Because we haven’t programmed yet, if we find any problems in the process, we should correct them in time to avoid similar problems next time. We try to solder the LQFP32 microcontroller, which requires caution. Then solder the digital tube, current limiting resistor, voltage stabilizing chip components, etc. At this time, we can write a test program, which is downloaded through the reserved serial port. The function of the program is to light up all the digital tubes.
The difference between microcontroller and general programming is that microcontroller belongs to hardware programming. We know that LED0-LED3 are connected to P3.3, P3.4, P3.6, and P3.7 pins respectively, and DB0-DB7 are connected to P2 port.
OK, now that we know the hardware, we can use the KEIL4 compiler software to program in C language. Let's write a simple program to test that all digital tubes are fully lit: We use KEIL4 to create a new project and name it LED. How to create a new KEIL4 project and download and debug it is the content of the next post. Let's ignore it for now. The written program is as follows:
After compiling the program and downloading it to the target board, we can see that all the digital tubes are lit up. The actual hardware effect is as follows:
Although it achieved our intended purpose, this program is still imperfect.
Okay, this is the end of this post. In the next post, we will talk about how to create a new KEIL project and the steps to download and compile it.
Previous article:51 Single Chip Microcomputer (I)—— Introduction to 51 Single Chip Microcomputer
Next article:Microcontroller Learning Notes 10 Using thermistors to collect temperature
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Differences between JTAG, SBW, and BSL interfaces of MSP430 programmer emulator
- i.MX6ULL development board thread synchronization POSIX unnamed semaphore
- AD9 usage issues
- Introduction to the method of board-level online compilation and downloading of C6000 DSP code
- Should the PCB trace angle be 90°?
- How to draw this shape of 0.35x0.35
- [Construction Monitoring and Security System] 6. Kaluga's adc_button case combined with lvgl
- CCS5.5 compiles the project and always prompts an error, see the following figure
- Detailed explanation of stack pointer register SP
- FDS9721_LP3 chip usage