?? 12864timer3.asm
字號:
;FastAVR Basic Compiler, ver.4.3.0, by MicroDesign
;Created 22:45:16, 24-05-2006
;
.include "C:\FastAVR3\inc\m16def.inc"
;
.DSEG
sec1: .byte 1
min: .byte 1
hour: .byte 1
day: .byte 1
month: .byte 1
year: .byte 2
_fmtC: .byte 1
_fmtD: .byte 1
_lchr: .byte 1
_s2tmp: .byte 2
_fntL: .byte 1
_fntH: .byte 1
.CSEG
.ORG 0x0000
rjmp _Reset
.ORG INT0addr
reti
.ORG INT1addr
reti
.ORG OC2addr
reti
.ORG OVF2addr
reti
.ORG ICP1addr
reti
.ORG OC1Aaddr
reti
.ORG OC1Baddr
reti
.ORG OVF1addr
jmp IntN8
_Reset:
ldi yl,byte1(RAMEND)
out SPL,yl
ldi yh,byte2(RAMEND)
out SPL+1,yh
sbiw yl,32
ldi zl,2
sts _fmtC,zl
ldi zl,0
sts _fmtD,zl
ldi zl,0x30
sts _lchr,zl
;****** USERS BASIC CODE **********************
;-Line--0017----year=2006:month=5:day=21:hour=12:min=0:sec1=0--
ldi zl,byte1(2006)
ldi zh,byte2(2006)
sts year,zl
sts year+1,zh
ldi zl,byte1(5)
sts month,zl
ldi zl,byte1(21)
sts day,zl
ldi zl,byte1(12)
sts hour,zl
ldi zl,byte1(0)
sts min,zl
ldi zl,byte1(0)
sts sec1,zl
;-Line--0018----Enable Interrupts--
sei
;-Line--0019----Enable Ovf1--
in zl,TIMSK
sbr zl,0x04
out TIMSK,zl
;-Line--0020----Timer1=&he3e0--
ldi zl,byte1(-7200)
ldi zh,byte2(-7200)
out TCNT1H,zh
out TCNT1L,zl
;-Line--0021----Start Timer1--
in zl,TCCR1B
sbr zl,5
out TCCR1B,zl
;-Line--0022----Set DDRB.2--
sbi DDRB,2
;-Line--0023----Reset PORTB.2--
cbi PORTB,2
;-Line--0024----Wait 1--
ldi zl,byte1(1)
call _Ws
;-Line--0025----Set PORTB.2--
sbi PORTB,2
;-Line--0026----GLcdInit--
call _HDini
;-Line--0027----Gcls--
call _HDCls
;-Line--0028----WaitMs 10--
ldi zl,byte1(10)
call _Wms
;-Line--0029----FontSet F0HD--
ldi zl,byte1(f0hd*2)
ldi zh,byte2(f0hd*2)
call _Fnt
;-Line--0030----GLcd(0,7),"http:www.basicavr.com"--
ldi r16,0
ldi r17,7
ldi zl,byte1(S000*2)
ldi zh,byte2(S000*2)
call _HDSc
;-Line--0031----Do--
L0000:
;-Line--0032----FontSet F3HD--
ldi zl,byte1(f3hd*2)
ldi zh,byte2(f3hd*2)
call _Fnt
;-Line--0033----Format(4,0)--
ldi zl,byte1(4)
sts _fmtC,zl
ldi zl,byte1(0)
sts _fmtD,zl
;-Line--0034----GLcd(5,4),year--
ldi r16,5
ldi r17,4
lds zl,year
lds zh,year+1
call _W2Str
call _HDBW
;-Line--0035----Format(2,0)--
ldi zl,byte1(2)
sts _fmtC,zl
ldi zl,byte1(0)
sts _fmtD,zl
;-Line--0036----GLcd(53,4),"-";month;"-";day--
ldi r16,53
ldi r17,4
ldi zl,byte1(S001*2)
ldi zh,byte2(S001*2)
call _HDSc
lds zl,month
call _B2Str
call _HDBW
ldi zl,byte1(S001*2)
ldi zh,byte2(S001*2)
call _HDSc
lds zl,day
call _B2Str
call _HDBW
;-Line--0037----GLcd(16,1),hour;":";min;":";sec1--
ldi r16,16
ldi r17,1
lds zl,hour
call _B2Str
call _HDBW
ldi zl,byte1(S002*2)
ldi zh,byte2(S002*2)
call _HDSc
lds zl,min
call _B2Str
call _HDBW
ldi zl,byte1(S002*2)
ldi zh,byte2(S002*2)
call _HDSc
lds zl,sec1
call _B2Str
call _HDBW
;-Line--0038----Loop--
rjmp L0000
L0001:
;-Line--0041----Interrupt Ovf1(),Save 3--
;-Line--0042----Timer1=&he3e0--
IntN8:
in r2,SREG
push zl
push zh
push r0
push r1
push r24
push r25
push xl
push xh
ldi zl,byte1(-7200)
ldi zh,byte2(-7200)
out TCNT1H,zh
out TCNT1L,zl
;-Line--0043----Incr sec1--
lds zl,sec1
inc zl
sts sec1,zl
;-Line--0044----If sec1=60 Then--
lds r24,sec1
ldi zl,byte1(60)
cp r24,zl
breq PC+0x02
rjmp L0003
L0004:
;-Line--0045----sec1=0--
ldi zl,byte1(0)
sts sec1,zl
;-Line--0046----Incr min--
lds zl,min
inc zl
sts min,zl
;-Line--0047----End If--
L0003:
L0002:
;-Line--0048----If min=60 Then--
lds r24,min
ldi zl,byte1(60)
cp r24,zl
breq PC+0x02
rjmp L0006
L0007:
;-Line--0049----min=0--
ldi zl,byte1(0)
sts min,zl
;-Line--0050----Incr hour--
lds zl,hour
inc zl
sts hour,zl
;-Line--0051----End If--
L0006:
L0005:
;-Line--0052----If hour=24 Then--
lds r24,hour
ldi zl,byte1(24)
cp r24,zl
breq PC+0x02
rjmp L0009
L0010:
;-Line--0053----hour=0--
ldi zl,byte1(0)
sts hour,zl
;-Line--0054----Incr day--
lds zl,day
inc zl
sts day,zl
;-Line--0055----End If--
L0009:
L0008:
;-Line--0056----If day=32 Then--
lds r24,day
ldi zl,byte1(32)
cp r24,zl
breq PC+0x02
rjmp L0012
L0013:
;-Line--0057----day=1--
ldi zl,byte1(1)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -