Compared with traditional types of single-chip microcomputers, AVR has made great improvements in structural system, functional components, performance and reliability in addition to realizing some basic functions in IC chip decryption technology.
However, using better devices only creates a good foundation and possibility for designing and implementing a good system. If you still use and follow the traditional hardware and software design ideas and methods, you cannot make good use of AVR, and you cannot even truly understand the characteristics and strengths of AVR.
The better the function of the device, the more people with higher skills and abilities are needed to use and drive it. IC chip decryption is like a good F1 racing car. Only a driver with superb skills can fully appreciate the characteristics of the car and maximize its performance.
AVR has the characteristics of quick learning and simple development. However, to fully appreciate and utilize the advantages of AVR, application engineers are also required to continuously learn and practice hardware and software design and development capabilities and IC chip decryption.
"The layman sees the excitement, the expert sees the doorway", for engineers who have a certain foundation in embedded and single-chip system design and development, it may be a good idea to give AVR a simple try first.
Development environment and tools: PC + download cable + actual system board
Development software on PC:
AVR Studio (Free) assembly + assembly debugging + high-level language debugging + software simulation
ICC, CVAVR, BASCOM-AVR high-level language program development + program download. One of them is purchased as a genuine full-featured version as the main development environment, and the other uses the DEMO version as an auxiliary and reference.
AVR ISP download cable:
STK200 and STK200+ and STK300 ISP programmer. Through the printer port of PC, use ISP technology to write system running code (HEX, BIN) and data into Flash and EEPROM of AVR chip, and program the configuration fuse and encryption bit of AVR. Support most AVR chips, as well as ATMEL's 51 compatible chips 89S8252, 89S52, etc. In ICC, CVAVR, BASCOM-AVR, BASCOM-8051, there are built-in support programs for this download line. Free dedicated download programs: SLISP, PonyProg2000, etc.
Tips for not using the emulator as much as possible:
When developing and debugging system programs and IC chip decryption, many people completely rely on IC chip decryption, and feel at a loss once they leave the emulator. In fact, since the AVR's Flash memory can be easily erased and written online multiple times using ISP technology, it is recommended not to use (rely on) the emulator to develop and debug programs.
In the actual development process, program debugging can start from the following aspects:
Today's high-level language compilers (such as C compilers) can generate very efficient machine codes, so it is recommended that you use high-level languages to write system programs as much as possible.
Use the AVR Studio software simulation environment provided by Atmel, as well as other software simulation environments (BASCOM-AVR).
Whenever possible, use high-level languages to write system programs.
Use the LED, LCD or asynchronous serial port on the target board. See the attached "How to develop AVR without an emulator" for an introduction.
Improve the rationality of hardware design:
Try to use the resources within the AVR chip as reasonably and fully as possible, such as EEPROM, A/D, and internal RC oscillator source.
Try to use peripheral devices connected by serial communication, large-capacity memory, LCD controller, printer, use 7279 instead of 8279 (LED digital tube + keyboard), etc. Except for the need to expand RAM (such as voice and image), it is generally not recommended to use parallel expansion (573 + decoding circuit), which reduces the probability of hardware, wiring and PCB board errors, and also improves the reliability of the system. Parallel expansion to serial expansion is a development trend. Now there are a large number of new peripheral devices using high-speed serial interfaces, such as A/D, D/A, RTC, memory, etc.
Try to use and reserve the ISP program download interface on the target board, or use IAP technology.
Advantages: The compatibility of ISP interface and I/O is better than JETAG.
Disadvantage: Cannot debug online
Pay attention to and master the use of AVR configuration fuse bits:
Try to use high-level languages to design and write system programs. Many people think that using assembly language to write programs is more concise, and using high-level languages to develop will waste a lot of program space. In fact, this is a misunderstanding. For an experienced assembly expert who is very familiar with a certain microcontroller, he can write more concise code than high-level languages. For developers who are not very familiar with assembly language, or suddenly change to a new microcontroller, can you guarantee that you can write more concise code than high-level languages?
Today's high-level language compilers (such as C compilers) can generate machine codes with very high code efficiency. Therefore, it is recommended that you write programs that can be implemented in high-level languages in high-level languages as much as possible. In situations where speed and timing requirements are particularly strict, a hybrid programming method can be used to solve the problem.
A more in-depth and comprehensive understanding of the various serial communication protocols:
Embedded systems currently use a large number of serial interface peripheral chips and various communication interfaces, such as RS232, two-wire (I2C), three-wire (SPI), single bus, USB, CAN, TCP/IP, etc. Developers and programmers should understand low-level protocols, be familiar with how hardware implements low-level protocols, how to define reliable upper-level application protocols, and the interface design between low-level protocol drivers and upper-level application protocols (implementation of middle-level software).
Hardware engineers need to improve their software writing skills, adopt standard programming methods, perfect software overall framework design, and good data structure and program structure systems. (Programmers majoring in computer software are not familiar with hardware, and most of them write software under the support of operating systems. They also do not understand the driver layer and interface of low-level interfaces and protocols, and often cannot write good single-chip system programs.)
The communication interface should be written as
.Use interrupt + buffer,
.Layered + structured design,
.Try not to use the round-robin method (reduces the efficiency of the AVR). See the URAT (RS232) driver + middleware software example.
Adopt good system design patterns:
Try not to use the traditional foreground and background (interrupt) system design mode, where tasks affect and interfere with each other and cannot be operated on a regular basis. For example, design an 8-bit LED digital tube display driven by dynamic scanning + a 4*4 matrix keyboard with dynamic scanning.
Adopt TimeTip+state machine design+CASE structure to realize multi-task parallel operation system design method. Or time-triggered system design. (See: "Time-triggered Embedded System Design Pattern" China Electric Power Press 2004.6)
Porting a small embedded operating system, such as UCOS-II. There are some free simple AVR-based operating systems on the Internet.
Improve C language programming skills and software application level:
Be familiar with and make good use of more advanced applications in C, such as data structures, pointer applications, memory management, etc.
Be familiar with and understand the characteristics of the high-level language development platform you are using. These platforms are targeted at a certain type of processor and contain many special incompatible statements and extended structures, statements, functions, etc. Although they are easy to use, they should be used reasonably due to their opacity and time uncertainty. For example, getchar(), putchar() in C, etc.
AVR has multiple development platforms, each with its own characteristics and shortcomings. The ability to use these platforms in combination and complement each other can improve development efficiency. For example, through the ICC and CVAVR program generator CodeWizard, you can learn and understand the hardware settings of AVR, simplify calculations, and quickly generate basic program modules, such as "a URAT (RS232) low-level driver + middle-level software example".
Previous article:Design of elevator call display board based on AVR microcontroller CAN bus
Next article:Design of digital electronic scale based on ATmega16 single chip microcomputer
Recommended ReadingLatest update time:2024-11-16 19:43
- Popular Resources
- Popular amplifiers
- Principles and Applications of Single Chip Microcomputers 3rd Edition (Zhang Yigang)
- Metronom Real-Time Operating System RTOS for AVR microcontrollers
- Digital integrated circuit backend design (Tian Xiaohua, Li Chunxia, Wang Xu)
- Learn C language for AVR microcontrollers easily (with video tutorial) (Yan Yu, Li Jia, Qin Wenhai)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Basic C language programming specifications for microcontroller development
- [N32L43X Review] 2. Simulating I2C to drive OLED
- I'm stuck while learning about op amps and have encountered several problems, as shown in the picture. Forum friends who know the answer please help me analyze it. Thank you.
- DDR2 Specification Chinese Version.pdf
- Video demonstration, how to quickly implement the drive test of ST sensor (LSM6DSOX) through STM32 microcontroller
- 【Example】Conduction + radiation, rectification case!
- [Support eSports] Invite your friends to join the 19 National Competition Exchange Group and share a thousand-yuan cash gift!
- What is a hysteresis comparator?
- More than 20 commonly used power symbols
- Eliminate distractions