Atmel ATSTK500 500 Starter kit and development system. ATSTK500 ATSTK500 Hoja De Datos

Los códigos de productos
ATSTK500
Descargar
Página de 61
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)