UM10147_2
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 02 — 28 April 2008
111 of 134
NXP Semiconductors
UM10147
P89LPC952/954 User manual
RET
;and return
BAD:
SETB
C
;set error flag
RET
;and return
A C-language routine to load the page register and perform an erase/program operation is
shown below.
#include <REG952.H>
unsigned char idata dbytes[64]; // data buffer
unsigned char Fm_stat; // status result
bit PGM_USER (unsigned char, unsigned char);
bit prog_fail;
void main ()
{
prog_fail=PGM_USER(0x1F,0xC0);
}
bit PGM_USER (unsigned char page_hi, unsigned char page_lo)
{
#define LOAD 0x00 // clear page register, enable loading
#define EP 0x68 // erase & program page
unsigned char i; // loop count
FMCON = LOAD; //load command, clears page reg
FMADRH = page_hi; //
FMADRL = page_lo; //write my page address to addr regs
for (i=0;i<64;i=i+1)
{
FMDATA = dbytes[i];
}
FMCON = EP; //erase & prog page command
Fm_stat = FMCON; //read the result status
if ((Fm_stat & 0x0F)!=0) prog_fail=1; else prog_fail=0;
return(prog_fail);
}
17.5 In-circuit programming (ICP)
In-Circuit Programming is a method intended to allow commercial programmers to
program and erase these devices without removing the microcontroller from the system.
The In-Circuit Programming facility consists of a series of internal hardware resources to
facilitate remote programming of the P89LPC952/954 through a two-wire serial interface.
NXP has made in-circuit programming in an embedded application possible with a
minimum of additional expense in components and circuit board area. The ICP function
uses five pins (V
DD
, V
SS
, P0.5, P0.4, and RST). Only a small connector needs to be
available to interface your application to an external programmer in order to use this
feature.