;--------------------------------------------------------
; File Created by ChiponCC : aolisn inc.
; Version 3.0.4#6752 (Jul  6 2017 15:09:47) (MSVC)
; This file was generated Tue Apr 03 21:00:11 2018
;--------------------------------------------------------
; chipon port for the 16-bit core
;--------------------------------------------------------
;	.file	"../init_mcu.c"
	.radix dec
	.include "KF8TS2508.inc"
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	.extern	__KF8spts2w_LIBf_init_touch_
	.extern	__KF8spts2w_LIBf_touch_process_
	.extern	__KF8spts2w_Lib_SET_MCU_Parameter
	.extern	_read_data_eep_ts2w_
	.extern	_write_eep_ts2w_
	.extern	__R2PCL
	.extern	_TOUCH_DEBUG_TRS_DEAL
	.extern	_TOUCH_DEBUG_TRS_BAIHUALV
	.extern	_TOUCH_DEBUG_SEND_OUT
	.extern	_delay_ms
	.extern	_delay_us
	.extern	_PSW_bits
	.extern	_P0_bits
	.extern	_P2_bits
	.extern	_P1_bits
	.extern	_PCH_bits
	.extern	_INTCTL_bits
	.extern	_EIF1_bits
	.extern	_EIF2_bits
	.extern	_T1CTL_bits
	.extern	_PWMCTL_bits
	.extern	_BANK_bits
	.extern	_ADSCANCTL_bits
	.extern	_VDACS_bits
	.extern	_ANSEH_bits
	.extern	_ADCCTL0_bits
	.extern	_OPTR_bits
	.extern	_IP0_bits
	.extern	_IP1_bits
	.extern	_IP2_bits
	.extern	_TR0_bits
	.extern	_TR2_bits
	.extern	_TR1_bits
	.extern	_OSCSTA_bits
	.extern	_IP3_bits
	.extern	_VRECTL_bits
	.extern	_EIE1_bits
	.extern	_EIE2_bits
	.extern	_PCTL_bits
	.extern	_OSCCTL_bits
	.extern	_ANSEL_bits
	.extern	_PUR0_bits
	.extern	_IOCL_bits
	.extern	_ADCCTL1_bits
	.extern	_P0LR_bits
	.extern	_P2LR_bits
	.extern	_P1LR_bits
	.extern	_EIE3_bits
	.extern	_EIF3_bits
	.extern	_T3CTL_bits
	.extern	_CTCTL0_bits
	.extern	_ADCINTCTL_bits
	.extern	_PUR1_bits
	.extern	_PUR2_bits
	.extern	_CTCTL1_bits
	.extern	_INTEDGCTL_bits
	.extern	_VDAC_bits
	.extern	_VRES_bits
	.extern	_SSCICTL0_bits
	.extern	_SSCICTL1_bits
	.extern	_SSCISTA_bits
	.extern	_SSCIADD_bits
	.extern	_SSCIMSK_bits
	.extern	_WDTPS_bits
	.extern	_CTCTL2_bits
	.extern	_T4CTL_bits
	.extern	__KF8_Disturb_Protect_Circle_
	.extern	__KF8_Up_BaseLine_Circle_
	.extern	__KF8_LIBi_channel_flag_
	.extern	__KF8_LIBi_Date_Change_
	.extern	__KF8_LIBc_channel_
	.extern	__KF8_LIBi_buff_hit_
	.extern	__KF8_LIBi_buff_baseline_
	.extern	__KF8_LIBi_buff_refline_
	.extern	__KF8_LIBc_touch_count_
	.extern	_Arr_erom_TS2W_
	.extern	_sentbuf1
	.extern	_sentbuf2
	.extern	_sentbuf3
	.extern	_sentbuf4
	.extern	_Flag
	.extern	_AlarmFlag
	.extern	_CurrentAdjustNum
	.extern	_KeyDownNum
	.extern	_Time20MScnt
	.extern	_V_NoWatercnt
	.extern	_AdjustOvercnt
	.extern	_NoWaterTimecnt
	.extern	_main_cnt
	.extern	_SubNum
	.extern	_AD_temp_V
	.extern	_AD_temp_I
	.extern	_AD_V
	.extern	_AD_I
	.extern	_AD_cnt
	.extern	_Power
	.extern	_LEDFre
	.extern	_CurrentShortCnt
	.extern	_I_NoWatercnt
	.extern	_cnt
	.extern	_keycnt
	.extern	_keycnttime
	.extern	_CHS_AMOUNT
	.extern	_TCS_AMOUNT
	.extern	__KF8_Inside_Reference_Channel_Disturb_Threshold_Set_
	.extern	__KF8_Disturb_Protect_Circle_Define
	.extern	__KF8_Up_BaseLine_Circle_Define
	.extern	__KF8_Inside_Reference_Channel_Order
	.extern	__KF8_Config_Finger_Threshold
	.extern	_CONFIG_NO_FINGER_THRESHOLD
	.extern	__KF8_TOUCH_CH_EN
	.extern	_T0
	.extern	_PCL
	.extern	_PSW
	.extern	_P0
	.extern	_P2
	.extern	_P1
	.extern	_PCH
	.extern	_INTCTL
	.extern	_EIF1
	.extern	_EIF2
	.extern	_T1L
	.extern	_T1H
	.extern	_T1CTL
	.extern	_PWM1L
	.extern	_PWMCTL
	.extern	_PP1
	.extern	_BANK
	.extern	_ADSCANCTL
	.extern	_VDACS
	.extern	_ANSEH
	.extern	_ADCDATA0H
	.extern	_ADCCTL0
	.extern	_OPTR
	.extern	_IP0
	.extern	_IP1
	.extern	_IP2
	.extern	_TR0
	.extern	_TR2
	.extern	_TR1
	.extern	_OSCSTA
	.extern	_IP3
	.extern	_VRECAL1
	.extern	_VRECTL
	.extern	_EIE1
	.extern	_EIE2
	.extern	_PCTL
	.extern	_OSCCTL
	.extern	_OSCCAL0
	.extern	_ANSEL
	.extern	_PP2
	.extern	_PWM2L
	.extern	_PUR0
	.extern	_IOCL
	.extern	_OSCCAL1
	.extern	_NVMDATAH
	.extern	_NVMDATAL
	.extern	_NVMADDRH
	.extern	_NVMADDRL
	.extern	_NVMCTL0
	.extern	_NVMCTL1
	.extern	_ADCDATA0L
	.extern	_ADCCTL1
	.extern	_P0LR
	.extern	_P2LR
	.extern	_P1LR
	.extern	_EIE3
	.extern	_EIF3
	.extern	_OSCCAL2
	.extern	_OSCCAL3
	.extern	_T3CTL
	.extern	_T3L
	.extern	_ADCDATA1H
	.extern	_ADCDATA1L
	.extern	_CTCTL0
	.extern	_ADCINTCTL
	.extern	_ADCDATA2H
	.extern	_ADCDATA2L
	.extern	_ADCDATA3H
	.extern	_T3H
	.extern	_PUR1
	.extern	_PUR2
	.extern	_CTCTL1
	.extern	_INTEDGCTL
	.extern	_ADCDATA3L
	.extern	_VDAC
	.extern	_VRES
	.extern	_SSCICTL0
	.extern	_SSCICTL1
	.extern	_SSCISTA
	.extern	_SSCIBUFR
	.extern	_SSCIADD
	.extern	_SSCIMSK
	.extern	_WDTPS
	.extern	_VRECAL2
	.extern	_VRECAL3
	.extern	_CTCTL2
	.extern	_T4L
	.extern	_T4H
	.extern	_T4REL
	.extern	_T4REH
	.extern	_T4CTL
	.extern	_RC32KCAL

	.extern I0R1
	.extern I0R7
	.extern I0PSW
	.extern I0PCH
	.extern I1R1
	.extern I1R7
	.extern I1PSW
	.extern I1PCH
	.extern STK11
	.extern STK10
	.extern STK09
	.extern STK08
	.extern STK07
	.extern STK06
	.extern STK05
	.extern STK04
	.extern STK03
	.extern STK02
	.extern STK01
	.extern STK00
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
	.global	_T0InitFun
	.global	_Pmw1InitFun
	.global	_init_mcu

;--------------------------------------------------------
; global definitions
;--------------------------------------------------------
;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
;--------------------------------------------------------
; initialized data
;--------------------------------------------------------
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
;	.udata_ovr


func._T0InitFun	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _T0InitFun	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_T0InitFun	;Function start
; 2 exit points
;	op : =
;	.line	62; "../init_mcu.c"	OPTR=OPTR_INIT;
	MOV	R0,# 0x81
	BANKSEL	_OPTR
	MOV	_OPTR, R0
;	op : =
;	.line	63; "../init_mcu.c"	PT0 = 1;
	BANKSEL	_IP0_bits
	SET	_IP0_bits, 2
;	op : =
;	.line	64; "../init_mcu.c"	T0=T0_MAX;
	MOV	R0,# 0x05
	BANKSEL	_T0
	MOV	_T0, R0
;	op : =
;	.line	65; "../init_mcu.c"	T0IE=1;
	BANKSEL	_INTCTL_bits
	SET	_INTCTL_bits, 5
;	op : =
;	.line	66; "../init_mcu.c"	T0IF=1;
	BANKSEL	_INTCTL_bits
	SET	_INTCTL_bits, 2
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _T0InitFun



func._Pmw1InitFun	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _Pmw1InitFun	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_Pmw1InitFun	;Function start
; 2 exit points
;	op : BITWISEAND
;	.line	52; "../init_mcu.c"	T3CTL &=0b11110111;					//PWMS=0，PWM1分配到P0.2，PWM2分配到P1.0
	BANKSEL	_T3CTL
	CLR	_T3CTL, 3
