; .\e51pro.SRC generated from: e51pro.c
; COMPILER INVOKED BY:
;        f:\winsoft\Keil\C51\BIN\C51.EXE e51pro.c WARNINGLEVEL(1) OPTIMIZE(5,SIZE) REGFILE(.\E51Pro.ORC) BROWSE INCDIR(G:\MCU工程\E51Pro\) DEBUG OBJECTEXTEND CODE SRC(.\e51pro.SRC)

$NOMOD51

NAME	E51PRO

P0	DATA	080H
P1	DATA	090H
P2	DATA	0A0H
P3	DATA	0B0H
AC	BIT	0D0H.6
T0	BIT	0B0H.4
T1	BIT	0B0H.5
EA	BIT	0A8H.7
IE	DATA	0A8H
P0_0	BIT	080H.0
P1_0	BIT	090H.0
P0_1	BIT	080H.1
FL	BIT	0D0H.1
P2_0	BIT	0A0H.0
P1_1	BIT	090H.1
P0_2	BIT	080H.2
P3_0	BIT	0B0H.0
P2_1	BIT	0A0H.1
P1_2	BIT	090H.2
P0_3	BIT	080H.3
P3_1	BIT	0B0H.1
P2_2	BIT	0A0H.2
P1_3	BIT	090H.3
P0_4	BIT	080H.4
P3_2	BIT	0B0H.2
P2_3	BIT	0A0H.3
P1_4	BIT	090H.4
P0_5	BIT	080H.5
RD	BIT	0B0H.7
P3_3	BIT	0B0H.3
P2_4	BIT	0A0H.4
P1_5	BIT	090H.5
P0_6	BIT	080H.6
P3_4	BIT	0B0H.4
P2_5	BIT	0A0H.5
P1_6	BIT	090H.6
P0_7	BIT	080H.7
P3_5	BIT	0B0H.5
ES	BIT	0A8H.4
P2_6	BIT	0A0H.6
P1_7	BIT	090H.7
P3_6	BIT	0B0H.6
P2_7	BIT	0A0H.7
IP	DATA	0B8H
P3_7	BIT	0B0H.7
RI	BIT	098H.0
CY	BIT	0D0H.7
INT0	BIT	0B0H.2
INT1	BIT	0B0H.3
TI	BIT	098H.1
PS	BIT	0B8H.4
SP	DATA	081H
OV	BIT	0D0H.2
WR	BIT	0B0H.6
SBUF	DATA	099H
PCON	DATA	087H
SCON	DATA	098H
TMOD	DATA	089H
TCON	DATA	088H
IE0	BIT	088H.1
IE1	BIT	088H.3
B	DATA	0F0H
ACC	DATA	0E0H
ET0	BIT	0A8H.1
ET1	BIT	0A8H.3
TF0	BIT	088H.5
ET2	BIT	0A8H.5
TF1	BIT	088H.7
RB8	BIT	098H.2
TH0	DATA	08CH
EX0	BIT	0A8H.0
IT0	BIT	088H.0
TH1	DATA	08DH
EX1	BIT	0A8H.2
TB8	BIT	098H.3
IT1	BIT	088H.2
P	BIT	0D0H.0
SM0	BIT	098H.7
TL0	DATA	08AH
SM1	BIT	098H.6
TL1	DATA	08BH
SM2	BIT	098H.5
PT0	BIT	0B8H.1
RS0	BIT	0D0H.3
PT1	BIT	0B8H.3
RS1	BIT	0D0H.4
PT2	BIT	0B8H.5
TR0	BIT	088H.4
TR1	BIT	088H.6
PX0	BIT	0B8H.0
PX1	BIT	0B8H.2
DPH	DATA	083H
DPL	DATA	082H
REN	BIT	098H.4
RXD	BIT	0B0H.0
TXD	BIT	0B0H.1
F0	BIT	0D0H.5
PSW	DATA	0D0H
?PR?_Delay_ms?E51PRO SEGMENT CODE 
?DT?_Delay_ms?E51PRO SEGMENT DATA OVERLAYABLE 
?PR?_Delay_us?E51PRO SEGMENT CODE 
?DT?_Delay_us?E51PRO SEGMENT DATA OVERLAYABLE 
?PR?WaitComm?E51PRO  SEGMENT CODE 
?PR?WaitResp?E51PRO  SEGMENT CODE 
?PR?WaitData?E51PRO  SEGMENT CODE 
?PR?SendData?E51PRO  SEGMENT CODE 
?PR?SendResp?E51PRO  SEGMENT CODE 
?PR?SetVpp5V?E51PRO  SEGMENT CODE 
?PR?SetVpp0V?E51PRO  SEGMENT CODE 
?PR?SetVpp12V?E51PRO SEGMENT CODE 
?PR?main?E51PRO      SEGMENT CODE 
?DT?E51PRO           SEGMENT DATA 
	EXTRN	CODE (Pro00)
	EXTRN	CODE (?C_STARTUP)
	PUBLIC	n
	PUBLIC	ComBuf
	PUBLIC	nTimeOut
	PUBLIC	nAddress
	PUBLIC	main
	PUBLIC	SetVpp12V
	PUBLIC	SetVpp0V
	PUBLIC	SetVpp5V
	PUBLIC	SendResp
	PUBLIC	SendData
	PUBLIC	WaitData
	PUBLIC	WaitResp
	PUBLIC	WaitComm
	PUBLIC	_Delay_us
	PUBLIC	_Delay_ms

	RSEG  ?DT?_Delay_ms?E51PRO
