; ****************************************************** ; BASIC .ASM template file for AVR ; ****************************************************** .include "m8def.inc" ; Define here the variables ; .def srg = r15 .def tmp = r16 .def old = r17 .def mwc = r18 .def cnt0 = r19 .def cnt1 = r20 .def cnt2 = r21 .def cnt3 = r26 .def tmp3 = r22 .def tmp2 = r23 .def one = r24 .def zero = r25 .equ RS = 0x0060 ; anfang des zur freien verfügung stehenden ram-bereichs .equ CLOCK = 14745600 .equ BAUD = 9600 .equ UBRRVAL = CLOCK/(BAUD*16)-1 .equ C_CYC = 96 .equ PRESC = 8 .equ OCR = (C_CYC / PRESC) - 1 ; Define here Reset and interrupt vectors, if any ; .org 0x000 rjmp start reti ; IRQ0 reti ; IRQ1 reti reti reti ; Timer1 Capture reti ; Timer1 CompareA reti ; Timer1 CompareB reti ; Timer1 Overflow reti ; Timer0 Overflow reti ; SPI Transfer Complete reti ; USART RX Complete reti ; UDR Empty reti ; USART TX Complete reti ; ADC Conversion Complete reti ; EEPROM Ready reti ; Analog Comparator reti ; Two-wire Serial Interface reti ; Store Program Memory Ready ; Program starts here after Reset ; .MACRO GET_P in tmp, PIND in tmp2, PINB ror tmp2 ; richtige richtung ror tmp ror tmp2 ror tmp com tmp .ENDMACRO ;================================================================== start: ; stack ldi tmp, LOW(RAMEND) out SPL, tmp ldi tmp, HIGH(RAMEND) out SPH, tmp ; ports ldi tmp, 0x00 out DDRD, tmp out DDRB, tmp ; baudrate ldi tmp, LOW(UBRRVAL) out UBRRL, tmp ldi tmp, HIGH(UBRRVAL) out UBRRH, tmp ; frameformat ldi tmp, (1<