AVR STK500 User Guide
9-1
Rev. 1925C–AVR–3/03
Section 9
Example Applications
9.1
Using LEDs and
Switches
Connect PORTB to LEDS and PORTD to SWITCHES.
LEDs will operate differently depending on what switch is pressed.
Tip: Copy the code from this document into AVR Studio.
;***** STK500 LEDS and SWITCH demonstration
.include “8515def.inc”
.def Temp
=r16 ; Temporary register
.def Delay
=r17 ; Delay variable 1
.def Delay2
=r18
; Delay variable 2
;***** Initialization
RESET:
ser
Temp
out
DDRB,Temp
; Set PORTB to output
;**** Test input/output
LOOP:
out
PORTB,temp
; Update LEDS
sbis
PIND,0x00
; If (Port D, pin0 == 0)
inc
Temp
; then count LEDS one down
sbis
PIND,0x01
; If (Port D, pin1 == 0)
Summary of Contents for AVR STK500
Page 1: ...STK500 User Guide ...
Page 2: ......
Page 38: ...Hardware Description 3 28 AVR STK500 User Guide 1925C AVR 3 03 ...
Page 40: ...Installing AVR Studio 4 2 AVR STK500 User Guide 1925C AVR 3 03 ...
Page 52: ...In System Programming of an External Target System 6 2 AVR STK500 User Guide 1925C AVR 3 03 ...
Page 56: ...Technical Support 8 2 AVR STK500 User Guide 1925C AVR 3 03 ...
Page 60: ...Appendix A 10 2 AVR STK500 User Guide 1925C AVR 3 03 ...