⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex_support.s

📁 《深入浅出AVR单片机——从ATmega48/88/168开始》的实例程序源代码
💻 S
📖 第 1 页 / 共 2 页
字号:
	.module EX_Support.c
	.area data(ram, con, rel)
_p::
	.blkb 2
	.area idata
	.word 0
	.area data(ram, con, rel)
	.dbfile D:\实例17_I2C抢答器_主机程序\EX_Support.c
	.dbsym e p _p pc
_g_wSystemTimer::
	.blkb 2
	.area idata
	.word 0
	.area data(ram, con, rel)
	.dbfile D:\实例17_I2C抢答器_主机程序\EX_Support.c
	.dbsym e g_wSystemTimer _g_wSystemTimer i
_DoTime::
	.blkb 1
	.area idata
	.byte 1
	.area data(ram, con, rel)
	.dbfile D:\实例17_I2C抢答器_主机程序\EX_Support.c
	.dbsym e DoTime _DoTime c
_ShowTime::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile D:\实例17_I2C抢答器_主机程序\EX_Support.c
	.dbsym e ShowTime _ShowTime c
_TWIProcess::
	.blkb 1
	.area idata
	.byte 1
	.area data(ram, con, rel)
	.dbfile D:\实例17_I2C抢答器_主机程序\EX_Support.c
	.dbsym e TWIProcess _TWIProcess c
	.area lit(rom, con, rel)
_DisTab::
	.byte 252,96
	.byte 218,242
	.byte 'f,182
	.byte 190,224
	.byte 254,246
	.byte 238,62
	.byte 156,'z
	.byte 158,142
	.byte 206,28
	.byte 'n,124
	.byte 10,16
	.byte 2,0
	.dbsym e DisTab _DisTab A[24:24]kc
	.area text(rom, con, rel)
	.dbfile D:\实例17_I2C抢答器_主机程序\EX_Support.c
	.dbfunc e Delay_ms _Delay_ms fV
;              n -> R20
;           Time -> R16,R17
	.even
_Delay_ms::
	rcall push_gset1
	.dbline -1
	.dbline 136
; /***********************************************************
; *   函数库说明:底层硬件初始化驱动函数库                   *
; *   版本:                                                 *
; *   作者:                                                 *
; *   创建日期:                                             *
; * -------------------------------------------------------- *
; *  [硬件说明]                                              *
; *   处理器:                                               *
; *   系统时钟:                                             *
; * -------------------------------------------------------- *
; *  [支 持 库]                                              *
; *   支持库名称:HD_Support.h                               *
; *   需要版本:  -----                                      *
; *   支持库说明:底层硬件初始化声明库                       *
; *                                                          *
; *   支持库名称:EX_Support.h                               *
; *   需要版本:  -----                                      *
; *   支持库说明:底层硬件初始化驱动声明库                   *
; *                                                          *
; *   支持库名称:PF_Config.h                                *
; *   需要版本:  -----                                      *
; *   支持库说明:硬件平台配置声明库                         *
; * -------------------------------------------------------- *
; *  [版本更新]                                              *
; *   修改:                                                 *
; *   修改日期:                                             *
; *   版本:                                                 *
; * -------------------------------------------------------- *
; *  [版本历史]                                              *
; * -------------------------------------------------------- *
; *  [使用说明]                                              *
; ***********************************************************/
; 
; /********************
; * 头 文 件 配 置 区 *
; ********************/
; # include "PF_Config.h"
; # include "HD_Support.h"
; # include "EX_Support.h"
; 
; 
; /********************
; *   系 统 宏 定 义  *
; ********************/
; 
; /*------------------*
; *   常 数 宏 定 义  *
; *------------------*/
; 
; #define SSend           0x08            //启动位已发送
; #define RSSend          0x10            //复启动位已发送
; #define SLAWSendACK     0x18            //SLA+W已发送,收到ACK
; #define SLAWSendNAK     0x20            //SLA+W已发送,收到NAK
; #define SLARSendACK     0x40            //SLA+R已发送,收到ACK
; #define SLARSendNAK     0x48            //SLA+R已发送,收到ACK
; #define TDataACK        0x28            //DATA已发送,收到ACK
; #define TDataNAK        0x30            //DATA已发送,收到NAK
; #define RDataACK        0x50            //DATA已收到,ACK已发送
; #define RDataNAK        0x58            //DATA已收到,NAK已发送
; #define SLAWRecACK      0x60            //自己的从机地址被选中,ACK已返回
; #define SRDataACK       0x80            //作为从机被地址被选中,数据已接收,ACK已返回
; 
; #define TWIInProcess    0x00            //EEPROM操作中
; #define TWIProcessOver  0x01            //EEPROM操作成功完成
; #define TWIProcessNAK   0x11            //EEPROM操作中无法接收到主机应答
; #define TWIProcessERR   0x21            //EEPROM操作遇到未知错误而终止
; 
; #define ExtPortNum 3
; #define TimeStampMax 1000
; 
; /*------------------*
; *   动 作 宏 定 义  *
; *------------------*/
; 
; #define SS_Low PORTB &= ~(1<<2)
; #define SS_High PORTB |= (1<<2)
; 
; #define PINE PortBuffer[0]
; #define PORTF PortBuffer[1]
; #define PORTG PortBuffer[2]
; 
; #define KeyPin PINE
; #define ScanPort PORTG
; #define SegPort PORTF
; 
; /********************
; *  模块结构体定义区 *
; ********************/
; 
; /********************
; *   函 数 声 明 区  *
; ********************/
; void System_INIT(void);
; void Insert_Timer0_OVF_ISR_Code(void);
; 
; /********************
; *   模块函数声明区  *
; ********************/
; static void Driver_INIT(void);
; 
; /********************
; *   模块变量声明区  *
; ********************/
; 
; unsigned char* p = NULL;
; 
; /********************
; *   全局变量声明区  *
; ********************/
; uint16 g_wSystemTimer = 0;
; BOOL DoTime = TRUE;
; BOOL ShowTime = FALSE;
; 
; unsigned char PortBuffer[3];
; unsigned char LEDDisBuffer[8];
; unsigned char TWIProcess = TWIProcessOver;
; unsigned char RecArr[6];
; unsigned int g_wSystemTimer;
; 
; const unsigned char DisTab[]=
; {
; 	0xFC,0x60,0xDA,0xF2,0x66,	//0,1,2,3,4
; 	0xB6,0xBE,0xE0,0xFE,0xF6,	//5,6,7,8,9
; 	0xEE,0x3E,0x9C,0x7A,0x9E,	//A,b,C,d,E
; 	0x8E,0xCE,0x1C,0x6E,0x7C,	//F,P,L,H,U
; 	0x0A,0x10,0x02,0x00 		//r,_,-,SP
; };
; 
; /***********************************************************
; *   函数说明:毫秒级延时函数                               *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:无                                           *
; ***********************************************************/
; void Delay_ms(unsigned int Time)
; {
	.dbline 137
;     unsigned char n=0;
	clr R20
	rjmp L3
L2:
	.dbline 139
;     while(Time>0)
;     {
	.dbline 140
;         for (n=1;n<187;n++)
	ldi R20,1
	rjmp L8
L5:
	.dbline 141
	.dbline 142
	nop
	.dbline 143
L6:
	.dbline 140
	inc R20
L8:
	.dbline 140
	cpi R20,187
	brlo L5
	.dbline 144
	subi R16,1
	sbci R17,0
	.dbline 145
L3:
	.dbline 138
	cpi R16,0
	cpc R16,R17
	brne L2
X0:
	.dbline -2
L1:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r n 20 c
	.dbsym r Time 16 i
	.dbend
	.dbfunc e Beep _Beep fV
;           Time -> R20,R21
	.even
_Beep::
	rcall push_gset1
	movw R20,R16
	.dbline -1
	.dbline 155
;         {
;             NOP();
;         }
;         Time--;
;     }
; }
; 
; /***********************************************************
; *   函数说明:蜂鸣器鸣叫函数                               *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:无                                           *
; ***********************************************************/
; void Beep (unsigned int Time)
; {
	.dbline 156
;     PORTB |= 0x01;
	sbi 0x5,0
	.dbline 157
;     Delay_ms(Time);
	movw R16,R20
	rcall _Delay_ms
	.dbline 158
;     PORTB &= 0xFE;
	in R24,0x5
	andi R24,254
	out 0x5,R24
	.dbline -2
L9:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r Time 20 i
	.dbend
	.dbfunc s Driver_INIT _Driver_INIT fV
	.even
_Driver_INIT:
	.dbline -1
	.dbline 168
; }
; 
; /***********************************************************
; *   函数说明:软件驱动初始化函数                           *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:无                                           *
; ***********************************************************/
; static void Driver_INIT(void)
; {
	.dbline -2
L10:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e System_INIT _System_INIT fV
	.even
_System_INIT::
	.dbline -1
	.dbline 179
;     //*在这里插入你的各类软件驱动初始化代码*//
; }
; 
; /***********************************************************
; *   函数说明:系统初始化函数                               *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:Device_INIT() Driver_INIT()                  *
; ***********************************************************/
; void System_INIT(void)
; {
	.dbline 180
;     CLI();
	cli
	.dbline 182
;     
;     Device_INIT();
	rcall _Device_INIT
	.dbline 183
;     Driver_INIT();
	rcall _Driver_INIT
	.dbline 187
;     
;     //*在这里插入你的系统环境变量初始化代码*//
;     
;     SEI();
	sei
	.dbline -2
L11:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Insert_Timer0_OVF_ISR_Code _Insert_Timer0_OVF_ISR_Code fV
	.even
_Insert_Timer0_OVF_ISR_Code::
	.dbline -1
	.dbline 197
; }
; 
; /***********************************************************
; *   函数说明:定时器0中断处理程序代码插入函数              *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:无                                           *
; ***********************************************************/
; void Insert_Timer0_OVF_ISR_Code(void)
; {
	.dbline 198
;     TCNT0 = 0x83;                       //重载定时器
	ldi R24,131
	out 0x26,R24
	.dbline 200
;     
;     g_wSystemTimer++;                   //时标产生,以1秒为周期循环时标
	lds R24,_g_wSystemTimer
	lds R25,_g_wSystemTimer+1
	adiw R24,1
	sts _g_wSystemTimer+1,R25
	sts _g_wSystemTimer,R24
	.dbline 202
;     
;     if (g_wSystemTimer >= TimeStampMax)
	cpi R24,232
	ldi R30,3
	cpc R25,R30
	brlo L13
	.dbline 203
;         g_wSystemTimer = 0;
	clr R2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -