The microcontroller is designed to control electronic devices, as well as to interact between them in accordance with the program embedded in it. Microcontrollers contain built-in additional devices.
Necessary
- - CodeVisionAVR;
- - VMLAB.
Instructions
Step 1
Install the CodeVisionAVR compiler application on your computer for programming microcontrollers. It creates a program for the AVR. Also, you need to install the VMLAB simulator application, which is designed to test the operation of the program on the microcontroller.
Step 2
After installation, make a backup copy of the folders with programs. Applications include sample devices for microcontrollers, as well as built-in help files. Use them to program the controller yourself.
Step 3
Unpack the x8pwm2.rar archive into the folder with the installed Vmlab program - z8. Then start the Vmlab application, go to the Project menu and select Open project in it, then open the project from the Vmlab.prj program folder. The project window will appear on the screen, which is composed of the following elements: LEDs, resistors, keyboard, oscilloscope, terminal.
Step 4
Next, click on the Re-build all item in the Project menu to recompile the project. A message will appear stating the successful completion of the process, after which you can start simulating the microcontroller.
Step 5
Simulate, i.e. start executing the program that is loaded in the computer model of the controller, as well as the circuitry around it. Click on the traffic light to start the execution of the program loaded into the memory of the MK. Stop the process immediately.
Step 6
Run it again and watch the voltage change in the Scope window. Stop the program, expand the window labeled Code, it will display the source code of the program compiled by Cvavr.
Step 7
Please note that some lines are highlighted in yellow, the length of this highlight indicates the time the program has been on this line. After that, you can flash the controller using this program.