Getting Started with Proteus: AVR Microcontroller Simulation Example

Before starting, prepare the simulation file, which is the debugging or download file generated by the compiler. Different compilers produce files in different formats, such as ICC produces COF, IAR produces D90, and GCC produces COF and ELF. Proteus 6.7sp3 supports COF, D90, HEX, etc., but does not currently support ELF.

This example uses: lcd_C.hex

Run Proteus 6 Professional (ISIS6 Professional) to see the window below:

Getting Started with Proteus: AVR Microcontroller Simulation Example

1. Add components to the component list: The components needed for this example are: ATMEGA16, LM016L (LCD1602), “ground”, and oscilloscope. Click the “P” button to open the component selection dialog.

Getting Started with Proteus: AVR Microcontroller Simulation Example

Getting Started with Proteus: AVR Microcontroller Simulation Example

In the dialog’s KEYWORDS box, enter ATMEGA16 to get the following results:

Getting Started with Proteus: AVR Microcontroller Simulation Example

Click OK to close the dialog, and ATMEGA16 will be listed in the component list. Similarly, find LM016L.

The final result:

Getting Started with Proteus: AVR Microcontroller Simulation Example

2. Place components: Select ATMEGA16 from the component list and click the left mouse button in the schematic editing window to place it there. Do the same for LM016L.

Getting Started with Proteus: AVR Microcontroller Simulation Example

Add “ground”: Left-click to select the ground icon from the model selection toolbar Getting Started with Proteus: AVR Microcontroller Simulation Example to see:

Getting Started with Proteus: AVR Microcontroller Simulation Example

Left-click to select GROUND and click in the schematic editing window to place the ground there. Add the oscilloscope: Left-click to select the oscilloscope icon from the model selection toolbar Getting Started with Proteus: AVR Microcontroller Simulation Example and click in the schematic editing window to place the oscilloscope.

Getting Started with Proteus: AVR Microcontroller Simulation Example

Note: When placing components, ensure they are placed within the blue box. If accidentally placed outside, the mouse cannot be used outside, so use the menu “Edit” -> “Tidy” to clear it. The method is simple; just click “Tidy”. During operation, you may need to move parts of the circuit; the method is to first drag-select with the right mouse button, then click Getting Started with Proteus: AVR Microcontroller Simulation Example to move that part of the circuit with the mouse. Click the left mouse button at the target position to place that part of the circuit there.

3. Wiring

The VSS, VDD, and VEE of AVR and LCD do not need to be connected, as VSS=0V, VDD=5V, VEE=-5V, and GND=0V by default.

Getting Started with Proteus: AVR Microcontroller Simulation Example

4. Add the simulation file

Right-click ATMEGA16 and then left-click to see

Getting Started with Proteus: AVR Microcontroller Simulation Example

In the Program File, click Getting Started with Proteus: AVR Microcontroller Simulation Example to open the file browsing dialog, find the lcd_C.hex file, click OK to complete the file addition, and set the Clock Frequency to 8MHz, then click OK to exit.

5. Simulation

Click Getting Started with Proteus: AVR Microcontroller Simulation Example to start the simulation.

Getting Started with Proteus: AVR Microcontroller Simulation Example

Note: Red represents high level, blue represents low level, and gray represents uncertain level (floating). During runtime, you can check the relevant resources of AVR in the Debug menu.

6. Source Code Debugging

First, I should mention that I am using ICC, version ICC6.31a Pro. Proteus supports debugging COF files. When using ICC, you should change the compiler options to set AVR Studio Version to Studio 3.x, so that the original code can be seen in Proteus.

Getting Started with Proteus: AVR Microcontroller Simulation Example

In Proteus, after completing the schematic drawing and adding the debugging file (COF file), click Getting Started with Proteus: AVR Microcontroller Simulation Example to open the AVR Source Code window. If it does not appear in debugging mode, please check the Debug menu.

Getting Started with Proteus: AVR Microcontroller Simulation Example

Let me explain Getting Started with Proteus: AVR Microcontroller Simulation Example below:

1* Continuous run will exit single-step debugging and close the AVR Source Code window.

2* Single-step run will skip over sub-functions.

3* Single-step run will enter into sub-functions.

4* Exit the current function when using 3* to enter the function; this will immediately exit the function and return to the upper-level function, so it should be used in conjunction with 3*.

5* Run to the line where the mouse is located.

6* Add or remove breakpoints; when a breakpoint is set, the program will stop at that breakpoint when using Getting Started with Proteus: AVR Microcontroller Simulation Example.

Additionally, you can right-click in the AVR Source Code window to bring up the right-click menu; the functions above will not be explained here.

Getting Started with Proteus: AVR Microcontroller Simulation Example

Leave a Comment