;--------------------------------------------------------
; File Created by ChiponCC : aolisn inc.
; Version 3.0.4#6752 (Jul  7 2015 17:19:27) (MSVC)
; This file was generated Wed Oct 21 19:41:55 2015
;--------------------------------------------------------
; chipon port for the 16-bit core
;--------------------------------------------------------
;	.file	"../main.c"
	.list	p=KF8V216
	.radix dec
	.include "KF8V216.inc"
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	.extern	_PSW_bits
	.extern	_P0_bits
	.extern	_P2_bits
	.extern	_P1_bits
	.extern	_INTCTL_bits
	.extern	_EIF1_bits
	.extern	_T1CTL_bits
	.extern	_T2CTL_bits
	.extern	_PWMCTL_bits
	.extern	_CM1CTL_bits
	.extern	_AMPCTL_bits
	.extern	_ANSEH_bits
	.extern	_ADCCTL0_bits
	.extern	_AMPDT_bits
	.extern	_OPTR_bits
	.extern	_IP0_bits
	.extern	_IP1_bits
	.extern	_TR0_bits
	.extern	_TR2_bits
	.extern	_TR1_bits
	.extern	_VRECTL1_bits
	.extern	_EIE1_bits
	.extern	_PCTL_bits
	.extern	_OSCCTL_bits
	.extern	_ANSEL_bits
	.extern	_PUR_bits
	.extern	_IOCL_bits
	.extern	_ADCCTL1_bits
	.extern	_P0LR_bits
	.extern	_P2LR_bits
	.extern	_P1LR_bits
	.extern	_PWM4CTL0_bits
	.extern	_PWM4CTL1_bits
	.extern	_P4ASCTL_bits
	.extern	_PATRCTL_bits
	.extern	_T0
	.extern	_PCL
	.extern	_PSW
	.extern	_P0
	.extern	_P2
	.extern	_P1
	.extern	_PCH
	.extern	_INTCTL
	.extern	_EIF1
	.extern	_T1L
	.extern	_T1H
	.extern	_T1CTL
	.extern	_T2L
	.extern	_T2CTL
	.extern	_PWM1L
	.extern	_PWM1H
	.extern	_PWMCTL
	.extern	_PP1
	.extern	_CM1CTL
	.extern	_AMPCTL
	.extern	_VRECAL1
	.extern	_ANSEH
	.extern	_ADCDATAH
	.extern	_ADCCTL0
	.extern	_AMPDT
	.extern	_OPTR
	.extern	_IP0
	.extern	_IP1
	.extern	_TR0
	.extern	_TR2
	.extern	_TR1
	.extern	_VRECAL2
	.extern	_VRECTL1
	.extern	_EIE1
	.extern	_PCTL
	.extern	_OSCCTL
	.extern	_OSCCAL0
	.extern	_ANSEL
	.extern	_PP2
	.extern	_PWM2L
	.extern	_PWM2H
	.extern	_PUR
	.extern	_IOCL
	.extern	_OSCCAL1
	.extern	_ADCDATAL
	.extern	_ADCCTL1
	.extern	_T2CCRH
	.extern	_T2H
	.extern	_PP4H
	.extern	_PWM4L1
	.extern	_PWM4H1
	.extern	_P0LR
	.extern	_P2LR
	.extern	_P1LR
	.extern	_OSCCAL2
	.extern	_OSCCAL3
	.extern	_PP4L
	.extern	_T2CCRL
	.extern	_PWM4L0
	.extern	_PWM4H0
	.extern	_PWM4CTL0
	.extern	_PWM4CTL1
	.extern	_P4ASCTL
	.extern	_PATRCTL
	.extern	__R2PCL
	.extern	_startup
	.extern	__sdcc_gsinit_startup
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
	.global	_Delay_200us
	.global	_Display
	.global	_Adc_read
	.global	_Adc_fun
	.global	_Init_fun
	.global	_main
	.global	_int_fun0
	.global	_int_fun1
	.global	_Unit
	.global	_Decade
	.global	_Hundred
	.global	_Thousand
	.global	_Arr_num

	.global I0R1
	.global I0PCH
	.global I1R1
	.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
I0PCH		.res 1
I1R1		.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
;--------------------------------------------------------
UD_main_0	.udata
_Unit	.res	1

UD_main_1	.udata
_Decade	.res	1

UD_main_2	.udata
_Hundred	.res	1

UD_main_3	.udata
_Thousand	.res	1

;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
UDL_main_0	.udata
r0x1012	.res	1
UDL_main_1	.udata
r0x1011	.res	1
UDL_main_2	.udata
r0x1013	.res	1
UDL_main_3	.udata
r0x1014	.res	1
UDL_main_4	.udata
r0x1008	.res	1
UDL_main_5	.udata
r0x1009	.res	1
UDL_main_6	.udata
r0x100A	.res	1
UDL_main_7	.udata
r0x100C	.res	1
UDL_main_8	.udata
r0x100D	.res	1
UDL_main_9	.udata
r0x100E	.res	1
UDL_main_10	.udata
r0x1010	.res	1
UDL_main_11	.udata
r0x100F	.res	1
UDL_main_12	.udata
r0x1005	.res	1
UDL_main_13	.udata
r0x1006	.res	1
UDL_main_14	.udata
r0x1007	.res	1
UDL_main_15	.udata
r0x1004	.res	1
;--------------------------------------------------------
; initialized data
;--------------------------------------------------------

ID_main_0	.code
_Arr_num
	RRET R0, #0xe7
	RRET R0, #0x06
	RRET R0, #0xb3
	RRET R0, #0x37
	RRET R0, #0x56
	RRET R0, #0x75
	RRET R0, #0xf5
	RRET R0, #0x07
	RRET R0, #0xf7
	RRET R0, #0x77
	RRET R0, #0xd7
	RRET R0, #0xf4
	RRET R0, #0xe1
	RRET R0, #0xb6
	RRET R0, #0xf1
	RRET R0, #0xd1
	RRET R0, #0x00

;--------------------------------------------------------
; 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
_00042_DS_
;	.line	200; "../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
_00044_DS_
;	.line	207; "../main.c"	}
	IRET	



func._main	.code
;***
;  PostBlock Stats: dbName = M
;***
;entry:  _main	;Function start
; 2 exit points
;has an exit
;functions called:
;   _Init_fun
;   _Delay_200us
;   _Adc_read
;   _Display
;   _Init_fun
;   _Delay_200us
;   _Adc_read
;   _Display
;5 compiler assigned registers:
;   r0x1011
;   STK00
;   r0x1012
;   r0x1013
;   r0x1014
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_main	;Function start
; 2 exit points
;	op : CALL
;	.line	65; "../main.c"	Init_fun();			                //初始化
	PAGESEL	_Init_fun
	CALL	_Init_fun
	PAGESEL	$
;	op : CALL
;	.line	66; "../main.c"	Delay_200us();
	PAGESEL	_Delay_200us
	CALL	_Delay_200us
	PAGESEL	$
;	op : LABEL
;	op : CALL
_00002_DS_
;	.line	70; "../main.c"	Dis_adc = Adc_read();           //将ADC采样返回值赋予Dis_adc
	PAGESEL	_Adc_read
	CALL	_Adc_read
	PAGESEL	$
	BANKSEL	r0x1011
	MOV	r0x1011, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1012
	MOV	r0x1012, R0
;	op : BITWISEAND
;	.line	71; "../main.c"	Unit = Dis_adc&0x0f;            //将Dis_adc的最低4位赋予数码管的个位
	MOV	R0,# 0x0f
	BANKSEL	r0x1012
	AND	R0, r0x1012
	BANKSEL	_Unit
	MOV	_Unit, R0
	BANKSEL	r0x1013
	MOV	r0x1013, R0
	BANKSEL	r0x1014
	CLR	r0x1014
;	op : CAST
;;102	MOVZ	R0, r0x1013
;	op : BITWISEAND
;	.line	72; "../main.c"	Decade = Dis_adc&0xf0;
	MOV	R0,# 0xf0
	BANKSEL	r0x1012
	AND	R0, r0x1012
	BANKSEL	_Decade
	MOV	_Decade, R0
	BANKSEL	r0x1013
	MOV	r0x1013, R0
	BANKSEL	r0x1014
	CLR	r0x1014
;	op : CAST
;;101	MOVZ	R0, r0x1013
;	op : RIGHT_OP
;	.line	73; "../main.c"	Decade >>= 4;                   //将Dis_adc的第7-4位赋予数码管的十位
	BANKSEL	_Decade
	SWAPR	R0, _Decade
	AND	R0,# 0x0f
	BANKSEL	_Decade
	MOV	_Decade, R0
;	op : RIGHT_OP
;	.line	74; "../main.c"	Dis_adc >>= 8;                  //右移8位，取Dis_adc的高8位
	BANKSEL	r0x1011
	MOVZ	R0, r0x1011
	BANKSEL	r0x1012
	MOV	r0x1012, R0
	BANKSEL	r0x1011
	CLR	r0x1011
;	op : BITWISEAND
;	.line	75; "../main.c"	Hundred = Dis_adc&0x0f;         //将此时的Dis_adc的最低4位赋予数码管的百位
	MOV	R0,# 0x0f
	BANKSEL	r0x1012
	AND	R0, r0x1012
	BANKSEL	_Hundred
	MOV	_Hundred, R0
	BANKSEL	r0x1013
	MOV	r0x1013, R0
	BANKSEL	r0x1014
	CLR	r0x1014
;	op : CAST
;;99	MOVZ	R0, r0x1013
;	op : BITWISEAND
;	.line	76; "../main.c"	Thousand = Dis_adc&0xf0;
	MOV	R0,# 0xf0
	BANKSEL	r0x1012
	AND	r0x1012, R0
	BANKSEL	r0x1011
	CLR	r0x1011
;	op : CAST
	BANKSEL	r0x1012
	MOVZ	R0, r0x1012
	BANKSEL	_Thousand
	MOV	_Thousand, R0
;	op : RIGHT_OP
;	.line	77; "../main.c"	Thousand >>= 4;                 //将此时的Dis_adc的第7-4位赋予数码管的千位
	BANKSEL	_Thousand
	SWAPR	R0, _Thousand
	AND	R0,# 0x0f
	BANKSEL	_Thousand
	MOV	_Thousand, R0
;	op : CALL
;	.line	78; "../main.c"	Display();                      //显示
	PAGESEL	_Display
	CALL	_Display
	PAGESEL	$
;	op : GOTO
	JMP	_00002_DS_
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _main



func._Delay_200us	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _Delay_200us	;Function start
; 2 exit points
;has an exit
;1 compiler assigned register :
;   r0x1004
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_Delay_200us	;Function start
; 2 exit points
;	op : =
;	.line	194; "../main.c"	while(--i);
	MOV	R0,# 0x3c
	BANKSEL	r0x1004
	MOV	r0x1004, R0
;	op : LABEL
;	op : -
_00033_DS_
	BANKSEL	r0x1004
	DECJZ	r0x1004
	JMP	_00033_DS_
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _Delay_200us



func._Display	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _Display	;Function start
; 2 exit points
;has an exit
;functions called:
;   __R2PCL
;   _Delay_200us
;   __R2PCL
;   _Delay_200us
;   __R2PCL
;   _Delay_200us
;   __R2PCL
;   _Delay_200us
;   __R2PCL
;   _Delay_200us
;   __R2PCL
;   _Delay_200us
;   __R2PCL
;   _Delay_200us
;   __R2PCL
;   _Delay_200us
;3 compiler assigned registers:
;   r0x1005
;   r0x1006
;   r0x1007
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_Display	;Function start
; 2 exit points
;	op : =
;	.line	156; "../main.c"	for(i = 0; i < 50 ; i++)
	BANKSEL	r0x1005
	CLR	r0x1005
;	op : LABEL
;	op : <
;unsigned compare: left < lit(0x32=50), size=1
_00023_DS_
	MOV	R0,# 0x32
	BANKSEL	r0x1005
	SUB	R0, r0x1005
;comparing bytes at offset 0
	JNB	PSW, 0
	JMP	_00027_DS_
;	op : =
;	.line	158; "../main.c"	NUM1_IO=0;
	CLR	_P0LR_bits, 4
;	op : +
;	.line	159; "../main.c"	P1LR=Arr_num[Unit];
	MOV	R0,# (_Arr_num + 0)
	BANKSEL	_Unit
	ADD	R0, _Unit
	BANKSEL	r0x1006
	MOV	r0x1006, R0
	MOV	R0,# high (_Arr_num + 0)
	BANKSEL	r0x1007
	MOV	r0x1007, R0
	CLR	R0
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00046_DS_
	BANKSEL	r0x1007
	ADD	r0x1007, R0
;	op : GET_VALUE_AT_ADDRESS
_00046_DS_
	BANKSEL	r0x1007
	MOV	R1, r0x1007
	BANKSEL	r0x1006
	MOV	R0, r0x1006
	PAGESEL	__R2PCL
	CALL	__R2PCL
	PAGESEL	$
	MOV	_P1LR, R0
;	op : CALL
;	.line	160; "../main.c"	Delay_200us();
	PAGESEL	_Delay_200us
	CALL	_Delay_200us
	PAGESEL	$
;	op : =
;	.line	161; "../main.c"	P1LR=0;
	CLR	_P1LR
;	op : =
;	.line	162; "../main.c"	NUM1_IO=1;
	SET	_P0LR_bits, 4
;	op : =
;	.line	164; "../main.c"	NUM2_IO=0;
	CLR	_P0LR_bits, 5
;	op : +
;	.line	165; "../main.c"	P1LR=Arr_num[Decade];
	MOV	R0,# (_Arr_num + 0)
	BANKSEL	_Decade
	ADD	R0, _Decade
	BANKSEL	r0x1006
	MOV	r0x1006, R0
	MOV	R0,# high (_Arr_num + 0)
	BANKSEL	r0x1007
	MOV	r0x1007, R0
	CLR	R0
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00047_DS_
	BANKSEL	r0x1007
	ADD	r0x1007, R0
;	op : GET_VALUE_AT_ADDRESS
_00047_DS_
	BANKSEL	r0x1007
	MOV	R1, r0x1007
	BANKSEL	r0x1006
	MOV	R0, r0x1006
	PAGESEL	__R2PCL
	CALL	__R2PCL
	PAGESEL	$
	MOV	_P1LR, R0
;	op : CALL
;	.line	166; "../main.c"	Delay_200us();
	PAGESEL	_Delay_200us
	CALL	_Delay_200us
	PAGESEL	$
;	op : =
;	.line	167; "../main.c"	P1LR=0;
	CLR	_P1LR
;	op : =
;	.line	168; "../main.c"	NUM2_IO=1;
	SET	_P0LR_bits, 5
;	op : =
;	.line	170; "../main.c"	NUM3_IO=0;
	CLR	_P0LR_bits, 1
;	op : +
;	.line	171; "../main.c"	P1LR=Arr_num[Hundred];
	MOV	R0,# (_Arr_num + 0)
	BANKSEL	_Hundred
	ADD	R0, _Hundred
	BANKSEL	r0x1006
	MOV	r0x1006, R0
	MOV	R0,# high (_Arr_num + 0)
	BANKSEL	r0x1007
	MOV	r0x1007, R0
	CLR	R0
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00048_DS_
	BANKSEL	r0x1007
	ADD	r0x1007, R0
;	op : GET_VALUE_AT_ADDRESS
_00048_DS_
	BANKSEL	r0x1007
	MOV	R1, r0x1007
	BANKSEL	r0x1006
	MOV	R0, r0x1006
	PAGESEL	__R2PCL
	CALL	__R2PCL
	PAGESEL	$
	MOV	_P1LR, R0
;	op : CALL
;	.line	172; "../main.c"	Delay_200us();
	PAGESEL	_Delay_200us
	CALL	_Delay_200us
	PAGESEL	$
;	op : =
;	.line	173; "../main.c"	P1LR=0;
	CLR	_P1LR
;	op : =
;	.line	174; "../main.c"	NUM3_IO=1;
	SET	_P0LR_bits, 1
;	op : =
;	.line	176; "../main.c"	NUM4_IO=0;
	CLR	_P0LR_bits, 0
;	op : +
;	.line	177; "../main.c"	P1LR=Arr_num[Thousand];
	MOV	R0,# (_Arr_num + 0)
	BANKSEL	_Thousand
	ADD	R0, _Thousand
	BANKSEL	r0x1006
	MOV	r0x1006, R0
	MOV	R0,# high (_Arr_num + 0)
	BANKSEL	r0x1007
	MOV	r0x1007, R0
	CLR	R0
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00049_DS_
	BANKSEL	r0x1007
	ADD	r0x1007, R0
;	op : GET_VALUE_AT_ADDRESS
_00049_DS_
	BANKSEL	r0x1007
	MOV	R1, r0x1007
	BANKSEL	r0x1006
	MOV	R0, r0x1006
	PAGESEL	__R2PCL
	CALL	__R2PCL
	PAGESEL	$
	MOV	_P1LR, R0
;	op : CALL
;	.line	178; "../main.c"	Delay_200us();
	PAGESEL	_Delay_200us
	CALL	_Delay_200us
	PAGESEL	$
;	op : =
;	.line	179; "../main.c"	P1LR=0;
	CLR	_P1LR
;	op : =
;	.line	180; "../main.c"	NUM4_IO=1;
	SET	_P0LR_bits, 0
;	op : +
;	.line	156; "../main.c"	for(i = 0; i < 50 ; i++)
	BANKSEL	r0x1005
	INC	r0x1005
;	op : GOTO
	JMP	_00023_DS_
;	op : LABEL
;	op : ENDFUNCTION
_00027_DS_
	CRET	
; exit point of _Display



func._Adc_read	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _Adc_read	;Function start
; 2 exit points
;has an exit
;functions called:
;   _Adc_fun
;   _Adc_fun
;6 compiler assigned registers:
;   r0x100C
;   r0x100D
;   r0x100E
;   r0x100F
;   STK00
;   r0x1010
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_Adc_read	;Function start
; 2 exit points
;	op : =
;	.line	137; "../main.c"	uint Adc_sum = 0 ; 		          //adc采样累加变量
	BANKSEL	r0x100C
	CLR	r0x100C
	BANKSEL	r0x100D
	CLR	r0x100D
;	op : =
;	.line	139; "../main.c"	for(i = 0; i < 8; i++)
	MOV	R0,# 0x08
	BANKSEL	r0x100E
	MOV	r0x100E, R0
;	op : LABEL
;	op : CALL
_00018_DS_
;	.line	141; "../main.c"	Adc_sum += Adc_fun();		  //累加八次采样值
	PAGESEL	_Adc_fun
	CALL	_Adc_fun
	PAGESEL	$
	BANKSEL	r0x100F
	MOV	r0x100F, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1010
	MOV	r0x1010, R0
;	op : +
	BANKSEL	r0x1010
	MOV	R0, r0x1010
	BANKSEL	r0x100C
	ADD	r0x100C, R0
	BANKSEL	r0x100F
	MOVZ	R0, r0x100F
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00050_DS_
	BANKSEL	r0x100D
	ADD	r0x100D, R0
;	op : CAST
_00050_DS_
	BANKSEL	r0x100E
	MOVZ	R0, r0x100E
	BANKSEL	r0x1010
	MOV	r0x1010, R0
;	op : -
	BANKSEL	r0x1010
	DEC	r0x1010
;	op : CAST
	BANKSEL	r0x1010
	MOVZ	R0, r0x1010
	BANKSEL	r0x100E
	MOV	r0x100E, R0
;	op : IFX
;	.line	139; "../main.c"	for(i = 0; i < 8; i++)
	MOV	R0,# 0x00
	BANKSEL	r0x100E
	ORL	R0, r0x100E
	JB	PSW, 2
	JMP	_00018_DS_
;	op : RIGHT_OP
;	.line	143; "../main.c"	Adc_sum >>= 3;		              //右移动3位  除8求均值
	CLR	PSW, 0
	BANKSEL	r0x100D
	RRC	r0x100D
	BANKSEL	r0x100C
	RRC	r0x100C
	CLR	PSW, 0
	BANKSEL	r0x100D
	RRC	r0x100D
	BANKSEL	r0x100C
	RRC	r0x100C
	CLR	PSW, 0
	BANKSEL	r0x100D
	RRC	r0x100D
	BANKSEL	r0x100C
	RRC	r0x100C
;	op : RETURN
;	.line	144; "../main.c"	return Adc_sum;
	BANKSEL	r0x100C
	MOVZ	R0, r0x100C
	BANKSEL	STK00
	MOV	STK00, R0
	BANKSEL	r0x100D
	MOVZ	R0, r0x100D
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _Adc_read



func._Adc_fun	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _Adc_fun	;Function start
; 2 exit points
;has an exit
;5 compiler assigned registers:
;   r0x1008
;   r0x1009
;   r0x100A
;   r0x100B
;   STK00
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_Adc_fun	;Function start
; 2 exit points
;	op : =
;	.line	117; "../main.c"	START = 1;					  //启动ADC
	SET	_ADCCTL0_bits, 1
;	op : LABEL
;	op : GET_VALUE_AT_ADDRESS
_00009_DS_
;	.line	118; "../main.c"	while(START);                 //等待转换结束
	JNB	_ADCCTL0_bits, 1
	JMP	_00009_DS_
;	op : BITWISEAND
;	.line	121; "../main.c"	Adc_num = ADCDATAH&0x0F;	  //将高位加进去
	MOV	R0,# 0x0f
	AND	R0, _ADCDATAH
	BANKSEL	r0x1009
	MOV	r0x1009, R0
	BANKSEL	r0x1008
	MOV	r0x1008, R0
;	op : CAST
;;100	MOVZ	R0, r0x1008
	BANKSEL	r0x100A
	CLR	r0x100A
;	op : LEFT_OP
;	.line	122; "../main.c"	Adc_num <<= 8;		          //左移动8位高位归位
	BANKSEL	r0x1009
	MOVZ	R0, r0x1009
	BANKSEL	r0x100A
	MOV	r0x100A, R0
	BANKSEL	r0x1009
	CLR	r0x1009
;	op : CAST
;	.line	123; "../main.c"	Adc_num |= ADCDATAL;		  //将低位加进去
	MOVZ	R0, _ADCDATAL
	BANKSEL	r0x1008
	MOV	r0x1008, R0
;;1	CLR	r0x100B
;	op : |
	BANKSEL	r0x1008
	MOVZ	R0, r0x1008
	BANKSEL	r0x1009
	ORL	r0x1009, R0
	MOV	R0,# 0x00
	BANKSEL	r0x100A
	ORL	r0x100A, R0
;	op : RETURN
;	.line	126; "../main.c"	return Adc_num;			      //返回转换值
	BANKSEL	r0x1009
	MOVZ	R0, r0x1009
	BANKSEL	STK00
	MOV	STK00, R0
	BANKSEL	r0x100A
	MOVZ	R0, r0x100A
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _Adc_fun



func._Init_fun	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _Init_fun	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_Init_fun	;Function start
; 2 exit points
;	op : =
;	.line	91; "../main.c"	OSCCTL = 0x60;                     //设置为8M
	MOV	R0,# 0x60
	MOV	_OSCCTL, R0
;	op : =
;	.line	93; "../main.c"	TR0 = 0x0C;				           //设置P03端口为输入  P02为AN2模拟通道 配置为输入口
	MOV	R0,# 0x0c
	MOV	_TR0, R0
;	op : =
;	.line	94; "../main.c"	TR1 = 0x00;				           //设置P1端口为输出
	CLR	_TR1
;	op : =
;	.line	96; "../main.c"	P0 = 0;
	CLR	_P0
;	op : =
;	.line	97; "../main.c"	P1 = 0;
	CLR	_P1
;	op : =
;	.line	99; "../main.c"	P0LR = 0;
	CLR	_P0LR
;	op : =
;	.line	100; "../main.c"	P1LR = 0;
	CLR	_P1LR
;	op : =
;	.line	103; "../main.c"	ANSEL = 0x04;		              //设置通道2为模拟口
	MOV	R0,# 0x04
	MOV	_ANSEL, R0
;	op : =
;	.line	104; "../main.c"	ADCCTL0 = 0x89;		              //右对齐，通道2， AD使能打开
	MOV	R0,# 0x89
	MOV	_ADCCTL0, R0
;	op : =
;	.line	105; "../main.c"	ADCCTL1 = 0x17;		              //8分频，VDD作为参考电压
	MOV	R0,# 0x17
	MOV	_ADCCTL1, R0
;	op : =
;	.line	106; "../main.c"	PCTL = 0X00;                      //禁止中断优先级 IPEN = 0
	CLR	_PCTL
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _Init_fun


;	code size estimation:
;	  231+   93 =   324 instructions (  834 byte)


	.end
