ATMEGA C routine for an algorithm Q..

zxsa and toffee_pie: thanks for the replies

Most op amps can source up to 30 mA or so... you can directly maintain a voltage using an op amp in a feedback loop, with a 10 Ohm resistor in the path... but take the feedback *after* the resistor so it maintains the voltage there, and it will not vary much.

You will need a reference to go to the "+" input of the op amp, and a decoupling cap. Use a 9V battery is good enough for this.
 

Thread Starter

toffee_pie

Joined Oct 31, 2009
235
Ok, it seems the printf// had no adverse effect on current at all, I basically ran several algorithms, the one posted seemed to use the most current. Its listing at just over 5.2mA now.

as opposed to around 4mA with a blank () function, and around the same for other math operands...

hmm, interesting.

I am using a DMM in series connected to the buck output for my current measurement right now, It looks like I will get a INA138 soon to investigate this a bit more thorough.

what I am interested in doing is seeing how a reduction in the buck voltage (ie the supply to the atmega) effects the operands, regarding accuracy etc. I guess the only way to do this is send results to the usart port?

regards.
 
Unless you're going below the minimum power supply voltage from the data sheet, I doubt you will see any errors in the computations.

Some of the accessories of microcontrollers need more than the general minimum power supply voltage. Sometimes the ADC or the built-in reference voltage that require higher power supply voltages. But the core processing should always need just the minimum spec'd.

Or are you trying to go below spec?

Note that the current does depend on supply voltage. This is listed in the data sheets too. Generally, it's two things that determine core current consumption -- clock speed and supply voltage.
 

Thread Starter

toffee_pie

Joined Oct 31, 2009
235
I'm not sure what I want to achieve to be honest, the min voltage seems to be ca 1.8volts.

I guess i am trying to go below spec but don't see the point..:confused: I am seeing my supervisor soon as to see how i will proceed with this and get back here again.

thanks for your updates.
 

Thread Starter

toffee_pie

Joined Oct 31, 2009
235
Hi lads,

Can anyone advise me how i could (or should) measure the average energy from a stream of data been sent to the atmega?

the diagram shows roughly what I want to do, I want to run 5 or so operands and have a delay in between them and calculate the total average energy consumed by them (power x time).

I want to light an led after each operand to signify that an actual result/calculation has been performed as desired, some sort of feed back as it were, this is powered from a different source, so port x is just driving the transistor.

I want to scale the voltage down to way below 1.5/1.6 volts and see how the calculations fare and if results are still active, i will disable the BOD for this of course.

what do ye guys think? I am not sure how to collaborate the data/ or find the average energy for this?

regards.
 

Attachments

zxsa

Joined Jun 11, 2010
31
Just one operand? Well, that is really easy. Just fill the flash with that operand! The entire 32kB of it. You don't use a C-program - just fill the flash yourself. For the NOP-operand, just erase the flash - the erased state is exactly the correct machine code for the NOP-operand. It may actually be interesting to see the difference in energy between the NOP and other operands!

What will happen is that the AVR will start to execute from the beginning of the flash, continue all the way to the end of the flash, and then restart at the beginning by itself. So you can take your measurements at any time.

This way, you get the current/voltage for one specific operand at a time. This gives you the power.

Next, you need the time. Most operands execute in one clock cycle. Some require two (like branch or memory access instructions). You know the clock speed which gives you the duration of one cycle.

But, I again would recommend using an oscilloscope for this measurement. Preferably a 150MHz or faster model.

The reason why I say this is because the average current might look identical for different instructions. But, if you look at the detail, the current waveform may differ. Remember that the AVR will draw current peaks on each clock edge. These peaks may differ in height or width for different operands.

I think this gives you some ideas :)
 

Thread Starter

toffee_pie

Joined Oct 31, 2009
235
Im thinking 5 different type of operands, (basic math, arrays, algorithms etc..).

I was to use avr studio for my coding and upload onto the avr isp i have hard wired to my breadboard.

I am interested in monitoring the led status with decreasing voltage (ie to notify me of actual results been returned)
 
Top