INIT:
ldi r30,0x00 ; light status
ldi r28,1 ; constants
-ldi r27,0x01;
+ldi r17,0xff
+; adc
+;ldi r16,(1<<ADLAR) ; left adjusted, pin 0 connected to adc, a ref connected
+;out ADMUX,r16
+;ldi r16,(1<<ADEN)|(1<<ADSC)|(1<<ADFR) ; enable, running mode, start first conv.
+;out ADCSR,r16
+; port c
+ldi r27,0x01
out DDRC,r27 ; select pin 0 as output
rjmp LIGHT
ldi r31,0 ; reset wait counter
ldi r30,0x01
out PORTC,r30
+;ldi r17,0xff
rjmp WAIT
LIGHT_OFF:
ldi r31,0
ldi r30,0x00
out PORTC,r30
+;in r17,ADCH
rjmp WAIT
WAIT:
ldi r29,0 ; reset inner wait counter
add r31,r28 ; increment wait counter
-cpi r31,0xff ; after 255 steps
+cp r31,r17 ; after 255 steps
breq LIGHT
rjmp WAIT_MORE