EasyManua.ls Logo

Atmel AVR STK500 - Section 9 Example Applications; 9.1 Using LEDs and Switches

Atmel AVR STK500
62 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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)

Related product manuals