'****************************************************************************************** ' AVR Sample Program ' Project : ' Program Name : ' Programer : ' Create date : Version 1.0 H19.01.10 ' History : ' Laungage : BASCOM-AVR BASIC '****************************************************************************************** ' (1)Description ' '****************************************************************************************** ' ============================== ' 1.Define Segment ' ============================== $regfile = "2313def.dat" $crystal = 10000000 'Used 10MHz OSC $baud = 9600 '9600BPS Dim Lp As Integer Dim Mled As Integer Dim Ledlst As Integer Declare Sub Moveled(ledlst As Integer) Config Portb = Output ' ============================== ' 2.Program Segment ' ============================== Ledlst = 1 Portb = 1 Print "AVR AT90S2313 Connected OK! " Do Input "Move n=" , Mled For Lp = 1 To Mled Step 1 Call Moveled(ledlst) Portb = Ledlst Waitms 100 Next Lp Loop '****************************************************************************************** ' Function Name : Moveled ' Title : Move LED LIST (Sift LED) ' Input : ' Output : '****************************************************************************************** Sub Moveled(ledlst As Integer) If Ledlst = 1 Then Ledlst = 2 Elseif Ledlst > 127 Then Ledlst = 1 Else Ledlst = Ledlst * 2 End If End Sub End