Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

AVR controlled signal generator-first impression

Lazy evening. I decided to take a couple of shots of couple generated signals. Without going too deep into timings, I wrote a couple of algorithms to ensure the signals are generated correctly at all voltage range 0-5V. First is the 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
        out PORTD,tmp
        inc tmp
        rjmp sawtooth

(My oscilloscope is old, so sorry for the bad quality) Second signal Triangle. This one I programmed using the WinAVR toolset.

int main (void)
uint8_t x=0, y=0;
    for (;;) /* Note [6] */
	if (y==0)
		if (x==255) y=1;
		if (x==0) y=0;
    return (0);

It is evident 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 will use it for last configuration storage that every time you switch that generator, the previous 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 lose 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