Menu

AVRStudio Log in to Edit

AVR Studio

Create 3 Ada source files:

-- main.adb
with TestProj;

procedure Main is
begin
   TestProj.RunTest;
end Main;

-- TestProj.ads
package TestProj is
   procedure RunTest;
end TestProj;

-- TestProj.adb
with Interfaces;        use Interfaces;
with AVR;
with AVR.MCU;
package body TestProj is

   procedure RunTest is
      temp : Unsigned_8 := 16#FF#;
   begin
      AVR.MCU.DDRC := 16#FF# ; -- Set data direction for port C to output
      loop
         AVR.MCU.PORTC := temp;
         temp := temp - 1;
      end loop;
   end RunTest;

end TestProj;

Copy the demo.gpr and Makefile files from one of the examples to the working directory.

Change the name of demo.gpr to main.gpr, edit the file replacing "Demo" with "Main".

Edit the makefile changing just the MCU line to read:
MCU := atmega128
Run make which creates (among others) a file named main.elf.

Run AVR Studio 4 and select "Open" from the welcome dialog.

Select main.elf

The system prompts with "Save AVR Studio Project File main_elf.aps", select save.

Select AVR Simulator and atmega128

Select finish.

The source for system.ads is opened with a debug cursor at the start of the file.

At this point you can step the debugger to run the simulator.

With the simple example program if you look at PORTC in the I/O view the value on the port will count as you step when you get to the loop in RunTest.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.