EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 850

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 834 -
LCALL ISP_RECVACK ;Receive response data
LJMP ISP_DOWNLOAD ;Jump to download interface
GOTOAP:
CLR A ; Reset SFR to reset value
MOV TCON,A
MOV TMOD,A
MOV TL0,A
MOV TH0,A
MOV TL1,A
MOV TH1,A
MOV SCON,A
MOV AUXR,A
LJMP APENTRY ; Run the user program normally
ISP_RECVACK:
LCALL ISP_RECVUART
JC GOTOAP
XRL A,#7FH
JZ ISP_RECVACK ; skip sync data
CJNE A,#25H,GOTOAP ; Response data 1 detection
LCALL ISP_RECVUART
JC GOTOAP
CJNE A,#69H,GOTOAP ; Response data 2 detection
RET
ISP_RECVUART:
CLR A
MOV TL0,A ; Initialize timeout timer
MOV TH0,A
CLR TF0
MOV WDT_CONTR,#17H ;clear watchdog
ISP_RECVWAIT:
JBC TF0,ISP_RECVTIMEOUT ; Timeout detection
JNB RI,ISP_RECVWAIT ; wait for receive to complete
MOV A,SBUF ; Read serial data
CLR RI ;Clear flag
CLR C ; Receive serial data correctly
RET
ISP_RECVTIMEOUT:
SETB C ; timeout
RET
ISP_SENDUART:
MOV WDT_CONTR,#17H ;clear watchdog
JNB TI,ISP_SENDUART ; Wait for the previous data transmission to complete
CLR TI ; Clear flag
MOV SBUF,A ; send current data
RET
ISP_ERASEIAP:
MOV WDT_CONTR,#17H ;clear watchdog
MOV IAP_CMD,#3 ; Erase command
MOV IAP_TRIG,#5AH ; Trigger ISP command
MOV IAP_TRIG,#0A5H
NOP
NOP
NOP
NOP

Table of Contents

Related product manuals