Calling Device Internal Processing - NEC V850E/IA1 mPD703116 User Manual

32-bit single-chip microcontrollers
Hide thumbs Also See for V850E/IA1 mPD703116:
Table of Contents

Advertisement

16.7.13 Calling device internal processing

This section explains the procedure to call the device internal processing from the entry program.
Before calling the device internal processing, make sure that all the conditions of the hardware and software
environments are satisfied and that the necessary arguments and RAM parameters have been set. Call the device
internal processing by setting the FLSPM bit of the flash programming mode control register (FLPMC) to 1 and then
executing the trap 0x1f instruction. The processing is always called using the same procedure. It is assumed that the
program of this interface is described in an assembly language.
<1> Set the FLPMC register as follows:
• VPPDIS bit = 0 (to enable writing/erasing flash memory)
• FLSPM bit = 1 (to select self-programming mode)
<2> Clear the NP bit of the PSW to 0 (to enable NMIs (only when NMIs are used on the application)).
<3> Execute trap 0x1f to transfer the control to the device's internal processing.
<4> Set the NP bit and ID bit of the PSW to 1 (to disable all interrupts).
<5> Set the value to the peripheral command register (PHCMD) that is to be set to the FLPMC register.
<6> Set the FLPMC register as follows:
• VPPDIS bit = 1 (to disable writing/erasing flash memory)
• FLSPM bit = 0 (to select normal operation mode)
<7> Wait for the internal manipulation setup time (see 16.7.13 (5) Internal manipulation setup parameter).
(1) Parameter
r6: First argument (sets a self-programming function number)
r7: Second argument
r8: Third argument
r9: Fourth argument
ep: First address of RAM parameter
(2) Return value
r10:
Return value (return value from device internal processing of 4 bytes)
ep+4:Bit 7: NMI flag (flag indicating whether an NMI occurred while the device internal processing was being
executed)
0: NMI did not occur while device internal processing was being executed.
1: NMI occurred while device internal processing was being executed.
If an NMI occurs while control is being transferred to the device internal processing, the NMI
request may never be reflected. Because the NMI flag is not internally reset, this bit must be
cleared before calling the device internal processing. After the control returns from the device
internal processing, NMI dummy processing can be executed by checking the status of this flag
using software.
(3) Description
Transfer control to the device internal processing specified by a function number using the trap instruction.
To do this, the hardware and software environmental conditions must be satisfied. Even if trap 0x1f is used in
the user application program, trap 0x1f is treated as another operation after the FLPMC register has been set.
Therefore, use of the trap instruction is not restricted on the application.
CHAPTER 16 FLASH MEMORY ( µ µ µ µ PD70F3116)
User's Manual U14492EJ3V0UD
751

Advertisement

Table of Contents
loading

Table of Contents