
En_pg_Mode:

	clr	ErrFlag	;

	mov	count,#030h	;



	setb RST 		; force target into reset 		

	lcall delay10mS 	; wait 1 ms (arbitrary)

En_pg:

	mov a, #0ACh	; send first byte of enable code

	lcall SPI 		;



	mov a, #053h	; send second byte

	lcall SPI 		;



	mov a, #0FFh	; send third byte as dummy

	lcall SPI 		;



	mov a, #0FFh	; send fourth byte dummy for receiving 69h

	lcall SPI 		;



<u><b><i>;	cjne A,#069h,enable_error ; received byte is not valid confirm one</b></i></u>



	sjmp	Ena_End	;success entering program mode



enable_error:

	djnz	count,En_pg		;try this 30 times



	mov	dptr,#Failed_str	;

	lcall	OutStr		;

	setb	ErrFlag		;



Ena_End:

	ret				;

