.include "m16def.inc" ; MASTER einstellungen .equ TWI_BIT_RATE = 255 ; Bit-Rate (11...255 .equ TWI_PRESCALER = 3 ; Vorteiler: 0=1 1=4 2=16 3=64 ; REGISTER .def ADRESSE_SLAVE = R11 .def DATA_SENDEN_1 = R14 .def temp = R16 .def temp1 = R17 .def temp2 = R18 .def temp3 = R19 .cseg .org 0 ;Startadresse=0 rjmp RESET ;Reset Handler RESET: ;STACK initialisieren ldi temp,LOW(RAMEND) out SPL,temp ldi temp,HIGH(RAMEND) out SPH,temp ; PORT B + D alles AUSGÄNGE ldi temp,0b11111111 out DDRB,temp out PORTB,temp out DDRD,temp out PORTD,temp ; PORT C alles Eingänge clr temp out DDRC,temp ; TWI-INITILISIERUNG rcall TWI_INI ; Startwerte ldi temp,0b11111110 ; SLAVE ADRESSE 127 (0=!General CALL) mov ADRESSE_SLAVE,temp rcall wait_1s LOOP: ldi temp,0b11111111 mov DATA_SENDEN_1,temp rcall TWI_MASTER_TRANSMITTER rcall wait_1s rcall wait_1s rcall wait_1s rcall wait_1s rcall wait_1s rcall wait_1s ldi temp,0b00000000 mov DATA_SENDEN_1,temp rcall TWI_MASTER_TRANSMITTER rcall wait_1s rcall wait_1s rcall wait_1s rcall wait_1s rcall wait_1s rcall wait_1s rjmp LOOP TWI_MASTER_TRANSMITTER: ldi temp,(1<