; Asm codes generated by Shanghai Haier C Compiler
; HRCO, Ver: 1.0,0117

#INCLUDE       	<ES7P169C.INC>
#INCLUDE       	<OPERATION.INC>
	PUBLIC         	_g_10ms_flag
	PUBLIC         	_period
	PUBLIC         	_RAMclear
	PUBLIC         	_GPIOInit
	PUBLIC         	_T8NInit
	PUBLIC         	_isr
	PUBLIC         	_main
_isr_#T20434_9	EQU            	_isrDATA + 0X0		; Bank 0
_isr_#T20441_9	EQU            	_isrDATA + 0X0		; Bank 0
_isr_#T20474_10	EQU            	_isrDATA + 0X0		; Bank 0
_isr_#T20475_10	EQU            	_isrDATA + 0X1		; Bank 0
_isr_#T20515_11	EQU            	_isrDATA + 0X0		; Bank 0
_isr_#T20518_11	EQU            	_isrDATA + 0X2		; Bank 0
#TMP	EQU            	?_TMP+ 0X0		; Bank 0
?_TMP_RET	EQU            	?_TMP		; Bank 0
_T31EN_0#sh	EQU            	0X608		; Bank 0
_UED_0#sh	EQU            	0X609		; Bank 0
_UPT_0#sh	EQU            	0X698		; Bank 0
_T31DLYT_0#sh	EQU            	0XC0		; Bank 0
_T31C0L_0#sh	EQU            	0XC1		; Bank 0
_T31C0H_0#sh	EQU            	0XC2		; Bank 0
_T31C2L_0#sh	EQU            	0XC5		; Bank 0
_T31CH1C_0#sh	EQU            	0XD4		; Bank 0
_T31PINCL_0#sh	EQU            	0XD8		; Bank 0
_T31PRSL_0#sh	EQU            	0XDC		; Bank 0
_T31PRSH_0#sh	EQU            	0XDD		; Bank 0
_T31CNTLDL_0#sh	EQU            	0XDE		; Bank 0
_T31CNTLDH_0#sh	EQU            	0XDF		; Bank 0
_T31CH1RL_0#sh	EQU            	0XE1		; Bank 0
_T31CH1RH_0#sh	EQU            	0XE2		; Bank 0
_MULA_0#sh	EQU            	(MULA - 0X6080) % 0X40 + 0xC0		; Bank 0
_MULB_0#sh	EQU            	(MULB - 0X6080) % 0X40 + 0xC0		; Bank 0
_MULL_0#sh	EQU            	(MULL - 0X6080) % 0X40 + 0xC0		; Bank 0
_MULH_0#sh	EQU            	(MULH - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVEL_0#sh	EQU            	(DIVEL - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVEM_0#sh	EQU            	(DIVEM - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVSL_0#sh	EQU            	(DIVSL - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVSH_0#sh	EQU            	(DIVSH - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVQL_0#sh	EQU            	(DIVQL - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVQM_0#sh	EQU            	(DIVQM - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVRL_0#sh	EQU            	(DIVRL - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVRH_0#sh	EQU            	(DIVRH - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVC_0#sh	EQU            	(DIVC - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVEU_0#sh	EQU            	(DIVEU - 0X6080) % 0X40 + 0xC0		; Bank 0
_DIVEH_0#sh	EQU            	(DIVEH - 0X6080) % 0X40 + 0xC0		; Bank 0
	_DESC          	RAMclear,0X0,0X0
