Code:
'//////////////////////////////////////////////////////////
'/// FastAVR Basic Compiler for AVR by MICRODESIGN ///
'/// Mooving LED for STK-200, 500 ///
'//////////////////////////////////////////////////////////
$Device= m16 ' used device
$Stack = 32 ' stack depth
$Clock = 8. ' used crystal
$Source= On ' basic source in Asm
Dim n As Byte
DDRB=&hff ' PortB is output
n=&hfe ' init n
Do ' never ending loop
PORTB=n ' n out to port
Rotate(Left, 1, n) ' rotate n left one bit
WaitMs 100 ' 100ms delay
Loop ' back to start of loop
;FastAVR Basic Compiler, ver.4.1.3, by MicroDesign
;Created 23:45:08, 29-08-2005
;
.include "D:\FASTAVR\inc\m16def.inc"
;
.DSEG
n: .byte 1
.CSEG
.ORG 0
_Reset:
ldi yl,low(RAMEND)
out SPL,yl
ldi yh,high(RAMEND)
out SPL+1,yh
sbiw yl,32
;****** USERS BASIC CODE **********************
;-Line--0012----DDRB=&hff ' PortB is output--
ldi zl,low(255)
out ddrb,zl
;-Line--0013----n=&hfe ' init n--
ldi zl,low(254)
sts n,zl
;-Line--0015----Do ' never ending loop--
L0000:
;-Line--0016----PORTB=n ' n out to port--
lds zl,n
out portb,zl
;-Line--0017----Rotate(Left, 1, n) ' rotate n left one bit--
lds zl,n
ldi r24,1
call _RotBL
sts n,zl
;-Line--0018----WaitMs 100 ' 100ms delay--
ldi zl,low(100)
call _Wms
;-Line--0019----Loop ' back to start of loop--
rjmp L0000
L0001:
;****** END OF USER BASIC CODE ****************
;////// RotateLeftByte ////////////////////
_RotBL: lsl zl
brcc _RtBL1
sbr zl,1
_RtBL1: dec r24
brne _RotBL
ret
;////// _Waitms ///////////////////////////
_Wms: ldi r20,0x14
_Wms1: ldi r21,0x85
_Wms2: dec r21
brne _Wms2
dec r20
brne _Wms1
dec zl
brne _Wms
ret
;System Global Variables: 0 bytes
;User Global Variables: 1 bytes
'/////////////////////////////////////////////////////////
'/// FastAVR Basic Compiler for AVR by MICRODESIGN ///
'/// World famous program ///
'/// HelloWorld.bas www.FastAVR.com ///
'/////////////////////////////////////////////////////////
$Device= m16 ' used device
$Stack = 28 ' stack depth
$Clock = 8.0 ' adjust for used crystal
$Baud = 9600
$Source= On ' basic source in Asm
' use FastAVR or any other Terminal emulator
Print "Hello World!"
End
;FastAVR Basic Compiler, ver.4.1.3, by MicroDesign
;Created 23:46:11, 29-08-2005
;
.include "D:\FASTAVR\inc\m16def.inc"
;
.DSEG
.CSEG
.ORG 0
_Reset:
ldi yl,low(RAMEND)
out SPL,yl
ldi yh,high(RAMEND)
out SPL+1,yh
sbiw yl,28
ldi zl,0x18
out UCSRB,zl
ldi zh,high(51)
ldi zl,low(51)
out UBRRL,zl
out UBRRH,zh
;****** USERS BASIC CODE **********************
;-Line--0013----Print "Hello World!"--
ldi zl,low(S000*2)
ldi zh,high(S000*2)
call _PSc
call _PCL
;-Line--0015----End--
L0000:
jmp L0000
;****** END OF USER BASIC CODE ****************
; String constants:
S000: .db "Hello World!", 0
;////// Print string constants ////////////
_PSc: lpm
tst r0
breq _PSc1
mov r24,r0
rcall _Pch
adiw zl,1
rjmp _PSc
_Psc1: ret
;////// Print Cr, Lf & any char////////////
_PCL: ldi r24,0x0d
rcall _Pch
ldi r24,0x0a
_Pch: sbis UCSRA,5
rjmp _Pch
out UDR,r24
ret
;System Global Variables: 0 bytes
;User Global Variables: 0 bytes
Lesezeichen