;--------------------------------------------------------
; File Created by ChiponCC : aolisn inc.
; Version 3.0.4#6752 (Nov 19 2015 16:48:50) (MSVC)
; This file was generated Fri May 20 15:03:07 2016
;--------------------------------------------------------
; chipon port for the 16-bit core
;--------------------------------------------------------
;	.file	"../main.c"
	.list	p=KF8F4156
	.radix dec
	.include "KF8F4156.inc"
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	.extern	_PSW_bits
	.extern	_P0_bits
	.extern	_P2_bits
	.extern	_P1_bits
	.extern	_P3_bits
	.extern	_INTCTL_bits
	.extern	_EIF1_bits
	.extern	_EIF2_bits
	.extern	_T1CTL_bits
	.extern	_T2CTL0_bits
	.extern	_PWMCTL_bits
	.extern	_BANK_bits
	.extern	_ADSCANCTL_bits
	.extern	_C1CTL_bits
	.extern	_VDACS_bits
	.extern	_AMPCTL_bits
	.extern	_ANSEH_bits
	.extern	_ADCCTL0_bits
	.extern	_AMPDT_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	_P3LR_bits
	.extern	_TR3_bits
	.extern	_EIE3_bits
	.extern	_EIF3_bits
	.extern	_PWM5CTL0_bits
	.extern	_ADCINTCTL_bits
	.extern	_PWM5CTL1_bits
	.extern	_P5ASCTL_bits
	.extern	_PSTRCTL_bits
	.extern	_PUR1_bits
	.extern	_PUR2_bits
	.extern	_INTEDGCTL_bits
	.extern	_VBIASCTL_bits
	.extern	_VBIAS1EN_bits
	.extern	_VBIAS2EN_bits
	.extern	_PWM5OC_bits
	.extern	_T2CTL1_bits
	.extern	_VDAC_bits
	.extern	_PWM5CTL2_bits
	.extern	_PWMPC_bits
	.extern	_RSCTL_bits
	.extern	_BRCTL_bits
	.extern	_TSCTL_bits
	.extern	_SSCICTL0_bits
	.extern	_SSCICTL1_bits
	.extern	_SSCISTA_bits
	.extern	_SSCIMSK_bits
	.extern	_WDTPS_bits
	.extern	_MULCTL_bits
	.extern	_DIVCTL_bits
	.extern	_LEDCTL_bits
	.extern	_LEDPRE_bits
	.extern	_LEDDATA0_bits
	.extern	_LEDDATA1_bits
	.extern	_LEDDATA2_bits
	.extern	_LEDDATA3_bits
	.extern	_LEDDATA4_bits
	.extern	_LEDDATA5_bits
	.extern	_LEDDATA6_bits
	.extern	_LEDDATA7_bits
	.extern	_C1FILTCTL_bits
	.extern	_C1FILTPRE_bits
	.extern	_LEDOMS1_bits
	.extern	_LEDODS0_bits
	.extern	_LEDOMS0_bits
	.extern	_LEDODS1_bits
	.extern	_LEDLUM_bits
	.extern	_PWM5FC_bits
	.extern	_T4CTL_bits
	.extern	_T0
	.extern	_PCL
	.extern	_PSW
	.extern	_P0
	.extern	_P2
	.extern	_P1
	.extern	_P3
	.extern	_PCH
	.extern	_INTCTL
	.extern	_EIF1
	.extern	_EIF2
	.extern	_T1L
	.extern	_T1H
	.extern	_T1CTL
	.extern	_T2L
	.extern	_T2CTL0
	.extern	_PWM1L
	.extern	_PWM1H
	.extern	_PWMCTL
	.extern	_PP1
	.extern	_BANK
	.extern	_ADSCANCTL
	.extern	_C1CTL
	.extern	_VDACS
	.extern	_AMPCTL
	.extern	_ANSEH
	.extern	_ADCDATA0H
	.extern	_ADCCTL0
	.extern	_AMPDT
	.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	_PWM2H
	.extern	_PUR0
	.extern	_IOCL
	.extern	_OSCCAL1
	.extern	_NVMDATAH
	.extern	_NVMDATAL
	.extern	_NVMADDRH
	.extern	_NVMADDRL
	.extern	_NVMCTL0
	.extern	_NVMCTL1
	.extern	_ADCDATA0L
	.extern	_ADCCTL1
	.extern	_T2CCRH
	.extern	_T2H
	.extern	_PP5H
	.extern	_PWM5H0
	.extern	_PWM5H1
	.extern	_P0LR
	.extern	_P2LR
	.extern	_P1LR
	.extern	_P3LR
	.extern	_TR3
	.extern	_EIE3
	.extern	_EIF3
	.extern	_OSCCAL2
	.extern	_OSCCAL3
	.extern	_ADCDATA1H
	.extern	_ADCDATA1L
	.extern	_PP5L
	.extern	_T2CCRL
	.extern	_PWM5L0
	.extern	_PWM5L1
	.extern	_PWM5CTL0
	.extern	_ADCINTCTL
	.extern	_ADCDATA2H
	.extern	_ADCDATA2L
	.extern	_PWM5CTL1
	.extern	_P5ASCTL
	.extern	_PSTRCTL
	.extern	_ADCDATA3H
	.extern	_PUR1
	.extern	_PUR2
	.extern	_INTEDGCTL
	.extern	_ADCDATA3L
	.extern	_VBIASCTL
	.extern	_VBIAS1EN
	.extern	_VBIAS2EN
	.extern	_PWM5OC
	.extern	_T2CTL1
	.extern	_VDAC
	.extern	_PWM5CTL2
	.extern	_PWMPC
	.extern	_RSCTL
	.extern	_TXSDR
	.extern	_RXSDR
	.extern	_BRCTL
	.extern	_TSCTL
	.extern	_EUBRGL
	.extern	_EUBRGH
	.extern	_SSCICTL0
	.extern	_SSCICTL1
	.extern	_SSCISTA
	.extern	_SSCIBUFR
	.extern	_SSCIMSK
	.extern	_WDTPS
	.extern	_MULAH
	.extern	_MULAL
	.extern	_MULBH
	.extern	_MULBL
	.extern	_MULCTL
	.extern	_MULRES3
	.extern	_MULRES2
	.extern	_MULRES1
	.extern	_MULRES0
	.extern	_DIVCTL
	.extern	_DIVAH
	.extern	_DIVAL
	.extern	_DIVB
	.extern	_DIVQH
	.extern	_DIVQL
	.extern	_DIVR
	.extern	_LEDCTL
	.extern	_LEDPRE
	.extern	_LEDDATA0
	.extern	_LEDDATA1
	.extern	_LEDDATA2
	.extern	_LEDDATA3
	.extern	_LEDDATA4
	.extern	_LEDDATA5
	.extern	_LEDDATA6
	.extern	_LEDDATA7
	.extern	_C1FILTCTL
	.extern	_C1FILTPRE
	.extern	_LEDOMS1
	.extern	_LEDODS0
	.extern	_LEDOMS0
	.extern	_LEDODS1
	.extern	_VRECAL2
	.extern	_VRECAL3
	.extern	_LEDLUM
	.extern	_PWM5FC
	.extern	_T4L
	.extern	_T4H
	.extern	_T4REL
	.extern	_T4REH
	.extern	_T4CTL
	.extern	_RC32KCAL
	.extern	_startup
	.extern	__sdcc_gsinit_startup
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
	.global	_Delay_ms
	.global	_init_mcu
	.global	_init_pwm
	.global	_pwm_function
	.global	_main
	.global	_int_fun0
	.global	_int_fun1

	.global I0R1
	.global I0PSW
	.global I0PCH
	.global I1R1
	.global I1PSW
	.global I1PCH
	.global STK11
	.global STK10
	.global STK09
	.global STK08
	.global STK07
	.global STK06
	.global STK05
	.global STK04
	.global STK03
	.global STK02
	.global STK01
	.global STK00

sharebank .udata 0x0080
I0R1		.res 1
I0PSW		.res 1
I0PCH		.res 1
I1R1		.res 1
I1PSW		.res 1
I1PCH		.res 1
STK11	.res 1
	.type STK11, 108
STK10	.res 1
	.type STK10, 108
STK09	.res 1
	.type STK09, 108
STK08	.res 1
	.type STK08, 108
STK07	.res 1
	.type STK07, 108
STK06	.res 1
	.type STK06, 108
STK05	.res 1
	.type STK05, 108
STK04	.res 1
	.type STK04, 108
STK03	.res 1
	.type STK03, 108
STK02	.res 1
	.type STK02, 108
STK01	.res 1
	.type STK01, 108
STK00	.res 1
	.type STK00, 108

;--------------------------------------------------------
; global definitions
;--------------------------------------------------------
;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
UDL_main_0	.udata
r0x1001	.res	1
UDL_main_1	.udata
r0x1000	.res	1
UDL_main_2	.udata
r0x1002	.res	1
UDL_main_3	.udata
r0x1003	.res	1
;--------------------------------------------------------
; initialized data
;--------------------------------------------------------
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
;	.udata_ovr
;--------------------------------------------------------
; reset vector 
;--------------------------------------------------------
STARTUP	.code 0x0000
	NOP
	PAGESEL	init_imp
	JMP		init_imp

	.global	init_imp