RAMclear#	CSEG           
_RAMclear
; /*******************************************************
; *Copyright(C),2020,Shanghai Eastsoft Microelectronics Co.,Ltd.
; *文件名：pwm_adjustable_freq.c
; *作  者：AE Team
; *版  本：v1.0，编译于iDesigner(v4.2.3.166) + 工具链HRCC(v1.2.0.106)
; *日  期：2020/12/18
; *描  述：多功能定时器，T31_CH1(PB5)/T31_CH1N(PB2)输出互补pwm。频率范围100kHz~205kHz，每10ms以1kHz步进，
;         大于205kHz时重新从100kHz开始。
;         说明：起始频率100kHz，Fosc=16MHz，则在边沿计数模式下计数器初值=16MHz/100kHz=160(0xA0)。频率越大周期越小重装载值(T31CNTLD)越小
;         假设当前频率为f(单位kHz)，步进后的频率为(f+1)kHz。则周期寄存器值变化△=16MHz/f - 16MHz/(f+1)=16MHz*1kHz/(f*(f+1))
;         由此可见，当前频率越大，频率每增加1kHz，周期寄存器的值变化愈小。所以我们取每10ms周期寄存器值减1简单表示步进1kHz。
;         注意：PWM模式调试状态下，须软件固定设置T31C0H<6>=1，否则PWM输出可能会异常。
; *备  注：本软件仅供学习和演示使用，对用户直接引用代码所带来的风险或后果不承担任何法律责任。
; *******************************************************/
; #include <hic.h>
; #define CLRWDT()   {__Asm CWDT;}        //宏定义清狗指令
; unsigned char g_10ms_flag;        //10ms定时标志
; unsigned int  period;             //pwm周期值
; /******************************************************
; 函数名：void RAMclear(void)
; 描  述：RAM区数据清零，RAM区地址0x0000~0x03FF
; 输入值：无
; 输出值：无
; 返回值：无
; *******************************************************/
; void RAMclear(void)
; {
#line 31	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     for (IAAH=0; IAAH<=0x03; IAAH++)
	CLR            	BKSR
;   31:(    ASGN_1,          0 ,            ,      IAAH)

; ITemplate_CLR1_4_TMP
	CLR            	_IAAH_0
;   31:(     LABEL,    #L20268 ,            ,          )

; ITemplate_LABEL
#L20268
;   31:(    JGT_1U,       IAAH ,          3 ,   #L20345)

; ITemplate_JGT1_4U
	MOV            	_IAAH_0,	0x0
	SUBI           	0x3
	JBS            	PSW,	0x0
	GOTO           	#L20345
;     {
#line 33	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;         for (IAAL=0; IAAL<0xFF; IAAL++)
;   33:(    ASGN_1,          0 ,            ,      IAAL)

; ITemplate_CLR1_4_TMP
	CLR            	_IAAL_0
;   33:(     LABEL,    #L20285 ,            ,          )

; ITemplate_LABEL
#L20285
;   33:(    JGE_1U,       IAAL ,        255 ,   #L20286)

; ITemplate_JGE1_4U
	MOVI           	0xff
	SUB            	_IAAL_0,	0x0
	JBC            	PSW,	0x0
	GOTO           	#L20286
#line 34	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             IAD = 0x00;
;   34:(    ASGN_1,          0 ,            ,       IAD)

; ITemplate_CLR1_4_TMP
	CLR            	_IAD_0
;   33:(     ADD_1,       IAAL ,          1 ,      IAAL)

; ITemplate_INC_1_TMP
	INC            	_IAAL_0
;   34:(       JMP,            ,            ,   #L20285)

; ITemplate_JMP
	GOTO           	#L20285
;   34:(     LABEL,    #L20286 ,            ,          )

; ITemplate_LABEL
#L20286
#line 35	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;         IAD = 0x00;
;   35:(    ASGN_1,          0 ,            ,       IAD)

; ITemplate_CLR1_4_TMP
	CLR            	_IAD_0
;   31:(     ADD_1,       IAAH ,          1 ,      IAAH)

; ITemplate_INC_1_TMP
	INC            	_IAAH_0
#line 36	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     }
;   36:(       JMP,            ,            ,   #L20268)

; ITemplate_JMP
	GOTO           	#L20268
#line 37	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ; }
;   37:(     LABEL,    #L20345 ,            ,          )

; ITemplate_LABEL
#L20345
;   37:(       RET,            ,            ,          )

; ITemplate_RET
	RET            			; Bank 0		; ShBank 0
	_DESC          	GPIOInit,0X0,0X0
GPIOInit#	CSEG           
_GPIOInit
; /******************************************************
; 函数名：void GPIOInit(void)
; 描  述：首先初始化所有未用到的IO口为输出低电平
; 输入值：无
; 输出值：无
; 返回值：无
; *******************************************************/
; void GPIOInit(void)
; {
#line 48	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     ANSH = 0xFF;        //选择对应端口为数字IO功能
	CLR            	BKSR
;   48:(    ASGN_1,        255 ,            ,      ANSH)

; ITemplate_ASGN1_4_R
	MOVI           	0xff
	MOVA           	_ANSH_0
#line 49	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     ANSL = 0xFF;        //选择对应端口为数字IO功能
;   49:(    ASGN_1,        255 ,            ,      ANSL)

; ITemplate_ASGN1_4_R
	MOVI           	0xff
	MOVA           	_ANSL_0
#line 50	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     PAT = 0x00;         //所有IO设为输出低电平
;   50:(    ASGN_1,          0 ,            ,       PAT)

; ITemplate_CLR1_4_TMP
	CLR            	_PAT_0
#line 51	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     PBT = 0x00;
;   51:(    ASGN_1,          0 ,            ,       PBT)

; ITemplate_CLR1_4_TMP
	CLR            	_PBT_0
#line 52	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     PCT = 0x00;
;   52:(    ASGN_1,          0 ,            ,       PCT)

; ITemplate_CLR1_4_TMP
	CLR            	_PCT_0
#line 53	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     PA = 0x00;
;   53:(    ASGN_1,          0 ,            ,        PA)

; ITemplate_CLR1_4_TMP
	CLR            	_PA_0
#line 54	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     PB = 0x00;
;   54:(    ASGN_1,          0 ,            ,        PB)

; ITemplate_CLR1_4_TMP
	CLR            	_PB_0
#line 55	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     PC = 0x00;
;   55:(    ASGN_1,          0 ,            ,        PC)

; ITemplate_CLR1_4_TMP
	CLR            	_PC_0
#line 57	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     PB7 = 1;              //使能蜂鸣器
;   57:(    ASGN_0,          1 ,            ,       PB7)

; ITemplate_SET_0_TMP
	BSS            	(_PB7_0)/8,	(_PB7_0)%8
#line 58	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ; }
;   58:(       RET,            ,            ,          )

; ITemplate_RET
	RET            			; Bank 0		; ShBank 0
	_DESC          	T8NInit,0X0,0X0
T8NInit#	CSEG           
_T8NInit
; /*******************************************************
; 函数名：void T8Ninit(void)
; 描  述：T8N初始化，用于生成10ms时基
; 输入值：无
; 输出值：无
; 返回值：无
; *******************************************************/
; void T8NInit(void)
; {
#line 69	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T8NC = 0x0C;         //定时器模式，预分频1:(Fosc/2)/32
	CLR            	BKSR
;   69:(    ASGN_1,         12 ,            ,      T8NC)

; ITemplate_ASGN1_4_R
	MOVI           	0xc
	MOVA           	_T8NC_0
#line 70	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T8N = 6;             //赋计数器初值
;   70:(    ASGN_1,          6 ,            ,       T8N)

; ITemplate_ASGN1_4_R
	MOVI           	0x6
	MOVA           	_T8N_0
#line 71	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T8NIE = 1;           //打开定时器溢出中断
;   71:(    ASGN_0,          1 ,            ,     T8NIE)

; ITemplate_SET_0_TMP
	BSS            	(_T8NIE_0)/8,	(_T8NIE_0)%8
#line 72	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T8NIF = 0;           //清溢出标志位   
;   72:(    ASGN_0,          0 ,            ,     T8NIF)

; ITemplate_CLR_0_TMP
	BCC            	(_T8NIF_0)/8,	(_T8NIF_0)%8
#line 73	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ; }
;   73:(       RET,            ,            ,          )

; ITemplate_RET
	RET            			; Bank 0		; ShBank 0
	_DESC          	##isr,0X3,0X0

SECTION1isr	UNINTIAL       	0		; Bank 0
	ORG            	0X80		; Bank 0
_isrDATA	RSEG           	0X4		; Bank 0
; interrupt fun entry
	PUBLIC         	SAVED_TMP
SECTION0_INT_SAVED_00	UNINTIAL       		; Bank 0
SAVED_FSR	RSEG           	0x3
SECTION0_INT_SAVED_3	UNINTIAL       		; Bank 0
SAVED_TMP	RSEG           	0x1
INT_ENTRY	CSEG           	0x04
; ITemplate_InterruptHead
_INT_ENTRY
	PUSH           	
	CLR            	PCRH
	CLR            	BKSR
	MOV            	IAAL,	0x0
	MOVA           	(SAVED_FSR) & 0X7F		; Bank 0
	MOV            	IAAH,	0x0
	MOVA           	(SAVED_FSR+0x1) & 0X7F		; Bank 0
	MOV            	(CSEG_PTR) & 0X7F,	0x0		; Bank 0
	MOVA           	(CSEG_PTR+0x2) & 0X7F		; Bank 0
	MOV            	(CSEG_PTR+0x1) & 0X7F,	0x0		; Bank 0
	MOVA           	(CSEG_PTR+0x3) & 0X7F		; Bank 0
	MOV            	(MUL_TEMP) & 0X7F,	0x0		; Bank 0
	MOVA           	(MUL_TEMP+0x2) & 0X7F		; Bank 0
	MOV            	(MUL_TEMP+0x1) & 0X7F,	0x0		; Bank 0
	MOVA           	(MUL_TEMP+0x3) & 0X7F		; Bank 0
isr#	CSEG           
_isr
; /*******************************************************
; 函数名：void isr(void) interrupt
; 描  述：中断服务程序，若没有用到周期寄存器高字节，为了提高效率，可以用T31CNTLDL代替period
;         从而不使用period变量。
; 输入值：无
; 输出值：无
; 返回值：无
; *******************************************************/
; void isr(void) interrupt
; {
#line 85	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     if (T8NIE==1 && T8NIF==1)        //定时器溢出中断
;   85:(    CVB_SC,      T8NIE ,            ,   #T20434)

; ITemplate_CVB_UC
	MOVI           	0x0
	JBC            	(_T8NIE_0)/8,	(_T8NIE_0)%8
	MOVI           	0x1
	SECTION        	0x1
	MOVA           	(_isr_#T20434_9) & 0X7F		; Bank 1
;   85:(    JNEQ_1,          1 ,    #T20434 ,   #L20581)

; ITemplate_JNEQ1_4
	MOV            	(_isr_#T20434_9) & 0X7F,	0x0		; Bank 1
	XORI           	0x1
	JBS            	PSW,	0x2
	GOTO           	#L20581
;   85:(    CVB_SC,      T8NIF ,            ,   #T20441)

; ITemplate_CVB_UC
	MOVI           	0x0
	JBC            	(_T8NIF_0)/8,	(_T8NIF_0)%8
	MOVI           	0x1
	MOVA           	(_isr_#T20441_9) & 0X7F		; Bank 1
;   85:(    JNEQ_1,          1 ,    #T20441 ,   #L20581)

; ITemplate_JNEQ1_4
	MOV            	(_isr_#T20441_9) & 0X7F,	0x0		; Bank 1
	XORI           	0x1
	JBS            	PSW,	0x2
	GOTO           	#L20581
;     {
#line 87	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;         T8NIF = 0;          //清标志位
;   87:(    ASGN_0,          0 ,            ,     T8NIF)

; ITemplate_CLR_0_TMP
	BCC            	(_T8NIF_0)/8,	(_T8NIF_0)%8
#line 89	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;         T8N += 6;        //进中断先赋计数器初值
;   89:(     ADD_1,        T8N ,          6 ,       T8N)

; ITemplate_ADD1_4
	MOV            	_T8N_0,	0x0
	ADDI           	0x6
	MOVA           	_T8N_0
#line 90	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;         if ((++g_10ms_flag) >= 10)       //10ms定时到
;   90:(     ADD_1, g_10ms_flag ,          1 ,   #T20474)

; ITemplate_ADD1_4
	MOV            	(_g_10ms_flag) & 0X7F,	0x0		; Bank 1
	ADDI           	0x1
	MOVA           	(_isr_#T20474_10) & 0X7F		; Bank 1
;   90:(    ASGN_1,    #T20474 ,            ,g_10ms_flag)

; ITemplate_ASGN1_4_R
	MOV            	(_isr_#T20474_10) & 0X7F,	0x0		; Bank 1
	MOVA           	(_g_10ms_flag) & 0X7F		; Bank 1
;   90:(   CVSC_UC,    #T20474 ,            ,   #T20475)

; ITemplate_CVTMS_S
	MOV            	(_isr_#T20474_10) & 0X7F,	0x0		; Bank 1
	MOVA           	(_isr_#T20475_10) & 0X7F		; Bank 1
;   90:(    JLT_1U,    #T20475 ,         10 ,   #L20581)

; ITemplate_JLT1_4U
	MOVI           	0xa
	SUB            	(_isr_#T20475_10) & 0X7F,	0x0		; Bank 1
	JBS            	PSW,	0x0
	GOTO           	#L20581
;         {
#line 92	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             PA5=~PA5;
;   92:(    BCOM_0,        PA5 ,            ,       PA5)

; ITemplate_BCOM_0
	BTT            	(_PA5_0)/8,	(_PA5_0)%8
#line 93	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             g_10ms_flag = 0;
;   93:(    ASGN_1,          0 ,            ,g_10ms_flag)

; ITemplate_CLR1_4_TMP
	CLR            	(_g_10ms_flag) & 0X7F		; Bank 1
#line 94	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             period = T31CNTLDH;          //若没有用到周期寄存器高字节，可以不使用period变量，直接使用T31CNTLDL参与计算
;   94:(   CVUC_UI,  T31CNTLDH ,            ,    period)

; ITemplate_CVTMS_U
	CLR            	(_period+0x1) & 0X7F		; Bank 1
	MOV            	_T31CNTLDH_0#sh,	0x0		; ShBank 0
	MOVA           	(_period) & 0X7F		; Bank 1
#line 95	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             period = (period<<8) | T31CNTLDL;
;   95:(    LSH_2U,     period ,          8 ,   #T20515)

; ITemplate_LSH1_4_8
	MOV            	(_period) & 0X7F,	0x0		; Bank 1
	MOVA           	(_isr_#T20515_11+0x1) & 0X7F		; Bank 1
	CLR            	(_isr_#T20515_11) & 0X7F		; Bank 1
;   95:(   CVUC_UI,  T31CNTLDL ,            ,   #T20518)

; ITemplate_CVTMS_U
	CLR            	(_isr_#T20518_11+0x1) & 0X7F		; Bank 1
	MOV            	_T31CNTLDL_0#sh,	0x0		; ShBank 0
	MOVA           	(_isr_#T20518_11) & 0X7F		; Bank 1
;   95:(     BOR_2,    #T20515 ,    #T20518 ,    period)

; ITemplate_BOR1_4
	MOV            	(_isr_#T20518_11) & 0X7F,	0x0		; Bank 1
	IOR            	(_isr_#T20515_11) & 0X7F,	0x0		; Bank 1
	MOVA           	(_period) & 0X7F		; Bank 1
	MOV            	(_isr_#T20518_11+0x1) & 0X7F,	0x0		; Bank 1
	IOR            	(_isr_#T20515_11+0x1) & 0X7F,	0x0		; Bank 1
	MOVA           	(_period+0x1) & 0X7F		; Bank 1
#line 96	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             if (period <= 78)            //pwm频率高于205kHz，重新从100kHz开始递增
;   96:(    JGT_2U,     period ,         78 ,   #L20522)

; ITemplate_JGT1_4U
	MOV            	(_period+0x1) & 0X7F,	0x0		; Bank 1
	SUBI           	0x0
	JBS            	PSW,	0x2
	GOTO           	#L20706
	MOV            	(_period) & 0X7F,	0x0		; Bank 1
	SUBI           	0x4e
#L20706
	JBS            	PSW,	0x0
	GOTO           	#L20522
;             {
#line 98	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;                 period = 0xA0;
;   98:(    ASGN_2,        160 ,            ,    period)

; ITemplate_ASGN1_4_R
	MOVI           	0x0
	MOVA           	(_period+0x1) & 0X7F		; Bank 1
	MOVI           	0xa0
	MOVA           	(_period) & 0X7F		; Bank 1
#line 99	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             }
;   99:(     LABEL,    #L20522 ,            ,          )

; ITemplate_LABEL
#L20522
#line 100	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             period--;      //pwm频率按1kHz步进
;  100:(     SUB_2,     period ,          1 ,    period)

; ITemplate_DEC_2_TMP
	MOV            	(_period) & 0X7F,	0x0		; Bank 1
	JBS            	PSW,	0x2
	GOTO           	#L20707
	DEC            	(_period+0x1) & 0X7F		; Bank 1
#L20707
	DEC            	(_period) & 0X7F		; Bank 1
#line 101	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             UED = 1;       //禁止更新事件，写入值不会复制到缓冲器中(即写入值不生效)。
;  101:(    ASGN_0,          1 ,            ,       UED)

; ITemplate_SET_0_TMP
	BSS            	(_UED_0#sh)/8,	(_UED_0#sh)%8		; ShBank 0
#line 102	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             T31CNTLDH = period>>8;
;  102:(    RSH_2U,     period ,          8 , T31CNTLDH)

; ITemplate_RSH1_4U
	MOVI           	0x8
	ADDI           	0x1
	MOVAR          	?_TMP		; Bank 0
	MOV            	(_period) & 0X7F,	0x0		; Bank 1
	MOVAR          	?_TMP+0x1		; Bank 0
	MOV            	(_period+0x1) & 0X7F,	0x0		; Bank 1
	MOVAR          	?_TMP+0x2		; Bank 0
	MOVRA          	?_TMP		; Bank 0
	GOTO           	#L20708
#L20709
	BCC            	PSW,	0x0
	SECTION        	0x0
	RR             	(?_TMP+0x2) & 0X7F,	0x1		; Bank 0
	RR             	(?_TMP+0x1) & 0X7F,	0x1		; Bank 0
#L20708
	ADDI           	0xff
	JBS            	PSW,	0x2
	GOTO           	#L20709
	SECTION        	0x0
	MOV            	(?_TMP+0x1) & 0X7F,	0x0		; Bank 0
	MOVA           	_T31CNTLDH_0#sh		; ShBank 0
#line 103	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             T31CNTLDL = period;      
;  103:(   CVUI_UC,     period ,            , T31CNTLDL)

; ITemplate_CVSMT
	MOVRA          	_period		; Bank 1
	MOVA           	_T31CNTLDL_0#sh		; ShBank 0
#line 104	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;             UED = 0;       //允许更新事件，下一次计数器溢出时T31CNTLD生效
;  104:(    ASGN_0,          0 ,            ,       UED)

; ITemplate_CLR_0_TMP
	BCC            	(_UED_0#sh)/8,	(_UED_0#sh)%8		; ShBank 0
;             //UPT = 1;       //更新所有寄存器的缓冲器，使写入值立即生效
;         }       
;     }
#line 108	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ; }
;  108:(     LABEL,    #L20581 ,            ,          )

; ITemplate_LABEL
#L20581
;  108:(     RET_I,            ,            ,          )

; ITemplate_RET_I
	SECTION        	0x0
	GOTO           	_INT_RESTORE		; Bank 0		; ShBank 0
; interrupt fun restore
INT_RESTORE	CSEG           
; ITemplate_InterruptTail
_INT_RESTORE
	NOP            	
	NOP            	
	MOV            	(CSEG_PTR+0x3) & 0X7F,	0x0		; Bank 0
	MOVA           	(CSEG_PTR+0x1) & 0X7F		; Bank 0
	MOV            	(CSEG_PTR+0x2) & 0X7F,	0x0		; Bank 0
	MOVA           	(CSEG_PTR) & 0X7F		; Bank 0
	MOV            	(MUL_TEMP+0x2) & 0X7F,	0x0		; Bank 0
	MOVA           	(MUL_TEMP) & 0X7F		; Bank 0
	MOVA           	MULA
	MOV            	(MUL_TEMP+0x3) & 0X7F,	0x0		; Bank 0
	MOVA           	(MUL_TEMP+0x1) & 0X7F		; Bank 0
	MOVA           	MULB
	MOV            	(SAVED_FSR+0x1) & 0X7F,	0x0		; Bank 0
	MOVA           	IAAH
	MOV            	(SAVED_FSR) & 0X7F,	0x0		; Bank 0
	MOVA           	IAAL
	POP            	
	RETIE          	
	_DESC          	main,0X0,0X0,RAMclear,GPIOInit,T8NInit
main#	CSEG           
_main
; /*******************************************************
; 函数名：void main(void)
; 描  述：主函数，T31_CH1(PB5)/T31_CH1N(PB2)输出死区互补pwm，周期在100kHz~205kHz连续变化
; 输入值：无
; 输出值：无
; 返回值：无
; *******************************************************/
; void main(void) 
; {
#line 119	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     RAMclear();
	CLR            	BKSR
;  119:(      CALL, (RAMclear.0) ,            ,          )

; ITemplate_CALL
	SEGMENTSEL     	_RAMclear
	CALL           	_RAMclear		; Bank 0		; ShBank 0
	SEGMENTSEL     	$
#line 120	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     GPIOInit();
;  120:(      CALL, (GPIOInit.0) ,            ,          )

; ITemplate_CALL
	SEGMENTSEL     	_GPIOInit
	CALL           	_GPIOInit		; Bank 0		; ShBank 0
	SEGMENTSEL     	$
#line 121	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T8NInit(); 
;  121:(      CALL, (T8NInit.0) ,            ,          )

; ITemplate_CALL
	SEGMENTSEL     	_T8NInit
	CALL           	_T8NInit		; Bank 0		; ShBank 0
	SEGMENTSEL     	$
#line 122	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31C0H = 0x40;          //T31C0H<6>(HTOEOFF)调试模式下需软件固定为1，死区发生器时钟频率tDTS=tCK_INT
;  122:(    ASGN_1,         64 ,            ,    T31C0H)

; ITemplate_ASGN1_4_R
	MOVI           	0x40
	MOVA           	_T31C0H_0#sh		; ShBank 0
#line 123	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31C0L = 0xE0;          //中心对齐模式3，初始递增计数(DIR=0)，使能T31CNTLD寄存器缓冲(即写入值在下一次更新事件时生效)。
;  123:(    ASGN_1,        224 ,            ,    T31C0L)

; ITemplate_ASGN1_4_R
	MOVI           	0xe0
	MOVA           	_T31C0L_0#sh		; ShBank 0
;     //T31CH4C = 0x60;         //通道4配置为输出，pwm1模式
;     //T31CH3C = 0x60;         //通道3配置为输出，pwm1模式
;     //T31CH2C = 0x60;         //通道2配置为输出，pwm1模式
#line 127	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31CH1C = 0x60;         //通道配1置为输出，pwm1模式
;  127:(    ASGN_1,         96 ,            ,   T31CH1C)

; ITemplate_ASGN1_4_R
	MOVI           	0x60
	MOVA           	_T31CH1C_0#sh		; ShBank 0
;     //T31PINCH = 0x05;        //T31_CH3高电平有效，使能输出。T31_CH3N通道高电平有效，使能输出。
#line 129	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31PINCL = 0x05;        //T31_CH1通道高电平有效，使能输出。T31_CH1N通道高电平有效，使能输出。
;  129:(    ASGN_1,          5 ,            ,  T31PINCL)

; ITemplate_ASGN1_4_R
	MOVI           	0x5
	MOVA           	_T31PINCL_0#sh		; ShBank 0
;     //T31C2H = 0x00;
#line 131	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31C2L = 0x00;          //禁止从模式
;  131:(    ASGN_1,          0 ,            ,    T31C2L)

; ITemplate_CLR1_4_TMP
	CLR            	_T31C2L_0#sh		; ShBank 0
#line 132	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31PRSH = 0x00;         //预分频系数1:1
;  132:(    ASGN_1,          0 ,            ,   T31PRSH)

; ITemplate_CLR1_4_TMP
	CLR            	_T31PRSH_0#sh		; ShBank 0
#line 133	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31PRSL = 0x00;
;  133:(    ASGN_1,          0 ,            ,   T31PRSL)

; ITemplate_CLR1_4_TMP
	CLR            	_T31PRSL_0#sh		; ShBank 0
#line 134	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31CNTLDH = 0x00;       //重装载值，代表pwm周期长度，pwm模式中央对齐计数下，周期=T31CNTLD*2
;  134:(    ASGN_1,          0 ,            , T31CNTLDH)

; ITemplate_CLR1_4_TMP
	CLR            	_T31CNTLDH_0#sh		; ShBank 0
#line 135	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31CNTLDL = 0x50;
;  135:(    ASGN_1,         80 ,            , T31CNTLDL)

; ITemplate_ASGN1_4_R
	MOVI           	0x50
	MOVA           	_T31CNTLDL_0#sh		; ShBank 0
#line 136	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31CH1RH = 0x00;        //比较寄存器3值，代表pwm占空比长度
;  136:(    ASGN_1,          0 ,            ,  T31CH1RH)

; ITemplate_CLR1_4_TMP
	CLR            	_T31CH1RH_0#sh		; ShBank 0
#line 137	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31CH1RL = 0x28;
;  137:(    ASGN_1,         40 ,            ,  T31CH1RL)

; ITemplate_ASGN1_4_R
	MOVI           	0x28
	MOVA           	_T31CH1RL_0#sh		; ShBank 0
#line 138	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31DLYT = 0x00;         //死区时间
;  138:(    ASGN_1,          0 ,            ,   T31DLYT)

; ITemplate_CLR1_4_TMP
	CLR            	_T31DLYT_0#sh		; ShBank 0
;     //HALT_PWM = 1;           //在线调试暂停状态下，PWM停止输出，此时通道n端口状态与端口方向寄存器设置的状态(输入/输出)相同
#line 140	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     HALT_PWM = 0;           //在线调试暂停状态下，PWM仍输出，但频率保持不变
;  140:(    ASGN_0,          0 ,            ,  HALT_PWM)

; ITemplate_CLR_0_TMP
	BCC            	(_HALT_PWM_0)/8,	(_HALT_PWM_0)%8
#line 141	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     UPT = 1;        //更新所有寄存器的缓冲器，使写入值立即生效
;  141:(    ASGN_0,          1 ,            ,       UPT)

; ITemplate_SET_0_TMP
	BSS            	(_UPT_0#sh)/8,	(_UPT_0#sh)%8		; ShBank 0
#line 142	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     CHOE = 1;       //使能输出
;  142:(    ASGN_0,          1 ,            ,      CHOE)

; ITemplate_SET_0_TMP
	BSS            	(_CHOE_0)/8,	(_CHOE_0)%8
#line 143	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     GIE = 1;        //开全局中断
;  143:(    ASGN_0,          1 ,            ,       GIE)

; ITemplate_SET_0_TMP
	BSS            	(_GIE_0)/8,	(_GIE_0)%8
#line 144	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T8NEN = 1;      //使能T8N   
;  144:(    ASGN_0,          1 ,            ,     T8NEN)

; ITemplate_SET_0_TMP
	BSS            	(_T8NEN_0)/8,	(_T8NEN_0)%8
#line 145	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     T31EN = 1;      //使能计数器
;  145:(    ASGN_0,          1 ,            ,     T31EN)

; ITemplate_SET_0_TMP
	BSS            	(_T31EN_0#sh)/8,	(_T31EN_0#sh)%8		; ShBank 0
#line 146	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     while (1)
;  146:(     LABEL,    #L20702 ,            ,          )

; ITemplate_LABEL
#L20702
;     {
#line 148	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;         CLRWDT();
; ITemplate_LABEL
;-----------Embedded Asm--------------
	CWDT
;-------------------------------------
#line 149	C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\pwm_adjust_freq\pwm_adjustable_freq .c ;     }
;  149:(       JMP,            ,            ,   #L20702)

; ITemplate_JMP
	GOTO           	#L20702

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC0	PSECT	FLAG=0X1088,ADDR=0X7FCB7
_GIE_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC1	PSECT	FLAG=0X1088,ADDR=0X7FCC9
_T8NIE_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC2	PSECT	FLAG=0X1088,ADDR=0X7FCD1
_T8NIF_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC3	PSECT	FLAG=0X1088,ADDR=0X7FD38
_HALT_PWM_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC4	PSECT	FLAG=0X1088,ADDR=0X7FD45
_PA5_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC5	PSECT	FLAG=0X1088,ADDR=0X7FD4F
_PB7_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC6	PSECT	FLAG=0X1088,ADDR=0X7FDF7
_T8NEN_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC7	PSECT	FLAG=0X1088,ADDR=0X7FDFF
_CHOE_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC8	PSECT	FLAG=0X1088,ADDR=0X30408
_T31EN_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC9	PSECT	FLAG=0X1088,ADDR=0X30409
_UED_0	RSEG           	0X1		; Bank 0

SECTION8C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC10	PSECT	FLAG=0X1088,ADDR=0X30498
_UPT_0	RSEG           	0X1		; Bank 0

SECTION1C__Users_lisq_Desktop_AN135_Examples_ES7P169C_T31_pwm_adjust_freq_pwm_adjustable_freq__c_STATIC	UNINTIAL       	0		; Bank 0
	ORG            	0X84		; Bank 0
_g_10ms_flag	RSEG           	0X1		; Bank 0
	ORG            	0X85		; Bank 0
_period	RSEG           	0X2		; Bank 0

SECTION8D__Program_Files__x86__iDesigner4_1_tools_INCLUDE_ES7P169C_h_STATIC	UNINTIAL       	0		; Bank 0
	ORG            	0XFF80		; Bank 0
_IAD_0	RSEG           	0X1		; Bank 0
	ORG            	0XFF81		; Bank 0
_IAAL_0	RSEG           	0X1		; Bank 0
	ORG            	0XFF82		; Bank 0
_IAAH_0	RSEG           	0X1		; Bank 0
	ORG            	0XFF8D		; Bank 0
_ANSH_0	RSEG           	0X1		; Bank 0
	ORG            	0XFFA8		; Bank 0
_PA_0	RSEG           	0X1		; Bank 0
	ORG            	0XFFA9		; Bank 0
_PB_0	RSEG           	0X1		; Bank 0
	ORG            	0XFFAA		; Bank 0
_PC_0	RSEG           	0X1		; Bank 0
	ORG            	0XFFAD		; Bank 0
_PAT_0	RSEG           	0X1		; Bank 0
	ORG            	0XFFAE		; Bank 0
_PBT_0	RSEG           	0X1		; Bank 0
	ORG            	0XFFAF		; Bank 0
_PCT_0	RSEG           	0X1		; Bank 0
	ORG            	0XFFBC		; Bank 0
_ANSL_0	RSEG           	0X1		; Bank 0
	ORG            	0XFFBD		; Bank 0
_T8N_0	RSEG           	0X1		; Bank 0
	ORG            	0XFFBE		; Bank 0
_T8NC_0	RSEG           	0X1		; Bank 0
	ORG            	0X6080		; Bank 0
_T31DLYT_0	RSEG           	0X1		; Bank 0
	ORG            	0X6081		; Bank 0
_T31C0L_0	RSEG           	0X1		; Bank 0
	ORG            	0X6082		; Bank 0
_T31C0H_0	RSEG           	0X1		; Bank 0
	ORG            	0X6085		; Bank 0
_T31C2L_0	RSEG           	0X1		; Bank 0
	ORG            	0X6094		; Bank 0
_T31CH1C_0	RSEG           	0X1		; Bank 0
	ORG            	0X6098		; Bank 0
_T31PINCL_0	RSEG           	0X1		; Bank 0
	ORG            	0X609C		; Bank 0
_T31PRSL_0	RSEG           	0X1		; Bank 0
	ORG            	0X609D		; Bank 0
_T31PRSH_0	RSEG           	0X1		; Bank 0
	ORG            	0X609E		; Bank 0
_T31CNTLDL_0	RSEG           	0X1		; Bank 0
	ORG            	0X609F		; Bank 0
_T31CNTLDH_0	RSEG           	0X1		; Bank 0
	ORG            	0X60A1		; Bank 0
_T31CH1RL_0	RSEG           	0X1		; Bank 0
	ORG            	0X60A2		; Bank 0
_T31CH1RH_0	RSEG           	0X1		; Bank 0
	END