?_Delay_ms?BYTE:
        nMs?040:   DS   1

	RSEG  ?DT?_Delay_us?E51PRO
?_Delay_us?BYTE:
       n2Us?141:   DS   1

	RSEG  ?DT?E51PRO
       nAddress:   DS   2
       nTimeOut:   DS   2
         ComBuf:   DS   18
              n:   DS   1
; //Easy 51Pro编程器
; //E51Pro.c
; 
; #include <E51Pro.h>
; 
; BYTE ComBuf[18];
; UINT nAddress;
; UINT nTimeOut;
; BYTE n;
; 
; 
; void Delay_ms(BYTE nMs)//豪秒级的延时<255ms

	RSEG  ?PR?_Delay_ms?E51PRO
_Delay_ms:
			; SOURCE LINE # 12
	MOV  	nMs?040,R7
; {
			; SOURCE LINE # 13
; /*#pragma asm
; 	push 6
; 	push 7
; Delay_1ms:
; 	mov	 r6,#250
; 	djnz r6,$
; 	mov	 r6,#250
; 	djnz r6,$
; 	djnz R7,Delay_1ms
; 	pop 7
; 	pop 6
; #pragma endasm*/
; }
			; SOURCE LINE # 26
	RET  	
; END OF _Delay_ms

; 
; 
; void Delay_us(BYTE n2Us)//微秒级延时<255*2us

	RSEG  ?PR?_Delay_us?E51PRO
_Delay_us:
			; SOURCE LINE # 29
	MOV  	n2Us?141,R7
; {
			; SOURCE LINE # 30
; 	
; /*#pragma asm
; 	push 7
; Delay_2us:
; 	djnz R7,$
; 	pop  7
; #pragma endasm*/
; }
			; SOURCE LINE # 38
	RET  	
; END OF _Delay_us

; 
; BOOL WaitComm()

	RSEG  ?PR?WaitComm?E51PRO
WaitComm:
	USING	0
			; SOURCE LINE # 40
; {
			; SOURCE LINE # 41
; 	BYTE n=0;
			; SOURCE LINE # 42
;---- Variable 'n?242' assigned to Register 'R7' ----
	CLR  	A
	MOV  	R7,A
?C0003:
; 	while(!RI){}
			; SOURCE LINE # 43
	JNB  	RI,?C0003
?C0004:
; 	ComBuf[n]=SBUF;
			; SOURCE LINE # 44
	MOV  	A,#LOW (ComBuf)
	ADD  	A,R7
	MOV  	R0,A
	MOV  	@R0,SBUF
; 	RI=0;
			; SOURCE LINE # 45
	CLR  	RI
; 	n++;
			; SOURCE LINE # 46
	INC  	R7
; 	for(n;n<=17;n++)
			; SOURCE LINE # 47
?C0005:
	MOV  	A,R7
	SETB 	C
	SUBB 	A,#011H
	JNC  	?C0006
; 	{
			; SOURCE LINE # 48
; 		nTimeOut=0;
			; SOURCE LINE # 49
	CLR  	A
	MOV  	nTimeOut,A
	MOV  	nTimeOut+01H,A
?C0008:
; 		while(!RI)
			; SOURCE LINE # 50
	JB   	RI,?C0009
; 		{
			; SOURCE LINE # 51
; 			if(nTimeOut>10000) 
			; SOURCE LINE # 52
	SETB 	C
	MOV  	A,nTimeOut+01H
	SUBB 	A,#010H
	MOV  	A,nTimeOut
	SUBB 	A,#027H
	JC   	?C0010
; 				return 0;
			; SOURCE LINE # 53
	RET  	
?C0010:
; 			nTimeOut++;
			; SOURCE LINE # 54
	INC  	nTimeOut+01H
	MOV  	A,nTimeOut+01H
	JNZ  	?C0044
	INC  	nTimeOut
?C0044:
; 		}
			; SOURCE LINE # 55
	SJMP 	?C0008
?C0009:
; 		ComBuf[n]=SBUF;
			; SOURCE LINE # 56
	MOV  	A,#LOW (ComBuf)
	ADD  	A,R7
	MOV  	R0,A
	MOV  	@R0,SBUF
; 		RI=0;
			; SOURCE LINE # 57
	CLR  	RI
; 	}
			; SOURCE LINE # 58
	INC  	R7
	SJMP 	?C0005
?C0006:
; 	return 1;
			; SOURCE LINE # 59
	SETB 	C
; }
			; SOURCE LINE # 60
?C0011:
	RET  	
; END OF WaitComm

; 
; BOOL WaitResp()

	RSEG  ?PR?WaitResp?E51PRO
WaitResp:
			; SOURCE LINE # 62
; {
			; SOURCE LINE # 63
; 	nTimeOut=0;
			; SOURCE LINE # 64
	CLR  	A
	MOV  	nTimeOut,A
	MOV  	nTimeOut+01H,A
?C0012:
; 	while(!RI)
			; SOURCE LINE # 65
	JB   	RI,?C0013
; 	{
			; SOURCE LINE # 66
; 			if(nTimeOut>10000) 
			; SOURCE LINE # 67
	SETB 	C
	MOV  	A,nTimeOut+01H
	SUBB 	A,#010H
	MOV  	A,nTimeOut
	SUBB 	A,#027H
	JC   	?C0014
; 				return 0;
			; SOURCE LINE # 68
	RET  	
?C0014:
; 			nTimeOut++;
			; SOURCE LINE # 69
	INC  	nTimeOut+01H
	MOV  	A,nTimeOut+01H
	JNZ  	?C0045
	INC  	nTimeOut
?C0045:
; 	}
			; SOURCE LINE # 70
	SJMP 	?C0012
?C0013:
; 	ComBuf[0]=SBUF;
			; SOURCE LINE # 71
	MOV  	ComBuf,SBUF
; 		RI=0;
			; SOURCE LINE # 72
	CLR  	RI
; 	return 1;
			; SOURCE LINE # 73
	SETB 	C
; }
			; SOURCE LINE # 74
?C0015:
	RET  	
; END OF WaitResp

; 
; BOOL WaitData()

	RSEG  ?PR?WaitData?E51PRO
WaitData:
	USING	0
			; SOURCE LINE # 76
; {
			; SOURCE LINE # 77
; 
; 	for(n;n<=17;n++)
			; SOURCE LINE # 79
?C0016:
	MOV  	A,n
	SETB 	C
	SUBB 	A,#011H
	JNC  	?C0017
; 	{
			; SOURCE LINE # 80
; 		nTimeOut=0;
			; SOURCE LINE # 81
	CLR  	A
	MOV  	nTimeOut,A
	MOV  	nTimeOut+01H,A
?C0019:
; 		while(!RI)
			; SOURCE LINE # 82
	JB   	RI,?C0020
; 		{
			; SOURCE LINE # 83
; 			if(nTimeOut>10000) 
			; SOURCE LINE # 84
	SETB 	C
	MOV  	A,nTimeOut+01H
	SUBB 	A,#010H
	MOV  	A,nTimeOut
	SUBB 	A,#027H
	JC   	?C0021
; 				return 0;
			; SOURCE LINE # 85
	RET  	
?C0021:
; 			nTimeOut++;
			; SOURCE LINE # 86
	INC  	nTimeOut+01H
	MOV  	A,nTimeOut+01H
	JNZ  	?C0046
	INC  	nTimeOut
?C0046:
; 		}
			; SOURCE LINE # 87
	SJMP 	?C0019
?C0020:
; 		ComBuf[n]=SBUF;
			; SOURCE LINE # 88
	MOV  	A,#LOW (ComBuf)
	ADD  	A,n
	MOV  	R0,A
	MOV  	@R0,SBUF
; 		RI=0;
			; SOURCE LINE # 89
	CLR  	RI
; 	}
			; SOURCE LINE # 90
	INC  	n
	SJMP 	?C0016
?C0017:
; 	return 1;
			; SOURCE LINE # 91
	SETB 	C
; }
			; SOURCE LINE # 92
?C0022:
	RET  	
; END OF WaitData

; 
; void SendData()

	RSEG  ?PR?SendData?E51PRO
SendData:
	USING	0
			; SOURCE LINE # 94
; {
			; SOURCE LINE # 95
; 	BYTE n=0;
			; SOURCE LINE # 96
;---- Variable 'n?543' assigned to Register 'R7' ----
	CLR  	A
	MOV  	R7,A
; 	for(n;n<=17;n++)
			; SOURCE LINE # 97
?C0023:
	MOV  	A,R7
	SETB 	C
	SUBB 	A,#011H
	JNC  	?C0028
; 	{
			; SOURCE LINE # 98
; 		TI=0;
			; SOURCE LINE # 99
	CLR  	TI
; 		SBUF=ComBuf[n];
			; SOURCE LINE # 100
	MOV  	A,#LOW (ComBuf)
	ADD  	A,R7
	MOV  	R0,A
	MOV  	A,@R0
	MOV  	SBUF,A
?C0026:
; 		while(!TI){}
			; SOURCE LINE # 101
	JNB  	TI,?C0026
?C0027:
; 		TI=0;
			; SOURCE LINE # 102
	CLR  	TI
; 	}
			; SOURCE LINE # 103
	INC  	R7
	SJMP 	?C0023
; }
			; SOURCE LINE # 104
?C0028:
	RET  	
; END OF SendData

; 
; void SendResp()

	RSEG  ?PR?SendResp?E51PRO
SendResp:
			; SOURCE LINE # 106
; {
			; SOURCE LINE # 107
; 	
; 	TI=0;
			; SOURCE LINE # 109
	CLR  	TI
; 	SBUF=ComBuf[0];
			; SOURCE LINE # 110
	MOV  	SBUF,ComBuf
?C0029:
; 	while(!TI){}
			; SOURCE LINE # 111
	JNB  	TI,?C0029
?C0030:
; 	TI=0;
			; SOURCE LINE # 112
	CLR  	TI
; }
			; SOURCE LINE # 113
	RET  	
; END OF SendResp

; 
; void SetVpp5V()

	RSEG  ?PR?SetVpp5V?E51PRO
SetVpp5V:
			; SOURCE LINE # 115
; {
			; SOURCE LINE # 116
; 	P3_4=0;
			; SOURCE LINE # 117
	CLR  	P3_4
; 	P3_3=0;
			; SOURCE LINE # 118
	CLR  	P3_3
; }
			; SOURCE LINE # 119
	RET  	
; END OF SetVpp5V

; 
; void SetVpp0V()

	RSEG  ?PR?SetVpp0V?E51PRO
SetVpp0V:
			; SOURCE LINE # 121
; {
			; SOURCE LINE # 122
; 	P3_3=0;
			; SOURCE LINE # 123
	CLR  	P3_3
; 	P3_4=1;
			; SOURCE LINE # 124
	SETB 	P3_4
; }
			; SOURCE LINE # 125
	RET  	
; END OF SetVpp0V

; 
; void SetVpp12V()

	RSEG  ?PR?SetVpp12V?E51PRO
SetVpp12V:
			; SOURCE LINE # 127
; {
			; SOURCE LINE # 128
; 	P3_4=0;
			; SOURCE LINE # 129
	CLR  	P3_4
; 	P3_3=1;
			; SOURCE LINE # 130
	SETB 	P3_3
; }
			; SOURCE LINE # 131
	RET  	
; END OF SetVpp12V

; 
; 
; extern void Pro00();//FID=00--at89c51
; 
; void main()

	RSEG  ?PR?main?E51PRO
main:
	USING	0
			; SOURCE LINE # 136
; {
			; SOURCE LINE # 137
; 	SP=0x60;
			; SOURCE LINE # 138
	MOV  	SP,#060H
; 	SetVpp5V();
			; SOURCE LINE # 139
	LCALL	SetVpp5V
; 	SCON=0x00;
			; SOURCE LINE # 140
	CLR  	A
	MOV  	SCON,A
; 	TCON=0x00;
			; SOURCE LINE # 141
	MOV  	TCON,A
; 	PCON=0x80;
			; SOURCE LINE # 142
	MOV  	PCON,#080H
; 	IE=0x00;
			; SOURCE LINE # 143
	MOV  	IE,A
; 	//TMOD: GATE|C/!T|M1|M0|GATE|C/!T|M1|M0
; 	//        0    0   1  0   0    0   0  0
; 	TMOD=0x20;
			; SOURCE LINE # 146
	MOV  	TMOD,#020H
; 	TH1=0xff;
			; SOURCE LINE # 147
	MOV  	TH1,#0FFH
; 	TL1=0xff;
			; SOURCE LINE # 148
	MOV  	TL1,#0FFH
; 	//SCON: SM0|SM1|SM2|REN|TB8|RB8|TI|RI
;     //        1   1   0   1   0   0  0  0
; 	SCON=0xd0;
			; SOURCE LINE # 151
	MOV  	SCON,#0D0H
; 	TR1=1;
			; SOURCE LINE # 152
	SETB 	TR1
; 	Delay_ms(255);
			; SOURCE LINE # 153
	MOV  	R7,#0FFH
	LCALL	_Delay_ms
; 	ComBuf[0]=0;
			; SOURCE LINE # 154
	MOV  	ComBuf,A
; 	SendData();
			; SOURCE LINE # 155
	LCALL	SendData
?C0035:
; 	while(1)
			; SOURCE LINE # 156
; 	{
			; SOURCE LINE # 157
; 		if(!WaitComm())
			; SOURCE LINE # 158
	LCALL	WaitComm
	JC   	?C0037
; 		{
			; SOURCE LINE # 159
; 			Delay_ms(250);
			; SOURCE LINE # 160
	MOV  	R7,#0FAH
	LCALL	_Delay_ms
; 			Delay_ms(250);
			; SOURCE LINE # 161
	LCALL	_Delay_ms
; 			Delay_ms(250);
			; SOURCE LINE # 162
	LCALL	_Delay_ms
; 			Delay_ms(250);
			; SOURCE LINE # 163
	LCALL	_Delay_ms
; 			ComBuf[0]=0;
			; SOURCE LINE # 164
	CLR  	A
	MOV  	ComBuf,A
; 		}
			; SOURCE LINE # 165
?C0037:
; 		switch(ComBuf[1])//根据FID跳到不同的函数处理编程过程
			; SOURCE LINE # 166
	MOV  	A,ComBuf+01H
	DEC  	A
	JZ   	?C0035
	DEC  	A
	JZ   	?C0035
	ADD  	A,#02H
	JNZ  	?C0042
; 		{
			; SOURCE LINE # 167
; 			case 0:
			; SOURCE LINE # 168
?C0039:
; 				Pro00();
			; SOURCE LINE # 169
	LCALL	Pro00
; 				break;
			; SOURCE LINE # 170
	SJMP 	?C0035
; 			case 1:
			; SOURCE LINE # 171
; 				break;
			; SOURCE LINE # 172
; 			case 2:
			; SOURCE LINE # 173
; 				break;
			; SOURCE LINE # 174
; 			default:
			; SOURCE LINE # 175
?C0042:
; 				ComBuf[0]=0;
			; SOURCE LINE # 176
	CLR  	A
	MOV  	ComBuf,A
; 				SendData();
			; SOURCE LINE # 177
	LCALL	SendData
; 				break;
			; SOURCE LINE # 178
	SJMP 	?C0035
	RET  	
; END OF main

	END
