?? ex_support.s
字號:
.module EX_Support.c
.area text(rom, con, rel)
.dbfile D:\設計項目\深入淺出AVR\光盤文件\實例程序源代碼\實例11_漸明漸暗的燈\漸明漸暗的燈\EX_Support.c
.dbfunc s Driver_INIT _Driver_INIT fV
.even
_Driver_INIT:
.dbline -1
.dbline 87
; /***********************************************************
; * 函數庫說明:底層硬件初始化驅動函數庫 *
; * 版本: *
; * 作者: *
; * 創建日期: *
; * -------------------------------------------------------- *
; * [硬件說明] *
; * 處理器: *
; * 系統時鐘: *
; * -------------------------------------------------------- *
; * [支 持 庫] *
; * 支持庫名稱:HD_Support.h *
; * 需要版本: ----- *
; * 支持庫說明:底層硬件初始化聲明庫 *
; * *
; * 支持庫名稱:EX_Support.h *
; * 需要版本: ----- *
; * 支持庫說明:底層硬件初始化驅動聲明庫 *
; * *
; * 支持庫名稱:PF_Config.h *
; * 需要版本: ----- *
; * 支持庫說明:硬件平臺配置聲明庫 *
; * -------------------------------------------------------- *
; * [版本更新] *
; * 修改: *
; * 修改日期: *
; * 版本: *
; * -------------------------------------------------------- *
; * [版本歷史] *
; * -------------------------------------------------------- *
; * [使用說明] *
; ***********************************************************/
;
; /********************
; * 頭 文 件 配 置 區 *
; ********************/
; # include "PF_Config.h"
; # include "HD_Support.h"
; # include "EX_Support.h"
;
;
; /********************
; * 系 統 宏 定 義 *
; ********************/
;
; /*------------------*
; * 常 數 宏 定 義 *
; *------------------*/
;
; /*------------------*
; * 動 作 宏 定 義 *
; *------------------*/
;
; /********************
; * 模塊結構體定義區 *
; ********************/
;
; /********************
; * 函 數 聲 明 區 *
; ********************/
; void System_INIT(void);
; void Delay_MS(uint16 wTime);
; void Insert_Timer0_OVF_ISR_Code(void);
;
; /********************
; * 模塊函數聲明區 *
; ********************/
; static void Driver_INIT(void);
;
; /********************
; * 模塊變量聲明區 *
; ********************/
; //static uint16 s_wSystemDelayTimerCounter = 0;
;
; /********************
; * 全局變量聲明區 *
; ********************/
; //uint16 g_wSystemTimer = 0;
;
; /***********************************************************
; * 函數說明:軟件驅動初始化函數 *
; * 輸入: 無 *
; * 輸出: 無 *
; * 調用函數:無 *
; ***********************************************************/
; static void Driver_INIT(void)
; {
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e System_INIT _System_INIT fV
.even
_System_INIT::
.dbline -1
.dbline 98
; //*在這里插入你的各類軟件驅動初始化代碼*//
; }
;
; /***********************************************************
; * 函數說明:系統初始化函數 *
; * 輸入: 無 *
; * 輸出: 無 *
; * 調用函數:Device_INIT() Driver_INIT() *
; ***********************************************************/
; void System_INIT(void)
; {
.dbline 99
; CLI();
cli
.dbline 101
;
; Device_INIT();
rcall _Device_INIT
.dbline 102
; Driver_INIT();
rcall _Driver_INIT
.dbline 106
;
; //*在這里插入你的系統環境變量初始化代碼*//
;
; SEI();
sei
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Insert_Timer1_OVF_ISR_Code _Insert_Timer1_OVF_ISR_Code fV
.even
_Insert_Timer1_OVF_ISR_Code::
.dbline -1
.dbline 146
; }
;
; ///***********************************************************
; //* 函數說明:系統毫秒延時函數 *
; //* 輸入: 需要延時的時間長度 *
; //* 輸出: 無 *
; //* 調用函數:無 *
; //***********************************************************/
; //void Delay_MS(uint16 wTime)
; //{
; // s_wSystemDelayTimerCounter = wTime;
; //
; // while(s_wSystemDelayTimerCounter);
; //}
; //
; ///***********************************************************
; //* 函數說明:定時器0中斷處理程序代碼插入函數 *
; //* 輸入: 無 *
; //* 輸出: 無 *
; //* 調用函數:無 *
; //***********************************************************/
; //void Insert_Timer0_OVF_ISR_Code (void)
; //{
; // g_wSystemTimer++;
; //
; // if (s_wSystemDelayTimerCounter)
; // {
; // s_wSystemDelayTimerCounter--;
; // }
; //}
;
; /***********************************************************
; * 函數說明:定時器1中斷處理程序代碼插入函數 *
; * 輸入: 無 *
; * 輸出: 無 *
; * 調用函數:無 *
; ***********************************************************/
;
; void Insert_Timer1_OVF_ISR_Code (void)
; {
.dbline 147
; TCNT1 = 0xFF3D; //重新加載定時器1
ldi R24,65341
ldi R25,255
sts 132+1,R25
sts 132,R24
.dbline 148
; PORTC ^= 0b00100000; //PC5端口發光管閃爍
ldi R24,32
in R2,0x8
eor R2,R24
out 0x8,R2
.dbline 149
; switch (direction) //調整PWM波占空比,以改變亮度
lds R16,_direction
clr R17
cpi R16,0
cpc R16,R17
breq L7
X0:
cpi R16,1
ldi R30,0
cpc R17,R30
breq L10
rjmp L4
X1:
.dbline 150
; {
L7:
.dbline 152
; case L_dw : //亮度變化趨勢控制標志為增強方向時的處理
; {
.dbline 153
; light += 0x02;
lds R24,_light
subi R24,254 ; addi 2
sts _light,R24
.dbline 154
; if (light > 0x83) //如果亮度達到最小,則保持該亮度,并且換亮度變化趨勢控制標志為增強方向
ldi R24,131
lds R2,_light
cp R24,R2
brsh L5
.dbline 155
; {
.dbline 156
; light = 0x83;
sts _light,R24
.dbline 157
; direction = L_up;
ldi R24,1
sts _direction,R24
.dbline 158
; }
.dbline 159
; break;
rjmp L5
L10:
.dbline 163
; }
;
; case L_up : //亮度變化趨勢控制標志為減弱方向時的處理
; {
.dbline 164
; light -=0x02;
lds R24,_light
subi R24,2
sts _light,R24
.dbline 165
; if (light < 0x03) //如果亮度達到最大,則保持該亮度,并且換亮度變化趨勢控制標志為減弱方向
cpi R24,3
brsh L5
.dbline 166
; {
.dbline 167
; light = 0x00;
clr R2
sts _light,R2
.dbline 168
; direction = L_dw;
sts _direction,R2
.dbline 169
; }
.dbline 170
; break;
L4:
L5:
.dbline 173
; }
; }
; OCR0B = light;
lds R2,_light
out 0x28,R2
.dbline -2
L3:
.dbline 0 ; func end
ret
.dbend
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -