| AVR LED Blink | ||
|---|---|---|
|
Today is September 3, 2010 Hex File :020000020000FC :1000000008E007BB08E008BB04D000E008BB01D053 :10001000F9CFDFE0E7E3F9ECFA95F1F7EA95D9F7E4 :0C002000DA95C1F7D1E0DA95F1F7089508 :00000001FF Source
;
;LED Blink
;Author: Chetan Bhargava [KG6NFG]
;Assembler: AVR Studio 4
;Date: 7/14/04
;Notes:
;We will use ATTiny11-6PC with internal RC oscillator
;Connect LED on pin 2 (PB3) on tiny11
.device ATTiny11
.include "tn11def.inc"
.def Temp = R16
.org 0x0000
init:
ldi temp, 0b001000 ; Make pin PB3 output
out DDRB, temp ;
main:
ldi temp, 0b01000 ;
out portb, temp ; Turn off LED @ PB3
rcall delay ; wait for human eye to see LED toggle
ldi temp, 0x00 ;
out portb, temp ; Turn on LED @ PB3
rcall delay ; wait for human eye to see LED toggle
rjmp main ; repaet until eternity or power removed :-)
delay: ; provides some delay so that the LED is visible
; =============================
; delay loop
; 499998 cycles: about 1/2 seconds
; -----------------------------
; delaying 499995 cycles:
ldi R29, $0F
WGLOOP0: ldi R30, $37
WGLOOP1: ldi R31, $C9
WGLOOP2: dec R31
brne WGLOOP2
dec R30
brne WGLOOP1
dec R29
brne WGLOOP0
; -----------------------------
; delaying 3 cycles:
ldi R29, $01
WGLOOP3: dec R29
brne WGLOOP3
; =============================
ret
|