Ready to simulate, clueless as h4ll.

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok I finally have my project running with avr-studio and winavr. I set up a simulator and am able to select "star debug" I didn't really know what to expect I was hoping to see my usb device pop up and "simulate" how it works. Instead I got a break point arrow. This is nice well and good but what next? I want to simulate my hardware somehow, just dont "get it". I followed a tutorial to get me this far but need to know how to see what I'm working on.I think its just a matter of understanding the paradigm for working with avr-studio and simulators. I really dont know where to look next, help?

Or am I kidding my self and I have to upload the hex file each time I make a change?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I want to simulate my hardware somehow
You CAN'T. At best you can see if your code is doing what it is supposed to do.

The "break point arrow" shows where the program counter is at. If you press F11 it will step one instruction (with asm or in disassembler mode).

F5 wil run your code. You can put a breakpoint in your code and see if your program reaches that point. You can also change bits in ports and other parts of the "chip".

If you find a bug, fix it and then do a "build and run". The code will be "downloaded" into the "chip" ready for another debugging session.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok fair enough. How do you trace info? And where to?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Trace" as in what instructions have been excuted up to a breakpoint?

I don't think it exists but in the most expensive ICE.

You may be able to send the trace directly to your brain by using your eyes and "Auto step" (Alt+F5) :-)

I'm not a fan of simulation, much rather have a real chip and some form of OCD. ie JTAG or DW.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well I prefer traces over break points. I find break points to not work some time. I'd rather trace " here > data1 = x " rather then using a break point. Plus I like to trace out certain calculation. What is x doing when I do such and such.. But I guess this is not acceptable and i must learn to use the debuger tools. Such as life, thx.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok example.
Take this code.

 run_mode = (PINB & 0x06)>>1;

	switch(run_mode)
	{
		default:
		case 0:
			curGamepad = db9GetGamepad();
			break;
		case 1:
			while(1)
				blinkLed(1);
			break;
		case 2:	
			curGamepad = nesGetGamepad();
			blinkLed(1);
			break;
		case 3:
			curGamepad = snesGetGamepad();

now run_mode in the sim will always be 0, unless there is a way to simulate those pins( dip switches) ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Go to the I/O view and click on the appropriate PINB bit (NOT PORTB) to set/reset that bit.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I saw that, but how does a person ( newbie ) know what to put in there? If I wanted to short my input pin (DB0) to my output pin (DB1) Do I just set "port b input pins" to 0x01 ?

I dont know what value pin DB1 has? or how would I set DB0 to DB1 and DB2, set "port b input pins" to 0x01,0x01 ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

scratch all that I got it now. needed to read up ;)