?? 12864timer3.bas
字號:
'///////////////////////////////////////
$Device= m16 ' used device
$Stack = 32 ' stack size
$Clock = 7.3728
$Timer1=Timer, Prescale=1024
$GLCD ks0108b, Data=PORTC, Ctrl=PORTB, 128, 64, 2
$Gctrl CS1=7, CS2=6, DI=3, WR=4, EN=5
$Source= On
$LeadChar="0" ,Format(2,0)
Declare Interrupt Ovf1()
Dim F0HD As Flash Byte
Dim F1HD As Flash Byte
Dim F2HD As Flash Byte
Dim F3HD As Flash Byte
Dim sec1 As Byte, min As Byte, hour As Byte
Dim day As Byte, month As Byte, year As Word
year=2006:month=5:day=21:hour=12:min=0:sec1=0
Enable Interrupts
Enable Ovf1
Timer1=&he3e0
Start Timer1
Set DDRB.2
Reset PORTB.2
Wait 1
Set PORTB.2
GLcdInit
Gcls
WaitMs 10
FontSet F0HD
GLcd(0,7),"http:www.basicavr.com"
Do
FontSet F3HD
Format(4,0)
GLcd(5,4),year
Format(2,0)
GLcd(53,4),"-";month;"-";day
GLcd(16,1),hour;":";min;":";sec1
Loop
'////////////////////////////////////////////////
Interrupt Ovf1(),Save 3
Timer1=&he3e0
Incr sec1
If sec1=60 Then
sec1=0
Incr min
End If
If min=60 Then
min=0
Incr hour
End If
If hour=24 Then
hour=0
Incr day
End If
If day=32 Then
day=1
Incr month
ElseIf day=31 Then
If month=4 Or month=6 Or month=9 Or month=11 Then
day=1
Incr month
End If
ElseIf day=30 Then
If month=2 Then
day=1
Incr month
End If
ElseIf day=29 Then
If month=2 And (year mod 4)>0 Then
day=1
Incr month
End If
End If
If month=13 Then
month=1
Incr year
End If
Enable Interrupts
End Interrupt
$Include"c:\fastavr\F0HD.bas"
$Include"c:\fastavr\F1HD.bas"
$Include"c:\fastavr\F2HD.bas"
$Include"c:\fastavr\F3HD.bas"
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -