Академический Документы
Профессиональный Документы
Культура Документы
To use BASCOM-AVR open the applications folder on the desktop and double click
BASCOM-AVR.
Or pressing
There are two ports on the 90S2313 AVR microcontroller. Each pin on a port can be used
as an input or an output. Information in the data direction register sets the direction, a 0
means input and a 1 means output. The LEDs on the STK200 are connected to port B has
address 38H, the data direction register for port B is at address 37H. To use the LEDs we
need to set all port B pins as outputs so send 11111111 to address 37H.
This window should appear. Click on auto program chip. The ISP LED on the STK200
should flash.
A 0 lights up an LED and a 1 turns an LED off. What evidence do you have for this?
Program 2
Do
Out &h38 , &h01
Gosub Waste
Out &h38 , &h00
Gosub Waste
Loop
Program 4
Type in this program, compile and load onto the chip. Try pressing the switches on the
STK200
Dim B As Byte
Out &H37 , &HFF
Do
B = Inp(&H30)
Out &H38 , B
Loop
The AT90S2313 has 15 input/output pins, what effect does this have on how your
program behaves?
Program 6
L(1) = &HE7
L(2) = &HDB
L(3) = &HBD
L(4) = &H7E
DO
For X=1 To 4
Out &H38 , L(X)
GOSUB delay
Next X
Do
S2=Inp(&h30)
S2=S2 And &h02
Loop Until S2 = 0
Loop
End
Program 7
Change the program so that it uses button 5 to make the sequence repeat
Program 8