AVR controlled signal generator-first impression

Lazy evening. I decided to take couple shots of couple generated signals. Without going to deep in to timings I wrote couple algorithms to make sure the signals are generated correctly at all voltage range 0-5V.

First is Sawtooth signal using asm in AVRStudio:

.INCLUDE “m8def.inc”

.DEF tmp = R16 ; Multipurpose register

ldi tmp,0xFF; Set all pins of Port D as output

out DDRD,tmp

sawtooth:

out PORTD,tmp

inc tmp

rjmp sawtooth

Sawtooth.jpg
(My oscilloscope is really old so sorry for bad quality)

Second signal Triangle. This one I programmed using WinAVR toolset.

int main (void)

{

uint8_t x=0, y=0;

atmega8init();

for (;;) /* Note [6] */

{

if (y==0)

{

x++;

if (x==255) y=1;

}

else

{

x–;

if (x==0) y=0;

}

PORTD=x;

}

return (0);

}

Triangle.jpg

It is obvious that signals are generated correctly at all voltage interval 0-5V.

Later I will probably use signal (pulse, sawtooth, triangle, and sinusoid) tables stored in flash memory. EEPROM memory is too small to store all signals but I am going to use it for last configuration storage that every time you switch that generator, the last settings would be loaded. And I still didn’t decide what language to use for programming the device. C would be much easier and faster, but I will loose speed. The maximum signal frequency would be much lower than using pure ASM. But ASM programming takes much more time to implement. Any comments while I will be assembling the box?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

To submit your comment, click the image below where it asks you to...