Question

I do not have experience with micorcontrollers but I have something related to them. Here is and explanation of my issue:

I have an algorithm, and I want to calculate how many cycles my algorithm would cost on a specific avr microcontroller.

To do that I downloaded AVR-STudio 6, and I used the simulator. I succeeded in obtaining the number of cycles for my algorithm. What I wan to know is that how can I make sure that my algorithm is working as it should be. AVR-Studio allows me to debug using the simulator but I am not able to see the output of my algorithm.

To simplify my question, I would like some help in implementing the hello world example in AVR-Studio, that is I want to see "hello world" in the output window, if that is possible.

My question is not how to program the microcontroller, my question is that how could I see the output of a program in AVR-Studio.

Many thanks

Was it helpful?

Solution

As Hanno Binder suggested in his comment:

Atmel Studio still does not provide any means to display debug messages sent by the program simulated. Your only option is to place breakpoints at apropriate locations and then inspect the state of the device in the simulator. For example the locations in RAM where your result is stored, or the registers in which it may reside; maybe have a 'watch' set on a variable or expression.

I think this is the best answer, watch vairables and memory while in debug mode.

Note: turn off optimization when you want to debug for infomation, or some variables will be optimized away.

OTHER TIPS

the best thing to test if algorithms work is to run them in a regular PC program and feed them with data and compare the results with ground trouth.

Clearly to be able to do this a good programming style is neccessary that separates hardware related tasks from the actual data processing. Additionally you have to keep architectural differences in mind (eg: int=16bit vs. int=32bit --> use inttypes.h)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top