;	op : =
;	.line	53; "../init_mcu.c"	T1CLKEN=1;							//T1时钟选择INTHF
	BANKSEL	_INTEDGCTL_bits
	SET	_INTEDGCTL_bits, 0
;	op : =
;	.line	54; "../init_mcu.c"	T1CTL = T1CTL_INIT;					//启动T1,1分频
	MOV	R0,# 0x01
	BANKSEL	_T1CTL
	MOV	_T1CTL, R0
;	op : =
;	.line	55; "../init_mcu.c"	PP1 = PP1_17M;								//1.7MHz
	MOV	R0,# 0x08
	BANKSEL	_PP1
	MOV	_PP1, R0
;	op : RIGHT_OP
;	.line	56; "../init_mcu.c"	PWM1L = PP1/2;
	CLR	PSW, 0
	BANKSEL	_PP1
	RRCR	_PP1
	BANKSEL	_PWM1L
	MOV	_PWM1L, R0
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _Pmw1InitFun



func._init_mcu	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _init_mcu	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_init_mcu	;Function start
; 2 exit points
;	op : =
;	.line	18; "../init_mcu.c"	OSCCTL = OSCCTL_INIT;//MAX 16m
	MOV	R0,# 0x70
	BANKSEL	_OSCCTL
	MOV	_OSCCTL, R0
;	op : =
;	.line	21; "../init_mcu.c"	TR0 = TR0_INIT;
	MOV	R0,# 0x38
	BANKSEL	_TR0
	MOV	_TR0, R0
;	op : =
;	.line	22; "../init_mcu.c"	TR1 = TR1_INIT;
	MOV	R0,# 0x06
	BANKSEL	_TR1
	MOV	_TR1, R0
;	op : =
;	.line	23; "../init_mcu.c"	TR2 = TR2_INIT;
	MOV	R0,# 0x01
	BANKSEL	_TR2
	MOV	_TR2, R0
;	op : =
;	.line	25; "../init_mcu.c"	P0LR=0x00;
	BANKSEL	_P0LR
	CLR	_P0LR
;	op : =
;	.line	26; "../init_mcu.c"	P1LR=0x00;
	BANKSEL	_P1LR
	CLR	_P1LR
;	op : =
;	.line	27; "../init_mcu.c"	P2LR=0x00;
	BANKSEL	_P2LR
	CLR	_P2LR
;	op : =
;	.line	29; "../init_mcu.c"	P0=0x00;
	BANKSEL	_P0
	CLR	_P0
;	op : =
;	.line	30; "../init_mcu.c"	P1=0x00;
	BANKSEL	_P1
	CLR	_P1
;	op : =
;	.line	31; "../init_mcu.c"	P2=0x00;
	BANKSEL	_P2
	CLR	_P2
;	op : =
;	.line	37; "../init_mcu.c"	IPEN=1;
	BANKSEL	_PCTL_bits
	SET	_PCTL_bits, 3
;	op : =
;	.line	39; "../init_mcu.c"	PT3 = 1;		// 当使用T4同步计数，必须设定为高优先级，否则T3的触摸中断可以选择低优先级
	BANKSEL	_IP2_bits
	SET	_IP2_bits, 7
;	op : =
;	.line	43; "../init_mcu.c"	ANSEL = ANSEL_INIT;
	MOV	R0,# 0x06
	BANKSEL	_ANSEL
	MOV	_ANSEL, R0
;	op : =
;	.line	44; "../init_mcu.c"	ANSEH = ANSEH_INIT;							//触摸外挂电容引脚设置为模拟口
	MOV	R0,# 0x20
	BANKSEL	_ANSEH
	MOV	_ANSEH, R0
;	op : =
;	.line	45; "../init_mcu.c"	ADCCTL1=ADCCTL1_INIT;
	MOV	R0,# 0x4d
	BANKSEL	_ADCCTL1
	MOV	_ADCCTL1, R0
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _init_mcu


;	code size estimation:
;	   41+   26 =    67 instructions (  186 byte)


	.end
