; ************************************************************** ; * Produces a sinewave on a R/2R-network connected to PORTD * ; * (C)2005 by avr-asm-tutorial.net * ; ************************************************************** ; .INCLUDE "8515def.inc" ; ; Register definitions ; .DEF rmp = R16 ; Multipurpose register ; ; Start of program source code ; ldi rmp,0xFF ; Set all pins of port D to be output out DDRD,rmp ldi ZH,HIGH(2*SineTable) ; Point Z to Table in flash ldi ZL,LOW(2*SineTable) clr rmp loop1: nop nop nop loop2: lpm ; Read from table out PORTD,R0 ; Write value to port D adiw ZL,1 ; point to next value dec rmp ; End of Table reached brne loop1 ldi ZH,HIGH(2*SineTable) ; Point Z to Table in flash ldi ZL,LOW(2*SineTable) rjmp loop2 ; ; End of source code ; ; Include sinewave table ; .INCLUDE "sine8_25.txt" ; ; End of program ;