?? about pdto.asm
字號(hào):
#include "mk7a20p.inc"
;--------------------------------------
;芯片型號(hào)(mk7a20p)
;--------------------------------------
;配置寄存器設(shè)置說明(config)
;1---------FOSE=NS ;LS,NS,HS,RC
;2---------WDTE=Disable ;Enable,Disable
;3---------CPT=OFF ;ON,OFF
;4---------LV=2V ;4V,2V,Don't Use
;5---------RTCEN=Timer input only ;Timer input only,PA4 input
;6---------TYPE=has no wakeup function ;has wakeup function,has no wakeup function
;--------------------------------------
tm_r0 equ 0x08
tm_r1 equ 0x09
dis_r equ 0x0a ;按鍵次數(shù)
org 0x7ff ;mk7a20p的復(fù)位向量地址定義
lgoto main ;跳轉(zhuǎn)到主程序入口
org 0x000
led_table
add pc,m
retla b'00000001'
retla b'00000010'
retla b'00000100'
retla b'00001000'
retla b'00010000'
retla b'00100000'
retla b'01000000'
retla b'10000000'
org 0x100 ;主程序入口地址定義
main
;PortA端口
movla b'11111111'
iodir porta
;--------------------------------
;PortB端口
movla b'00000000'
iodir portb
;--------------------------------
;配置TMR0,預(yù)分頻比為1:8
;TMR0初值為0
movla b'00000010'
select
clr tmr0
;--------------------------------
;RAM初始化
clr tm_r0
clr tm_r1
;--------------------------------
btss status,pd
lgoto display
;--------------------------------
into_sleep
clr portb
clr porta
clr dis_r
sleep
nop
nop
nop
;--------------------------------
display
;根據(jù)按鍵的次數(shù)
;查表LED該顯示的數(shù)據(jù)
;并送顯示
mov dis_r,a
lcall led_table
movam portb
;--------------------------------
;累計(jì)按鍵按下的次數(shù)
inc dis_r,m
movla .8
sub dis_r,a
btsc status,c
clr dis_r
;--------------------------------
wait
;2分鐘定時(shí)
movla .250
xor tmr0,a
btss status,z
lgoto wait
clr tmr0
inc tm_r0,m
movla .250
xor tm_r0,a
btss status,z
lgoto wait
clr tm_r0
inc tm_r1,m
movla .250
xor tm_r1,a
btss status,z
lgoto wait
clr tm_r1
lgoto into_sleep
End
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -