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?

Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post
 |  TrackBack URI for this post

New on WinAVR Tutorial
Running TX433 and RX433 RF modules with AVR microcontrollers,
Sometimes in embedded design you may want to go wireless. Might be you will want to log various readi …
Programming AVR ADC module with WinAVR,
Most of AVR microcontrollers have Analog to Digital Converter (ADC) integrated in to chip. Such solut …
New on WinARM Tutorial
What are differences between WinARM and WinAVR,
Everyone who is working with AVR microcontrollers knows this powerful tool – WinAVR (http://win …
LPC2000 watchdog timer,
As in all microcontrollers watchdog timers purpose isto reset microcontroller after reasonable amount …

Leave a Reply