📄 about pdto.asm
字号:
#include "mk7a20p.inc"
;--------------------------------------
;芯片型号(mk7a20p)
;--------------------------------------
;配置寄存器设置说明(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 ;按键次数
org 0x7ff ;mk7a20p的复位向量地址定义
lgoto main ;跳转到主程序入口
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,预分频比为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
;根据按键的次数
;查表LED该显示的数据
;并送显示
mov dis_r,a
lcall led_table
movam portb
;--------------------------------
;累计按键按下的次数
inc dis_r,m
movla .8
sub dis_r,a
btsc status,c
clr dis_r
;--------------------------------
wait
;2分钟定时
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -