Page 319
TMP89FM42
RA003
Note 3: Before jumping from the flash memory to the RAM area, RAM must be allocated to the code area by
making the appropriate SYSCR3<RAREA> setting (setting made in step 4 in the procedure described
on the previous page).
Example: Case in which a program is transferred to RAM, a sector erase is performed on 0xE000 through 0xEFFF in
the code area, and then 0x3F data is written to 0xE500.
cRAMStartAdd equ 0x0200
; RAM start address
main section code abs = 0x1000
DI
; Disable interrupts (step 1)
; #### Transfer the program to RAM #### (step 2)
LD
HL,cRAMStartAdd
LD
IX,sRAMprogStart
sRAMLOOP:
LD
A,(IX)
; Transfer the program from sRAMprogStart to
LD
(HL),A
; sRAMprogEnd to cRAMStartAdd.
INC
HL
INC
IX
CMP
IX,sRAMprogEnd
J
NZ,sRAMLOOP
; #### Set a nonmaskable interrupt vector inside the RAM area #### (step 3)
LD
HL,0x01FC
; Set INTUNDEF and INTSWI interrupt vectors
LDW
(HL),sINTSWI - sRAMpro cRAMStartAdd
LD
HL,0x01F8
; Set INTWDT interrupt vector
LDW
(HL),sINTWDT - sRAMpro cRAMStartAdd
; #### Allocate RAM to the code area. Switch the vector area to RAM #### (step 4)
LD
(SYSCR3),0x06
; Set RAREA and RVCTR to "1"
LD
(SYSCR4),0xD4
; Enable Code
; #### Sector erase and write process ####
LD
HL,0xF555
; Variable for command sequence
LD
DE,0xFAAA
; Variable for command sequence
; Sector erase process (step 5)
LD
C,0x00
; Set upper addresses
LD
IX,0xE000
; Set middle and lower addresses
CALL
sRAMStartAdd
; Perform a sector erase (0xE000)
; Write process (step 11)
LD
C,0x00
; Set upper addresses
LD
IX,0xE500
; Set middle and lower addresses
LD
B,0x3F
; Data to be written
CALL
sByteProgram - sRAMpro cRAMStartAdd
; Write process (0xE500)
; #### Execute the next main program ####
:
:
; Execute the main program
J
XXXXX
; #### Program to be executed in RAM ####
sRAMprogStart:
sSectorErase:
CALL
sAddConv - sRAMpro cRAMStartAdd
; Address conversion process
; Sector erase process (step 7)
LD
(HL),E
; 1st Bus Write Cycle (note 1)
LD
(DE),L
; 2nd Bus Write Cycle (note 1)
LD
(HL),0x80
; 3rd Bus Write Cycle (note 1)
LD
(HL),E
; 4th Bus Write Cycle (note 1)
LD
(DE),L
; 5th Bus Write Cycle (note 1)
LD
(IX),0x30
; 6th Bus Write Cycle (note 1)
J
sRAMopEnd
; Write process (step 13)
sByteProgram
CALL
sAddConv - sRAMpro cRAMStartAdd
; Address conversion process
LD
(HL),E
; 1st Bus Write Cycle (note 1)
LD
(DE),L
; 2nd Bus Write Cycle (note 1)
LD
(HL),0xA0
; 3rd Bus Write Cycle (Note 1)
LD
(IX),B
; 4th Bus Write Cycle (note 1)
; End process
sRAMopEnd:
NOP
; (note 2)
NOP
; (note 2)
NOP
; (note 2)
Summary of Contents for TLCS-870/C1 Series
Page 1: ...8 Bit Microcontroller TLCS 870 C1 Series TMP89FM42 查询TMP89FM42供应商 捷多邦 专业PCB打样工厂 24小时加急出货 ...
Page 3: ...Revision History Date Revision 2007 10 25 1 First Release 2007 11 3 2 Contents Revised ...
Page 4: ......
Page 14: ......
Page 18: ...1 3 Block Diagram TMP89FM42 1 3 Block Diagram Figure 1 2 Block Diagram ...
Page 22: ...1 4 Pin Names and Functions TMP89FM42 ...
Page 60: ...2 CPU Core 2 5 Revision History TMP89FM42 ...
Page 76: ...3 Interrupt Control Circuit 3 8 Revision History TMP89FM42 ...
Page 86: ...4 External Interrupt control circuit 4 3 Function TMP89FM42 ...
Page 102: ...7 Voltage Detection Circuit 7 5 Revision History TMP89FM42 ...
Page 126: ...8 I O Ports 8 3 I O Port Registers TMP89FM42 Note 2 i 0 to 1 ...
Page 136: ...8 I O Ports 8 5 Revision History TMP89FM42 ...
Page 142: ...9 Special Function Registers 9 3 SFR3 0x0E40 to 0x0EFF TMP89FM42 ...
Page 146: ...10 Low Power Consumption Function for Peripherals TMP89FM42 ...
Page 149: ...TMP89FM42 11 3 Revision History Rev Description RA001 Deleted SLEEP2 description ...
Page 150: ...11 Divider Output DVO 11 3 Revision History TMP89FM42 ...
Page 220: ...15 Real Time Clock RTC 15 4 Real Time Clock Operation TMP89FM42 ...
Page 250: ...16 Asynchronous Serial Interface UART 16 15 Revision History TMP89FM42 ...
Page 302: ...18 Serial Bus Interface SBI 18 7 Revision History TMP89FM42 ...
Page 338: ...21 Flash Memory 21 4 Toggle Bit D6 TMP89FM42 ...
Page 384: ...22 Serial PROM Mode 22 15 Revision History TMP89FM42 ...
Page 388: ...24 Input Output Circuit 24 1 Control Pins TMP89FM42 ...
Page 404: ...25 Electrical Characteristics 25 11 Revision History TMP89FM42 ...
Page 406: ...26 Package Dimensions TMP89FM42 ...
Page 408: ......