English
Language : 

W78E516DDG Datasheet, PDF (84/90 Pages) Nuvotem Talema – 8-BIT MICROCONTROLLER
W78E516D/W78E058D Data Sheet
Application Note: In-system Programming Software Examples
This application note illustrates the in-system programmability of the microcontroller. In this example,
microcontroller will boot from APROM bank and waiting for a key to enter in-system programming
mode for re-programming the contents of APROM. While entering in-system programming mode, mi-
crocontroller executes the loader program in 4KB LDROM bank. The loader program erases the
APROM then reads the new code data from external SRAM buffer (or through other interfaces) to up-
date the APROM.
EXAMPLE 1:
;*******************************************************************************************************************
;* Example of APROM program: Program will scan the P1.0. if P1.0 = 0, enters in-system
;* programming mode for updating the contents of APROM code else executes the current ROM code.
;* XTAL = 40 MHz
;*******************************************************************************************************************
.chip 8052
.RAMCHK OFF
.symbols
CHPCON
CHPENR
SFRAL
SFRAH
SFRFD
SFRCN
EQU
EQU
EQU
EQU
EQU
EQU
BFH
F6H
C4H
C5H
C6H
C7H
ORG
0H
LJMP
100H
;JUMP TO MAIN PROGRAM
;************************************************************************
;* TIMER0 SERVICE VECTOR ORG=000BH
;************************************************************************
ORG
00BH
CLR
TR0
;TR0=0,STOP TIMER0
MOV
TL0,R6
MOV
TH0,R7
RETI
;************************************************************************
;* APROM MAIN PROGRAM
;************************************************************************
ORG
100H
MAIN_:
MOV
ANL
CJNE
JMP
A,P1
A,#01H
A,#01H,PROGRAM_
NORMAL_MODE
;SCAN P1.0
;IF P1.0=0, ENTER IN-SYSTEM
;PROGRAMMING MODE
PROGRAM_:
MOV
MOV
MOV
CHPENR,#87H
CHPENR,#59H
CHPCON,#03H
; CHPENR=87H, CHPCON
; REGISTER WRTE ENABLE
; CHPENR=59H, CHPCON
; REGISTER WRITE ENABLE
;CHPCON=03H, ENTER IN-SYSTEM
; PROGRAMMING MODE
- 84 -