;Dimmer Soft ON/OFF ;(c) 2004 Markus Vohburger ;Gewerbliche Nutzung untersagt! ;Definitionen für Tiny12 Laden .include "tn12def.inc" .def temp1 = r16 .def temp2 = r17 .def output = r18 .def swcount0 = r19 .def output = r20 .def pwmcount = r21 .def swcount1 = r22 .def conbuf = r23 .def direction = r25 .def control=r26 .def pwmvalue = r27 .def dirty = r28 .def onoff = r29 .EQU EE_OSCCAL = $3f; ;reset handler .org $0000 rjmp main ;timer overflow interrut handler .org OVF0Addr rjmp OVF0Handler .org $0010 main: ;stack setup ;read osccal byte ldi temp1,EE_OSCCAL rcall readeeprom out osccal,temp1 ;port setup ;port b input with pullups ldi temp1,$01e out ddrb,temp1 ;port b output off, pullups on ldi temp1,$1f out portb,temp1 ldi temp1,$1e out ddrb,temp1 ;Einstellungen aus EEProm laden ldi temp1,$00 rcall readsettings mov conbuf,temp1 ldi direction,$00 ldi dirty,$00 ldi temp1,$01 rcall readeeprom mov onoff,temp1 andi onoff,$01 ;Dimmer An/Aus nach Reset umschalten, wenn Taste gedrückt sbic pinb,0 rjmp notoggle ldi temp1,$01 eor onoff,temp1 ;ins EEProm schreiben waittoggle: sbic eecr,eewe rjmp waittoggle out eedr,onoff sbi eecr,eemwe sbi eecr,eewe notoggle: ; ;Timer zurücksetzen ldi temp1,$00 out tcnt0,temp1 ;Timer interrupts an ldi temp1,(1<