Get rid of the simulator AVR microcontroller program development design

When developing a microcontroller program, many people rely on the simulator, and once they leave the simulator development program, they feel that they can't get started. In fact, for FLASH memory microcontrollers, do not simulate the machine can also develop programs quickly and easily. Specifically, you can start from the following aspects:

First, try to use high-level language development system program

Have you ever mislabeled a label while writing the assembler, wasting your experience of having to spend a lot of time looking for errors or jumping offsets too large and having to change the program structure. In fact, if you use a high-level language development program, you will not have such pain. In developing the program, in addition to building a good development document, the choice of language is also important. There are many people who think that using the assembly program is relatively streamlined, and using high-level language development wastes a lot of program space. In fact, this is a misunderstanding. For an experienced assembler who is very familiar with a microcontroller, he can write code that is more streamlined than a high-level language. And if you are a developer who is not very familiar with the assembly, or suddenly replaces a new one, can you guarantee that you can write more concise code than the high-level language?

The superiority of high-level languages ​​is incomparable in assembly language:

1, the program is convenient to transplant

2, the robustness of the program

3. Support for mathematical operations

4, structured and structured programming, program maintainability

5, short development cycle

Nowadays, high-level language compilers (such as C compilers) can generate machine code with high code efficiency. Therefore, it is recommended that programs that can be implemented in high-level languages ​​be written in high-level languages ​​as much as possible, in the case of strict requirements on speed and timing. Can be solved by a mixed programming method.

Second, more use of software simulation environment

Many single-chip microcomputers now provide software simulation and simulation environments, such as AVR microcontrollers.

" style="color:blue;text-decoraTIon:none;font-weight:normal;"

The AVR microcontroller can perform software simulation debugging in the simulation environment of the AVR STUDIO development platform provided by ATMEL. BASCOM-AVR also provides a more user-friendly and software-simulated debugging environment with an external graphical interface (keyboard, standard LCD display, etc.). ATMEL's AVR STUDIO is an integrated development environment for developing AVR microcontrollers that supports source-level software simulation debugging for high-level and assembly languages.

Under the conditions of simulation and simulation, the debugging algorithm, program flow, etc. can be said to be no different from the hardware simulator. The debugging delay program and the time taken to calculate a program running can be said to be more convenient than the hardware simulator, because many Simulators (such as JTAG ICE) are unable to provide debugging parameters such as program runtime. In addition, I/O ports, timers, UARTs, interrupt responses, etc. can be simulated in AVR STUDIO. Users can also use software to step through and set breakpoints to analyze memory and view all AVRs. Data and usage of hardware resources. Learning to use and use software simulation and simulation, system simulation and debugging methods can greatly improve the project development efficiency and shorten the development cycle. Because, once the overall design of the system is completed, the design and production of the hardware PCB can be carried out simultaneously with the development of the software system. When the hardware system board is completed, the overall architecture of the software has been debugged, and the actual debugging phase can be performed.

Third, make good use of hardware resources on the target board

On many system target boards, there are LEDs, digital tubes, RS232 and other accessories and interfaces. In fact, the use of these accessory interfaces can also realize and complete the debugging and development of the program. The purpose of our simulator is to observe the internal state and data of the microcontroller. With these accessories and the multiple rewritable features of the FLASH memory, the internal state of the microcontroller can be observed.

The AVR MCU is a FLASH MCU that supports ISP. When developing, it can be connected to the PC through a download cable, and downloaded to the target MCU immediately after the program is compiled. When it is necessary to observe the internal state of the microcontroller, a small part of the code can be added to the appropriate position of the program, and the internal state and data of the MCU are displayed through LEDs, digital tubes, and the like. In an application with an RS232 communication interface, the internal state of the MCU that needs to be observed can be directly sent to the PC, and some super terminals such as a serial port debugger are used to display data on the PC. Most development environments now provide HyperTerminal, such as ICC, CVAVR, BASC0M-AVR, and so on. Because the MCU uses the Flash technology that supports ISP, the use of high-level language development system programs, more software simulation technology, and the use of serial output debugging data development tools have become the development of microcontrollers and embedded systems (such as 32-bit ARM The COMMAND debugging means, etc.) is a popular and efficient method.

Fourth, examples

In the development of AVR I2C application routines, the method of outputting debug data using the serial port is introduced.

First initialize the UART. It can be seen that initializing the UART requires only a few lines of code, which can be removed after the program is debugged. If your system program itself needs to use a serial port, there is no line of extra code to initialize the UART.

Void uart_init(void)

UCSRB=(1"

Then we can write a putchar function, or directly use the putchar function in the standard input and output library.

Void putchar(unsigned char c)

{

While (!(UCSRA&(1"

Ckb Mining Machine

Nervos is an ambitious newcomer on the crypto market and Changelly has long watched it with interest. The project attracted the attention of investors and developers since its purpose is not to launch another cryptocurrency in the ecosystem. Nervos is a simple connecting database between any blockchains.


Nervos was launched in November 2019 by Nervos Network and aims to fix issues that plague both Bitcoin and Ethereum. Among them are scalability and value differences. To fix them, the Nervos team wants to implement effective scalability and raise the cost of their token by hosting other cryptocurrencies on their blockchain. Nervos supports smart contracts and is censorship-resistant. CKB is a native token of the Nervos network. It scales with the value of other assets stored on the network: the more cryptos and tokens are there, the more valuable CKB becomes. This means that this token will continue raising its value the more attention and assets it attracts. Add to that the support of smart contracts, and you have a nice crypto bridge between different blockchains. Which is exactly what makes it so attractive for both crypto enthusiasts and investors.

ckb mining machine,eaglesong algorythm,ckb miner,goldshel ck6,goldshell ck5

Shenzhen YLHM Technology Co., Ltd. , https://www.ylhm-tech.com