INIT_IMP	.code
init_imp
	PAGESEL	_startup
	CALL	_startup
	PAGESEL	__sdcc_gsinit_startup
	CALL	__sdcc_gsinit_startup
	PAGESEL	_main
	JMP		_main
;--------------------------------------------------------
; interrupt and initialization code
;--------------------------------------------------------



func._int_fun0	.code
;***
;  PostBlock Stats: dbName = I
;***
;entry:  _int_fun0	;Function start
; 0 exit points
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_int_fun0	;Function start
; 0 exit points
;	op : LABEL
;	op : ENDFUNCTION
; R3 resprent for wsave,R4 resprent for ssave, R5 resprent for psave
interrupt_service_routine_0x04
_00026_DS_
;	.line	120; "../main.c"	}
	IRET	



func._int_fun1	.code
;***
;  PostBlock Stats: dbName = I
;***
;entry:  _int_fun1	;Function start
; 0 exit points
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_int_fun1	;Function start
; 0 exit points
;	op : LABEL
;	op : ENDFUNCTION
; R3 resprent for wsave,R4 resprent for ssave, R5 resprent for psave
interrupt_service_routine_0x14
_00028_DS_
;	.line	127; "../main.c"	}
	IRET	



func._main	.code
;***
;  PostBlock Stats: dbName = M
;***
;entry:  _main	;Function start
; 2 exit points
;has an exit
;functions called:
;   _init_mcu
;   _init_pwm
;   _Delay_ms
;   _pwm_function
;   _Delay_ms
;   _init_mcu
;   _init_pwm
;   _Delay_ms
;   _pwm_function
;   _Delay_ms
;1 compiler assigned register :
;   STK00
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_main	;Function start
; 2 exit points
;	op : CALL
;	.line	105; "../main.c"	init_mcu();
	PAGESEL	_init_mcu
	CALL	_init_mcu
	PAGESEL	$
;	op : CALL
;	.line	106; "../main.c"	init_pwm();
	PAGESEL	_init_pwm
	CALL	_init_pwm
	PAGESEL	$
;	op : SEND
;	op : CALL
;	.line	107; "../main.c"	Delay_ms(10);
	MOV	R0,# 0x0a
	BANKSEL	STK00
	MOV	STK00, R0
	MOV	R0,# 0x00
	PAGESEL	_Delay_ms
	CALL	_Delay_ms
	PAGESEL	$
;	op : LABEL
;	op : CALL
_00021_DS_
;	.line	111; "../main.c"	pwm_function();
	PAGESEL	_pwm_function
	CALL	_pwm_function
	PAGESEL	$
;	op : SEND
;	op : CALL
;	.line	112; "../main.c"	Delay_ms(10);
	MOV	R0,# 0x0a
	BANKSEL	STK00
	MOV	STK00, R0
	MOV	R0,# 0x00
	PAGESEL	_Delay_ms
	CALL	_Delay_ms
	PAGESEL	$
;	op : GOTO
	JMP	_00021_DS_
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _main



func._pwm_function	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _pwm_function	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_pwm_function	;Function start
; 2 exit points
;	op : LABEL
;	op : ENDFUNCTION
;	.line	95; "../main.c"	}
	CRET	
; exit point of _pwm_function



func._init_pwm	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _init_pwm	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_init_pwm	;Function start
; 2 exit points
;	op : =
;	.line	72; "../main.c"	P5ASCTL		= 0b00000000;			//设置PWM5关闭时候PWM口输出电平		这里为默认设置，关闭PWM时候都输出0
	BANKSEL	_P5ASCTL
	CLR	_P5ASCTL
;	op : =
;	.line	73; "../main.c"	PWM5CTL2	= 0b00000001;			//PWM周期自动填充更新
	MOV	R0,# 0x01
	BANKSEL	_PWM5CTL2
	MOV	_PWM5CTL2, R0
;	op : =
;	.line	74; "../main.c"	PWM5CTL0	= 0b10001100; 			//半桥输出PWM  高电平有效    PWM5A  PWM5B作为互补输出
	MOV	R0,# 0x8c
	BANKSEL	_PWM5CTL0
	MOV	_PWM5CTL0, R0
;	op : =
;	.line	75; "../main.c"	PWM5CTL1	= 0b00000011;			//死区时间设置   死区时间为  一个T2时间基准	  这里设置为3基准时间
	MOV	R0,# 0x03
	BANKSEL	_PWM5CTL1
	MOV	_PWM5CTL1, R0
;	op : =
;	.line	76; "../main.c"	PP5H		= 0;					//高位
	BANKSEL	_PP5H
	CLR	_PP5H
;	op : =
;	.line	77; "../main.c"	PP5L		= 40;					//低位			设置PWM周期  周期时间为PP5+1进行计算
	MOV	R0,# 0x28
	BANKSEL	_PP5L
	MOV	_PP5L, R0
;	op : =
;	.line	78; "../main.c"	PWM5L1		= 0;					//高位
	BANKSEL	_PWM5L1
	CLR	_PWM5L1
;	op : =
;	.line	79; "../main.c"	PWM5L0		= 20;					//地位    			设置PWM占空比
	MOV	R0,# 0x14
	BANKSEL	_PWM5L0
	MOV	_PWM5L0, R0
;	op : =
;	.line	80; "../main.c"	T2H			= 0;
	BANKSEL	_T2H
	CLR	_T2H
;	op : =
;	.line	81; "../main.c"	T2L			= 0;					//PWM时钟源 T2相关设置
	BANKSEL	_T2L
	CLR	_T2L
;	op : =
;	.line	82; "../main.c"	T2CTL0		= 0b00000000;
	BANKSEL	_T2CTL0
	CLR	_T2CTL0
;	op : =
;	.line	83; "../main.c"	T2ON		= 1;
	BANKSEL	_T2CTL0_bits
	SET	_T2CTL0_bits, 2
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _init_pwm



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	45; "../main.c"	OSCCTL = 0x70;          //设置为16M
	MOV	R0,# 0x70
	BANKSEL	_OSCCTL
	MOV	_OSCCTL, R0
;	op : =
;	.line	48; "../main.c"	TR0 = 0x08;				//设置P03端口为输入，P0其他I/O口为输出
	MOV	R0,# 0x08
	BANKSEL	_TR0
	MOV	_TR0, R0
