]> hackdaworld.org Git - my-code/atmel.git/commitdiff
pld without freq setting ...
authorhackbard <hackbard>
Thu, 20 Apr 2006 21:16:44 +0000 (21:16 +0000)
committerhackbard <hackbard>
Thu, 20 Apr 2006 21:16:44 +0000 (21:16 +0000)
beginners/pld_stily.asm

index 624773bc78639aca8708662d933c8545bd29b758..489df263f1dfe73abcc91a0cb6c8b2726ec8a662 100644 (file)
@@ -9,7 +9,14 @@
 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
 
@@ -22,18 +29,20 @@ LIGHT_ON:
 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