; get some chip specific definitions like the special names for ports .include "C:\Program Files\Atmel\AVR Tools\AvrAssembler\Appnotes\m16def.inc" .def tmp=r16 .CSEG .org 0 main: ; Set stack pointer to last internal RAM location ldi tmp,low(RAMEND) out SPL,tmp ldi tmp,high(RAMEND) out SPH,tmp ; initialize the registers prior to use ; and explain what they'll be used for. ; setup the ports for output mainLoop: ; figure out what you're going to display from the lookup table ; use loops to wait until the next update of the LEDs jmp mainLoop ;; Lookup Table for output pattern to generate numbers on 7 segment LED ;; Use the lpm instruction to access the table ;; Chosing a clever base address can make your life easier when indexing .cseg .org [base adress for jump table] .db 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09