📄 ex_support.s
字号:
.module EX_Support.c
.area text(rom, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
_s_wSystemDelayTimerCounter:
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
_s_cDISPCode:
.blkb 2
.area idata
.byte 63,6
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 91,'O
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 'f,'m
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 125,7
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 127,'o
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 'w,124
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 57,94
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 'y,'q
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 0,64
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 8,1
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 2
.area idata
.byte 'c,57
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.blkb 1
.area idata
.byte 15
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
_g_wSystemTimer::
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
_g_chCounter::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.area text(rom, con, rel)
.dbfile E:\学习\实践班\单片机程序\硬件SPI\SPI_595\Project_Template_Basic\EX_Support.c
.dbfunc e Driver_INIT _Driver_INIT fV
.even
_Driver_INIT::
.dbline -1
.dbline 89
; /***********************************************************
; * 函数库说明:底层硬件初始化驱动函数库 *
; * 版本: *
; * 作者: *
; * 创建日期: *
; * -------------------------------------------------------- *
; * [硬件说明] *
; * 处理器: *
; * 系统时钟: *
; * -------------------------------------------------------- *
; * [支 持 库] *
; * 支持库名称:HD_Support.h *
; * 需要版本: ----- *
; * 支持库说明:底层硬件初始化声明库 *
; * *
; * 支持库名称:EX_Support.h *
; * 需要版本: ----- *
; * 支持库说明:底层硬件初始化驱动声明库 *
; * *
; * 支持库名称:PF_Config.h *
; * 需要版本: ----- *
; * 支持库说明:硬件平台配置声明库 *
; * -------------------------------------------------------- *
; * [版本更新] *
; * 修改: *
; * 修改日期: *
; * 版本: *
; * -------------------------------------------------------- *
; * [版本历史] *
; * -------------------------------------------------------- *
; * [使用说明] *
; ***********************************************************/
;
; /********************
; * 头 文 件 配 置 区 *
; ********************/
; # include "PF_Config.h"
; # include "Ex_Support.h"
;
; /********************
; * 系 统 宏 定 义 *
; ********************/
;
; /*------------------*
; * 常 数 宏 定 义 *
; *------------------*/
;
; /*------------------*
; * 动 作 宏 定 义 *
; *------------------*/
;
; /********************
; * 模块结构体定义区 *
; ********************/
;
; /********************
; * 函 数 声 明 区 *
; ********************/
; void Insert_Timer0_OVF_ISR_Code(void);
; void Driver_INIT(void);
; void Delay_MS(uint16 wTime);
; void Insert_SPI_STC_ISR_Code(void);
;
; /********************
; * 模块函数声明区 *
; ********************/
;
;
; /********************
; * 模块变量声明区 *
; ********************/
; static uint16 s_wSystemDelayTimerCounter = 0;
; static const unsigned char s_cDISPCode[] ={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
; 0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,
; 0x00,0x40,0x08,0x01,0x63,0x39,0x0f};
; /********************
; * 全局变量声明区 *
; ********************/
; uint16 g_wSystemTimer = 0;
; UINT8 g_chCounter = 0;
;
; /***********************************************************
; * 函数说明:软件驱动初始化函数 *
; * 输入: 无 *
; * 输出: 无 *
; * 调用函数:无 *
; ***********************************************************/
; void Driver_INIT(void)
; {
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Delay_MS _Delay_MS fV
; wTime -> R16,R17
.even
_Delay_MS::
.dbline -1
.dbline 100
; //*在这里插入你的各类软件驱动初始化代码*//
; }
;
; /***********************************************************
; * 函数说明:系统毫秒延时函数 *
; * 输入: 需要延时的时间长度 *
; * 输出: 无 *
; * 调用函数:无 *
; ***********************************************************/
; void Delay_MS(uint16 wTime)
; {
.dbline 101
; s_wSystemDelayTimerCounter = wTime;
sts _s_wSystemDelayTimerCounter+1,R17
sts _s_wSystemDelayTimerCounter,R16
L3:
.dbline 103
;
; while(s_wSystemDelayTimerCounter);
L4:
.dbline 103
lds R2,_s_wSystemDelayTimerCounter
lds R3,_s_wSystemDelayTimerCounter+1
tst R2
brne L3
tst R3
brne L3
X0:
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbsym r wTime 16 i
.dbend
.dbfunc e Insert_Timer0_OVF_ISR_Code _Insert_Timer0_OVF_ISR_Code fV
.even
_Insert_Timer0_OVF_ISR_Code::
.dbline -1
.dbline 113
; }
;
; /***********************************************************
; * 函数说明:定时器0中断处理程序代码插入函数 *
; * 输入: 无 *
; * 输出: 无 *
; * 调用函数:无 *
; ***********************************************************/
; void Insert_Timer0_OVF_ISR_Code(void)
; {
.dbline 114
; g_wSystemTimer++;
lds R24,_g_wSystemTimer
lds R25,_g_wSystemTimer+1
adiw R24,1
sts _g_wSystemTimer+1,R25
sts _g_wSystemTimer,R24
.dbline 116
;
; if (s_wSystemDelayTimerCounter) //若计数器累加不为零
lds R2,_s_wSystemDelayTimerCounter
lds R3,_s_wSystemDelayTimerCounter+1
tst R2
brne X1
tst R3
breq L7
X1:
.dbline 117
; {
.dbline 118
; s_wSystemDelayTimerCounter--;
movw R24,R2
sbiw R24,1
sts _s_wSystemDelayTimerCounter+1,R25
sts _s_wSystemDelayTimerCounter,R24
.dbline 119
; }
L7:
.dbline 121
;
; if (!(g_wSystemTimer & (BIT(10) - 1))) //除以2的10次方取余为0
lds R24,_g_wSystemTimer
lds R25,_g_wSystemTimer+1
andi R25,3
cpi R24,0
cpc R24,R25
brne L9
X2:
.dbline 122
; {
.dbline 123
; g_chCounter++;
lds R24,_g_chCounter
subi R24,255 ; addi 1
sts _g_chCounter,R24
.dbline 124
; g_chCounter &= (BIT(4)-1); //对2的4次方取余
andi R24,15
sts _g_chCounter,R24
.dbline 125
; }
L9:
.dbline -2
L6:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Insert_SPI_STC_ISR_Code _Insert_SPI_STC_ISR_Code fV
; n1 -> R22
; bIfKeyPressed0 -> R20
; chKeyNUM0 -> R10
.even
_Insert_SPI_STC_ISR_Code::
rcall push_xgsetF00C
.dbline -1
.dbline 129
; }
;
; void Insert_SPI_STC_ISR_Code(void)
; {
.dbline 130
; UINT8 chKeyNUM = ~SPDR; //读取数据寄存器存贮的数据
in R10,0xf
com R10
.dbline 131
; UINT8 n = 0;
.dbline 132
; BOOL bIfKeyPressed = FALSE;
clr R20
.dbline 134
;
; PORT_SS = HIGH; //SS拉高
in R24,0x18
ori R24,4
out 0x18,R24
.dbline 135
; PORT_SS = LOW; //ss拉低
in R24,0x18
andi R24,251
out 0x18,R24
.dbline 136
; for (n = 0;n < 8;n++) //读取数据的每一位
clr R22
rjmp L15
L12:
.dbline 137
; {
.dbline 138
; if (chKeyNUM & BIT(n)) //读取第n位
ldi R16,1
mov R17,R22
rcall lsl8
mov R2,R10
and R2,R16
breq L16
X3:
.dbline 139
; {
.dbline 140
; SPDR = ~s_cDISPCode[n];
ldi R24,<_s_cDISPCode
ldi R25,>_s_cDISPCode
mov R30,R22
clr R31
add R30,R24
adc R31,R25
ldd R2,z+0
com R2
out 0xf,R2
.dbline 141
; bIfKeyPressed = TRUE;
ldi R20,1
.dbline 142
; break;
rjmp L14
L16:
.dbline 144
; }
; }
L13:
.dbline 136
inc R22
L15:
.dbline 136
cpi R22,8
brlo L12
X4:
L14:
.dbline 146
;
; if (!bIfKeyPressed)
tst R20
brne L18
X5:
.dbline 147
; {
.dbline 148
; SPDR = ~s_cDISPCode[g_chCounter];
ldi R24,<_s_cDISPCode
ldi R25,>_s_cDISPCode
lds R30,_g_chCounter
clr R31
add R30,R24
adc R31,R25
ldd R2,z+0
com R2
out 0xf,R2
.dbline 149
; }
L18:
.dbline -2
L11:
.dbline 0 ; func end
rjmp pop_xgsetF00C
.dbsym r n1 22 c
.dbsym r bIfKeyPressed0 20 c
.dbsym r chKeyNUM0 10 c
.dbend
; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -