//(C) 2012 www.loetstelle.net //Verwendung nur zum Privaten Gebrauch! .include "tn24def.inc" .equ FLAG_PACKET_RECEIVED=0 .equ FLAG_INT0 = 1 .equ FLAG_RECEIVING = 2 .equ FLAG_IRQ_COUNTER = 3 .equ FLAG_POWER_UP = 4 .equ FLAG_DO_INIT = 5 .equ FLAG_INITIALIZED = 6 .equ FLAG_RX_WATCHDOG = 7 .EQU RFM12_CLOCK= 4 .EQU RFM12_DATA_IN = 5 .EQU RFM12_DATA_OUT = 2 .EQU RFM12_NSEL = 3 //OK .EQU RFM12_RESET = 6 .EQU RFM12_NIRQ = 2 //OK .EQU LED_DDR = DDRB .EQU LED_PORT = PORTB .EQU LED_PIN = 1 .EQU RFM12_IRQ_PIN = PINB .EQU RFM12_PORT = PORTA .EQU RFM12_PINS = PINA .EQU RFM12_DDR = DDRA .EQU MAX_IRQ_COUNTER = 25 .EQU RX_PACKET_LENGTH = 16 .EQU MAX_RX_WATCHDOG = 50 .EQU OUT_1_DDR = DDRB .EQU OUT_2_DDR = DDRA .EQU OUT_3_DDR = DDRA .EQU OUT_4_DDR = DDRA .EQU OUT_1_PORT = PORTB .EQU OUT_2_PORT = PORTA .EQU OUT_3_PORT = PORTA .EQU OUT_4_PORT = PORTA .EQU OUT_1_PINS = PINB .EQU OUT_2_PINS = PINA .EQU OUT_3_PINS = PINA .EQU OUT_4_PINS = PINA .EQU OUT_1_PIN = 0 .EQU OUT_2_PIN = 0 .EQU OUT_3_PIN = 1 .EQU OUT_4_PIN = 7 .EQU CMD_ON = $44 .EQU CMD_OFF = $22 .EQU CMD_TOGGLE = $11 .def sreg_temp=r1 .def temp1=r16 .def temp2=r17 .def temp3 = r18 .def temp4 = r15 .def temp5 = r14 .def flags = r19 .def rcv_byte = r20 .def irq_counter = r21 .def rx_counter = r22 .def rx_watchdog_counter = r23 //Usart 115200 kBit per Second .equ BAUDRATE_REGISTER = 3 .org $0000 rjmp main .org EXT_INT0Addr rjmp INT0_Handler .org OVF0Addr rjmp OVF0Handler .org int_vectors_size*2 main: ldi temp1,low(ramend) out spl,temp1 clr flags rcall led_on rcall int0_init rcall timer0_init; rcall RFM12_Port_INIT rcall output_port_init sei endless: sbrc flags,FLAG_INT0 rcall flaghandler_int0 nop sbrc flags,FLAG_IRQ_COUNTER rcall flaghandler_irq_counter nop sbrc flags,FLAG_DO_INIT rcall flaghandler_do_init nop sbrc flags,FLAG_RX_WATCHDOG rcall flaghandler_rx_watchdog nop sbrc flags,FLAG_PACKET_RECEIVED rcall flaghandler_packet_received ldi temp1,(1<