;	op : =
;	.line	49; "../main.c"	TR1 = 0x00;				//设置P1端口为输出
	BANKSEL	_TR1
	CLR	_TR1
;	op : =
;	.line	50; "../main.c"	TR2 = 0x00;				//设置P2端口为输出
	BANKSEL	_TR2
	CLR	_TR2
;	op : =
;	.line	51; "../main.c"	TR3 = 0x00;				//设置P3端口为输出
	BANKSEL	_TR3
	CLR	_TR3
;	op : =
;	.line	52; "../main.c"	P0 = 0;
	BANKSEL	_P0
	CLR	_P0
;	op : =
;	.line	53; "../main.c"	P1 = 0;
	BANKSEL	_P1
	CLR	_P1
;	op : =
;	.line	54; "../main.c"	P2 = 0;
	BANKSEL	_P2
	CLR	_P2
;	op : =
;	.line	55; "../main.c"	P3 = 0;
	BANKSEL	_P3
	CLR	_P3
;	op : =
;	.line	56; "../main.c"	P0LR = 0;				//P0口输出低电平
	BANKSEL	_P0LR
	CLR	_P0LR
;	op : =
;	.line	57; "../main.c"	P1LR = 0;				//P1口输出低电平
	BANKSEL	_P1LR
	CLR	_P1LR
;	op : =
;	.line	58; "../main.c"	P2LR = 0;				//P2口输出低电平
	BANKSEL	_P2LR
	CLR	_P2LR
;	op : =
;	.line	59; "../main.c"	P3LR = 0;				//P3口输出低电平
	BANKSEL	_P3LR
	CLR	_P3LR
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _init_mcu



func._Delay_ms	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _Delay_ms	;Function start
; 2 exit points
;has an exit
;5 compiler assigned registers:
;   r0x1000
;   STK00
;   r0x1001
;   r0x1002
;   r0x1003
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_Delay_ms	;Function start
; 2 exit points
;	op : RECEIVE
;	.line	26; "../main.c"	void Delay_ms(uint ms_data)
	BANKSEL	r0x1000
	MOV	r0x1000, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1001
	MOV	r0x1001, R0
;	op : =
;	op : LABEL
;	op : =
_00004_DS_
;	.line	29; "../main.c"	while(ms_data--)
	BANKSEL	r0x1001
	MOVZ	R0, r0x1001
	BANKSEL	r0x1002
	MOV	r0x1002, R0
	BANKSEL	r0x1000
	MOVZ	R0, r0x1000
	BANKSEL	r0x1003
	MOV	r0x1003, R0
;	op : -
	MOV	R0,# 0xff
	BANKSEL	r0x1001
	ADD	r0x1001, R0
	JNB	PSW, 0
	JMP	_00030_DS_
	BANKSEL	r0x1000
	DEC	r0x1000
;	op : IFX
_00030_DS_
	BANKSEL	r0x1002
	MOVZ	R0, r0x1002
	BANKSEL	r0x1003
	ORL	R0, r0x1003
	JNB	PSW, 2
	JMP	_00007_DS_
;	op : =
;	.line	32; "../main.c"	while(i--);
	MOV	R0,# 0x7c
	BANKSEL	r0x1002
	MOV	r0x1002, R0
;	op : LABEL
;	op : =
_00001_DS_
	BANKSEL	r0x1002
	MOVZ	R0, r0x1002
	BANKSEL	r0x1003
	MOV	r0x1003, R0
;	op : -
	BANKSEL	r0x1002
	DEC	r0x1002
;	op : IFX
	MOV	R0,# 0x00
	BANKSEL	r0x1003
	ORL	R0, r0x1003
	JNB	PSW, 2
	JMP	_00004_DS_
;	op : GOTO
	JMP	_00001_DS_
;	op : LABEL
;	op : ENDFUNCTION
_00007_DS_
	CRET	
; exit point of _Delay_ms


;	code size estimation:
;	   87+   43 =   130 instructions (  346 byte)


	.end
