NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Is there a way to execute a program one line at a time for troubleshooting?

May 21, 2012
by jmuthe
jmuthe's Avatar

When I was in college, I used assembly language to program an MC68HC11 board. If the program compiled correctly but did not run exactly how the programmer planned, then that is known as a logical error. If there was a logical error, we used a technique where we could execute the program one line at a time. If you got to a section of the program that was supposed to loop back N amount of times then you would actually see it loop back N amount of times line by line. If the program was supposed to jump to another part of the program then you would see it skip from one line to the correct line. This method allowed you to troubleshoot the program by going through it line by line until you find your problem. Is there a way to do this with the Nerdkit using C programming? If so, then how? Thank You.

May 21, 2012
by pcbolt
pcbolt's Avatar

jmuthe -

Short answer is yes. You'd have to get special hardware to do it (the AVR Dragon comes to mind). If you're using an ATmega168 I think you'd need to use hardware that can handle the "debugWire" interface. There is a forum post about this HERE. On that page you'll see a link to a You Tube video that is very interesting (actually there are two in the series).

May 22, 2012
by Rick_S
Rick_S's Avatar

I'm not 100% on this, but I think you can also simulate this in software with the AVR Studio development software offered for free by Atmel.

May 22, 2012
by Ralphxyz
Ralphxyz's Avatar

Wow I do not know if the ATmega168-328 is a supported device but the ATmel Simulator in AVRStudio5 is cool!

I will definitely be looking into AVRStudio5, I have it but have been avoiding it.


Post a Reply

Please log in to post a reply.

Did you know that NerdKits make a great parent/child activity? Learn more...