;The Num of Instruction(Size):149. The Max Address(Begin with 0):149 

                MCU  ES7P169C

A    equ    0
R    equ    1
HRAM_0X0  equ  0X0
HRAM_0X1  equ  0X1
HRAM_0X2  equ  0X2
HRAM_0X3  equ  0X3
HRAM_0X4  equ  0X4
HRAM_0X5  equ  0X5
HRAM_0X6  equ  0X6
HRAM_0X7  equ  0X7
HRAM_0X8  equ  0X8
HRAM_0X81  equ  0X81
HRAM_0X82  equ  0X82
HRAM_0X83  equ  0X83
HRAM_0X84  equ  0X84
HRAM_0X87  equ  0X87
HRAM_0X88  equ  0X88
HRAM_0X89  equ  0X89
HRAM_0X9  equ  0X9
HRAM_0XA  equ  0Xa
HRAM_0XC1  equ  0Xc1
HRAM_0XC5  equ  0Xc5
HRAM_0XC7  equ  0Xc7
HRAM_0XCB  equ  0Xcb
HRAM_0XCD  equ  0Xcd
HRAM_0XD1  equ  0Xd1
HRAM_0XD4  equ  0Xd4
HRAM_0XD8  equ  0Xd8
HRAM_0XDC  equ  0Xdc
HRAM_0XDD  equ  0Xdd
HRAM_0XE1  equ  0Xe1
HRAM_0XE2  equ  0Xe2

                ORG             0X00
HADR_0X0:
:0X0  c75af000                  AJMP            HADR_0X5A
                                ORG             0X2
:0X2  6800                      GOTO            HADR_0X0
                                ORG             0X4
:0X4  c180                      PUSH
:0X5  e787                      CLR             HRAM_0X87
:0X6  e783                      CLR             HRAM_0X83
:0X7  5081                      MOV             HRAM_0X81,      A
:0X8  e600                      MOVA            (SAVED_FSR)&7f                        ;(SAVED_FSR)&7f: Bank 0    Addr: 0    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
:0X9  5082                      MOV             HRAM_0X82,      A
:0Xa  e601                      MOVA            (SAVED_FSR+1)&7f                      ;(SAVED_FSR+1)&7f: Bank 0    Addr: 1    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
:0Xb  500f                      MOV             (CSEG_PTR)&7f,  A                     ;(CSEG_PTR)&7f: Bank 0    Addr: 15     
:0Xc  e611                      MOVA            (CSEG_PTR+2)&7f                       ;(CSEG_PTR+2)&7f: Bank 0    Addr: 17     
:0Xd  5010                      MOV             (CSEG_PTR+1)&7f,                A     ;(CSEG_PTR+1)&7f: Bank 0    Addr: 16     
:0Xe  e612                      MOVA            (CSEG_PTR+3)&7f                       ;(CSEG_PTR+3)&7f: Bank 0    Addr: 18     
:0Xf  500b                      MOV             (MUL_TEMP)&7f,  A                     ;(MUL_TEMP)&7f: Bank 0    Addr: 11     
:0X10  e60d                     MOVA            (MUL_TEMP+2)&7f                      ;(MUL_TEMP+2)&7f: Bank 0    Addr: 13     
:0X11  500c                     MOV             (MUL_TEMP+1)&7f,                A    ;(MUL_TEMP+1)&7f: Bank 0    Addr: 12     
:0X12  e60e                     MOVA            (MUL_TEMP+3)&7f                      ;(MUL_TEMP+3)&7f: Bank 0    Addr: 14     
:0X13  5007                     MOV             HRAM_0X7,       A
:0X14  e603                     MOVA            HRAM_0X3
:0X15  5008                     MOV             HRAM_0X8,       A
:0X16  e604                     MOVA            HRAM_0X4
:0X17  5009                     MOV             HRAM_0X9,       A
:0X18  e605                     MOVA            HRAM_0X5
:0X19  500a                     MOV             HRAM_0XA,       A
:0X1a  e606                     MOVA            HRAM_0X6
;
;/*******************************************************
;函数名：void isr(void) interrupt
;描  述：中断服务程序
;输入值：无
;输出值：无
;返回值：无
;*******************************************************/
;void isr(void) interrupt
;{
;    if (MIS1==1 && MIF1==1)        //捕捉1中断
:0X1b  e500                     MOVI            0X0
:0X1c  99cb                     JBC             HRAM_0XCB,      1
:0X1d  e501                     MOVI            0X1
:0X1e  ea01                     SECTION         0X1
:0X1f  e600                     MOVA            HRAM_0X0
:0X20  5000                     MOV             HRAM_0X0,       A
:0X21  e301                     XORI            0X1
:0X22  9284                     JBS             HRAM_0X84,      2
:0X23  683e                     GOTO            HADR_0X3E
:0X24  e500                     MOVI            0X0
:0X25  99cd                     JBC             HRAM_0XCD,      1
:0X26  e501                     MOVI            0X1
:0X27  e600                     MOVA            HRAM_0X0
:0X28  5000                     MOV             HRAM_0X0,       A
:0X29  e301                     XORI            0X1
:0X2a  9284                     JBS             HRAM_0X84,      2
:0X2b  683e                     GOTO            HADR_0X3E
;    {
;        MIC1 = 1;          //清捕捉1中断标志
:0X2c  a1d1                     BSS             HRAM_0XD1,      1
;        T31IF = 0;         //清定时器总标志位
:0X2d  aa9a                     BCC             (_T31IF_0)>>3,  2                    ;(_T31IF_0)>>3: Bank 511    Addr: 65434    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;
;        PA1 = ~PA1;
:0X2e  29a8                     BTT             (_PA1_0)>>3,    1                    ;(_PA1_0)>>3: Bank 511    Addr: 65448    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;        ch1rvalue = T31CH1RH;        //保存捕捉事件时计数器的值
:0X2f  e705                     CLR             (_ch1rvalue+1)&7f                    ;(_ch1rvalue+1)&7f: Bank 0    Addr: 5     
:0X30  50e2                     MOV             HRAM_0XE2,      A
:0X31  e604                     MOVA            (_ch1rvalue)&7f                      ;(_ch1rvalue)&7f: Bank 0    Addr: 4     
;        ch1rvalue = (ch1rvalue<<8) | T31CH1RL;
:0X32  5004                     MOV             (_ch1rvalue)&7f,                A    ;(_ch1rvalue)&7f: Bank 0    Addr: 4     
:0X33  e601                     MOVA            HRAM_0X1
:0X34  e700                     CLR             HRAM_0X0
:0X35  e703                     CLR             HRAM_0X3
:0X36  50e1                     MOV             HRAM_0XE1,      A
:0X37  e602                     MOVA            HRAM_0X2
:0X38  5002                     MOV             HRAM_0X2,       A
:0X39  5800                     IOR             HRAM_0X0,       A
:0X3a  e604                     MOVA            (_ch1rvalue)&7f                      ;(_ch1rvalue)&7f: Bank 0    Addr: 4     
:0X3b  5003                     MOV             HRAM_0X3,       A
:0X3c  5801                     IOR             HRAM_0X1,       A
:0X3d  e605                     MOVA            (_ch1rvalue+1)&7f                    ;(_ch1rvalue+1)&7f: Bank 0    Addr: 5     
HADR_0X3E:
;    }
;}
:0X3e  ea00                     SECTION         0X0
:0X3f  6840                     GOTO            HADR_0X40
HADR_0X40:
:0X40  ffff                     NOP
:0X41  ffff                     NOP
:0X42  5003                     MOV             HRAM_0X3,       A
:0X43  e607                     MOVA            HRAM_0X7
:0X44  5004                     MOV             HRAM_0X4,       A
:0X45  e608                     MOVA            HRAM_0X8
:0X46  5005                     MOV             HRAM_0X5,       A
:0X47  e609                     MOVA            HRAM_0X9
:0X48  5006                     MOV             HRAM_0X6,       A
:0X49  e60a                     MOVA            HRAM_0XA
:0X4a  5012                     MOV             (CSEG_PTR+3)&7f,                A    ;(CSEG_PTR+3)&7f: Bank 0    Addr: 18     
:0X4b  e610                     MOVA            (CSEG_PTR+1)&7f                      ;(CSEG_PTR+1)&7f: Bank 0    Addr: 16     
:0X4c  5011                     MOV             (CSEG_PTR+2)&7f,                A    ;(CSEG_PTR+2)&7f: Bank 0    Addr: 17     
:0X4d  e60f                     MOVA            (CSEG_PTR)&7f                        ;(CSEG_PTR)&7f: Bank 0    Addr: 15     
:0X4e  500d                     MOV             (MUL_TEMP+2)&7f,                A    ;(MUL_TEMP+2)&7f: Bank 0    Addr: 13     
:0X4f  e60b                     MOVA            (MUL_TEMP)&7f                        ;(MUL_TEMP)&7f: Bank 0    Addr: 11     
:0X50  e688                     MOVA            HRAM_0X88
:0X51  500e                     MOV             (MUL_TEMP+3)&7f,                A    ;(MUL_TEMP+3)&7f: Bank 0    Addr: 14     
:0X52  e60c                     MOVA            (MUL_TEMP+1)&7f                      ;(MUL_TEMP+1)&7f: Bank 0    Addr: 12     
:0X53  e689                     MOVA            HRAM_0X89
:0X54  5001                     MOV             (SAVED_FSR+1)&7f,               A    ;(SAVED_FSR+1)&7f: Bank 0    Addr: 1    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
:0X55  e682                     MOVA            HRAM_0X82
:0X56  5000                     MOV             (SAVED_FSR)&7f, A                    ;(SAVED_FSR)&7f: Bank 0    Addr: 0    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
:0X57  e681                     MOVA            HRAM_0X81
:0X58  c181                     POP
:0X59  c189                     RETIE
HADR_0X5A:
;
;/*******************************************************
;函数名：void main(void)
;描  述：主函数，捕捉模式
;输入值：无
;输出值：无
;返回值：无
;*******************************************************/
;void main(void) 
;{
;    RAMclear();
:0X5a  e783                     CLR             HRAM_0X83
:0X5b  ec00                     PAGE            (_RAMclear)>>11
:0X5c  6072                     CALL            HADR_0X72
:0X5d  ec00                     PAGE            (_0)>>11
;    GPIOInit();
:0X5e  ec00                     PAGE            (_GPIOInit)>>11
:0X5f  6084                     CALL            HADR_0X84
:0X60  ec00                     PAGE            (_1)>>11
;    T31PRSH = 0x00;         //预分频系数1:16
:0X61  e7dd                     CLR             HRAM_0XDD
;    T31PRSL = 0x0F;
:0X62  e50f                     MOVI            0XF
:0X63  e6dc                     MOVA            HRAM_0XDC
;    T31C2L = 0x00;          //禁止从模式，内部时钟计数
:0X64  e7c5                     CLR             HRAM_0XC5
;    //T31CH2C = 0x02;         //T31_CH1作为通道2的捕捉管脚，无滤波，无预分频
;    T31CH1C = 0x05;         //T31_CH1作为通道1的捕捉管脚，无滤波，预分频1:2
:0X65  e505                     MOVI            0X5
:0X66  e6d4                     MOVA            HRAM_0XD4
;    //T31PINCH = 0x00;        //通道3、通道4端口控制寄存器   
;    T31PINCL = 0x02;        //下降沿有效
:0X67  e502                     MOVI            0X2
:0X68  e6d8                     MOVA            HRAM_0XD8
;    CH1E = 1;           //使能通道1捕捉
:0X69  a0d8                     BSS             HRAM_0XD8,      0
;    MIE1 = 1;           //使能捕捉1中断
:0X6a  a1c7                     BSS             HRAM_0XC7,      1
;    T31IE = 1;          //开启多功能定时器中断   
:0X6b  a299                     BSS             (_T31IE_0)>>3,  2                    ;(_T31IE_0)>>3: Bank 511    Addr: 65433    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    MIC1 = 1;           //清捕捉1中断标志
:0X6c  a1d1                     BSS             HRAM_0XD1,      1
;    T31IF = 0;          //清定时器总标志位
:0X6d  aa9a                     BCC             (_T31IF_0)>>3,  2                    ;(_T31IF_0)>>3: Bank 511    Addr: 65434    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    GIE = 1;            //开全局中断
:0X6e  a796                     BSS             (_GIE_0)>>3,    7                    ;(_GIE_0)>>3: Bank 511    Addr: 65430    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    T31EN = 1;          //使能计数器
:0X6f  a0c1                     BSS             HRAM_0XC1,      0
HADR_0X70:
;    while (1)
:0X70  c18b                     CWDT
;    }
:0X71  6870                     GOTO            HADR_0X70
HADR_0X72:
;/*******************************************************
;*Copyright(C),2020,Shanghai Eastsoft Microelectronics Co.,Ltd.
;*文件名：capture_input.c
;*作  者：AE Team
;*版  本：v1.0，编译于iDesigner(v4.2.3.166) + 工具链HRCC(v1.2.0.106)
;*日  期：2020/07/07
;*描  述：多功能定时器输入捕捉模式，T31_CH1(PB5)下降沿捕捉，捕捉成功翻转PA1
;*备  注：本软件仅供学习和演示使用，对用户直接引用代码所带来的风险或后果不承担任何法律责任。
;*******************************************************/
;#include <hic.h>
;
;#define CLRWDT()   {__Asm CWDT;}        //宏定义清狗指令
;
;unsigned int ch1rvalue;        //变量保存捕捉时锁存到捕获寄存器的值
;
;/******************************************************
;函数名：void RAMclear(void)
;描  述：RAM区数据清零，RAM区地址0x0000~0x03FF
;输入值：无
;输出值：无
;返回值：无
;*******************************************************/
;void RAMclear(void)
;{
;    for (IAAH=0; IAAH<=0x03; IAAH++)
:0X72  e783                     CLR             HRAM_0X83
:0X73  e782                     CLR             _IAAH_0                              ;_IAAH_0: Bank 511    Addr: 65410    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
HADR_0X74:
:0X74  5082                     MOV             _IAAH_0,        A                    ;_IAAH_0: Bank 511    Addr: 65410    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
:0X75  ce03                     SUBI            0X3
:0X76  9084                     JBS             HRAM_0X84,      0
:0X77  6883                     GOTO            HADR_0X83
;    {
;        for (IAAL=0; IAAL<0xFF; IAAL++)
:0X78  e781                     CLR             _IAAL_0                              ;_IAAL_0: Bank 511    Addr: 65409    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
HADR_0X79:
:0X79  e5ff                     MOVI            0XFF
:0X7a  ee81                     SUB             _IAAL_0,        A                    ;_IAAL_0: Bank 511    Addr: 65409    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
:0X7b  9884                     JBC             HRAM_0X84,      0
:0X7c  6880                     GOTO            HADR_0X80
;            IAD = 0x00;
:0X7d  e780                     CLR             _IAD_0                               ;_IAD_0: Bank 511    Addr: 65408    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
:0X7e  5581                     INC             _IAAL_0,        R                    ;_IAAL_0: Bank 511    Addr: 65409    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
:0X7f  6879                     GOTO            HADR_0X79
HADR_0X80:
;        IAD = 0x00;
:0X80  e780                     CLR             _IAD_0                               ;_IAD_0: Bank 511    Addr: 65408    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
:0X81  5582                     INC             _IAAH_0,        R                    ;_IAAH_0: Bank 511    Addr: 65410    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    }
:0X82  6874                     GOTO            HADR_0X74
HADR_0X83:
;}
:0X83  c183                     RET
HADR_0X84:
;
;/******************************************************
;函数名：void GPIOInit(void)
;描  述：首先初始化所有未用到的IO口为输出低电平
;输入值：无
;输出值：无
;返回值：无
;*******************************************************/
;void GPIOInit(void)
;{
;    ANSL = 0xFF;        //选择对应端口为数字IO功能
:0X84  e783                     CLR             HRAM_0X83
:0X85  e5ff                     MOVI            0XFF
:0X86  e6bc                     MOVA            _ANSL_0                              ;_ANSL_0: Bank 511    Addr: 65468    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;	ANSH = 0xFF;        //选择对应端口为数字IO功能
:0X87  e5ff                     MOVI            0XFF
:0X88  e68d                     MOVA            _ANSH_0                              ;_ANSH_0: Bank 511    Addr: 65421    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PAT = 0x00;         //所有IO设为输出低电平
:0X89  e7ad                     CLR             _PAT_0                               ;_PAT_0: Bank 511    Addr: 65453    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PBT = 0x00;
:0X8a  e7ae                     CLR             _PBT_0                               ;_PBT_0: Bank 511    Addr: 65454    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PCT = 0x00;
:0X8b  e7af                     CLR             _PCT_0                               ;_PCT_0: Bank 511    Addr: 65455    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PA = 0x00;
:0X8c  e7a8                     CLR             _PA_0                                ;_PA_0: Bank 511    Addr: 65448    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PB = 0x00;
:0X8d  e7a9                     CLR             _PB_0                                ;_PB_0: Bank 511    Addr: 65449    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PC = 0x00;
:0X8e  e7aa                     CLR             _PC_0                                ;_PC_0: Bank 511    Addr: 65450    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;
;    PBT4 = 1;           //T31_ETR设为输入
:0X8f  a4ae                     BSS             (_PBT4_0)>>3,   4                    ;(_PBT4_0)>>3: Bank 511    Addr: 65454    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PBT5 = 1;           //T31_CH1设为输入
:0X90  a5ae                     BSS             (_PBT5_0)>>3,   5                    ;(_PBT5_0)>>3: Bank 511    Addr: 65454    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PBT6 = 1;           //T31_CH2设为输入
:0X91  a6ae                     BSS             (_PBT6_0)>>3,   6                    ;(_PBT6_0)>>3: Bank 511    Addr: 65454    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PBPU4 = 1;          //使能上拉
:0X92  a4b3                     BSS             (_PBPU4_0)>>3,  4                    ;(_PBPU4_0)>>3: Bank 511    Addr: 65459    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PBPU5 = 1;
:0X93  a5b3                     BSS             (_PBPU5_0)>>3,  5                    ;(_PBPU5_0)>>3: Bank 511    Addr: 65459    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;    PBPU6 = 1;
:0X94  a6b3                     BSS             (_PBPU6_0)>>3,  6                    ;(_PBPU6_0)>>3: Bank 511    Addr: 65459    C:\Users\lisq\Desktop\AN135_Examples_ES7P169C\T31\capture_input\debug\capture_input.obj 
;}
:0X95  c183                     RET

                                END
