Summary of Contents for NXP Semiconductors P89LPC952
Page 1
UM10147 P89LPC952/954 User manual Rev. 02 — 28 April 2008 User manual Document information Info Content Keywords P89LPC952, P89LPC954 Abstract Technical information for the P89LPC952/954 devices.
Page 6
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 1. Pin description …continued Symbol Type Description LQFP48 PLCC44 LQFP44 P0.1/CIN2B/ P0.1 — Port 0 bit 1. KBI1/AD00 CIN2B — Comparator 2 positive input B. KBI1 — Keyboard input 1. AD00 — ADC0 channel 0 analog input.
Page 7
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 1. Pin description …continued Symbol Type Description LQFP48 PLCC44 LQFP44 P1.2/T0/SCL P1.2 — Port 1 bit 2 (open-drain when used as output). T0 — Timer/counter 0 external count input or overflow output (open-drain when used as output).
Page 8
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 1. Pin description …continued Symbol Type Description LQFP48 PLCC44 LQFP44 P2.2/MOSI P2.2 — Port 2 bit 2. MOSI — SPI master out slave in. When configured as master, this pin is output; when configured as slave, this pin is input.
Page 9
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 1. Pin description …continued Symbol Type Description LQFP48 PLCC44 LQFP44 P4.0 P4.0 — Port 4 bit 0. P4.1/TRIG P4.1 — Port 4 bit 1. TRIG — Debugger trigger output. P4.2/TXD1 P4.2 — Port 4 bit 2.
UM10147 NXP Semiconductors P89LPC952/954 User manual 1.3 Special function registers Remark: SFR accesses are restricted in the following ways: • User must not attempt to access any SFR locations not defined. • Accesses to any defined SFR locations must be strictly for the functions for the SFRs.
Page 12
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxx Table 2. Special function registers * indicates SFRs that are bit addressable. Name Description Bit functions and addresses Reset value addr.
Page 13
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxx Table 2. Special function registers …continued * indicates SFRs that are bit addressable. Name Description Bit functions and addresses Reset value...
Page 14
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxx Table 2. Special function registers …continued * indicates SFRs that are bit addressable. Name Description Bit functions and addresses Reset value...
Page 15
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxx Table 2. Special function registers …continued * indicates SFRs that are bit addressable. Name Description Bit functions and addresses Reset value...
Page 16
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxx Table 2. Special function registers …continued * indicates SFRs that are bit addressable. Name Description Bit functions and addresses Reset value...
Page 17
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxx Table 2. Special function registers …continued * indicates SFRs that are bit addressable. Name Description Bit functions and addresses Reset value...
Page 18
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxx Table 3. Extended special function registers Name Description Bit functions and addresses Reset value addr.
Page 19
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxx Table 3. Extended special function registers …continued Name Description Bit functions and addresses Reset value addr.
The P89LPC952/954 has 256 bytes of on-chip XDATA memory. CODE — 64 kB of Code memory space, accessed as part of program execution and via the MOVC instruction. The P89LPC952/954 has 8 kB/ 16 kB of on-chip Code memory. Table 4. Data RAM arrangement...
Page 21
The P89LPC952/954 is a single-chip microcontroller designed for applications demanding high-integration, low cost solutions over a wide range of performance requirements. The P89LPC952/954 is based on a high performance processor architecture that executes instructions in two to four clocks, six times the rate of standard 80C51 devices. Many...
2. Clocks 2.1 Enhanced CPU The P89LPC952/954 uses an enhanced 80C51 CPU which runs at six times the speed of standard 80C51 devices. A machine cycle consists of two CPU clock cycles, and most instructions execute in one or two machine cycles.
TRIM register. 2.4 On-chip RC oscillator option The P89LPC952 has a 6-bit TRIM register that can be used to tune the frequency of the RC oscillator. During reset, the TRIM value is initialized to a factory pre-programmed value to adjust the oscillator frequency to 7.373 MHz ± 1 % at room temperature. (Note: the initial value is better than 1 %;...
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 6. On-chip RC oscillator trim register (TRIM - address 96h) bit description Symbol Description TRIM.0 Trim value. Determines the frequency of the internal RC oscillator. During reset, these bits are loaded with a stored factory calibration value. When writing to either TRIM.1...
Block diagram of oscillator control. 2.7 Oscillator Clock (OSCCLK) wake-up delay The P89LPC952/954 has an internal wake-up timer that delays the clock until it stabilizes depending to the clock source used. If the clock source is any of the three crystal selections, the delay is 992 OSCCLK cycles plus 60 μs to 100 μs.
2.9 Low power select The P89LPC952/954 is designed to run at 18 MHz (CCLK) maximum. However, if CCLK is 8 MHz or slower, the CLKLP SFR bit (AUXR1.7) can be set to a logic 1 to lower the power consumption further.
UM10147 NXP Semiconductors P89LPC952/954 User manual conversions. Additional conversion results will again cycle through the result register pairs, overwriting the previous results. Continuous conversions continue until terminated by the user. This mode is selected by setting the SCC0 bit in the ADMODA register.
UM10147 NXP Semiconductors P89LPC952/954 User manual second channel is placed in result register pair, AD0DAT1R and AD0DAT1L. The first channel is again converted and its result stored in AD0DAT2R and AD0DAT2L. The second channel is again converted and its result placed in AD0DAT3R and AD0DAT3L, etc.
UM10147 NXP Semiconductors P89LPC952/954 User manual 3.2.3 Conversion start modes 3.2.3.1 Timer triggered start An A/D conversion is started by the overflow of Timer 0. Once a conversion has started, additional Timer 0 triggers are ignored until the conversion has completed. The Timer triggered start mode is available in all A/D operating modes.This mode is selected by the...
3V tolerant if the corresponding A/D is enabled and the device is not in power down. Otherwise the pin will remain 5V tolerant. Please refer to the P89LPC952/954 data sheet for specifications. 3.2.8 Power-down and Idle mode In Idle mode the A/D converter, if enabled, will continue to function and can cause the device to exit Idle mode when the conversion is completed if the A/D interrupt is enabled.
Page 32
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 13. A/D Mode register A (ADMODA - address 0C0h) bit allocation Symbol BNDI0 BURST0 SCC0 SCAN0 Reset Table 14. A/D Mode register A (ADMODA - address 0C0h) bit description Symbol Description Reserved. SCAN0 When = 1, selects single conversion mode (auto scan or fixed channel).
This bit is cleared in software by writing a 1 to this bit. 4. Interrupts The P89LPC952/954 uses a four priority level interrupt structure. This allows great flexibility in controlling the handling of the P89LPC952/954’s 15 interrupt sources.
IPx and IPxH (x = 0, 1) and can therefore be assigned to one of four levels, as shown in Table The P89LPC952/954 has two external interrupt inputs in addition to the Keypad Interrupt function. The two interrupt inputs are identical to those present on the standard 80C51 microcontrollers.
If an external interrupt has been programmed as level-triggered and is enabled when the P89LPC952/954 is put into Power-down mode or Idle mode, the interrupt occurrence will cause the processor to wake-up and resume operation. Refer to Section 6.3 “Power...
5. I/O ports The P89LPC952/954 has four I/O ports: Port 0, Port 1, Port 2, Port 3, Port 4, and Port 5. Ports 0, 1, 4 and 5 are 8-bit ports, Port 2 is a 6-bit port, and Port 3 is a 2-bit port. The exact...
External RST pin supported Required for a clock frequency above 12 MHz. 5.1 Port configurations All but three I/O port pins on the P89LPC952/954 may be configured by software to one of four types on a pin-by-pin basis, as shown in Table 24.
The quasi-bidirectional port configuration is shown in Figure Although the P89LPC952/954 is a 3 V device most of the pins are 5 V-tolerant. If 5 V is applied to a pin configured in quasi-bidirectional mode, there will be a current flowing from the pin to V causing extra power consumption.
5.4 Input-only configuration The input port configuration is shown in Figure 12. It is a Schmitt-triggered input that also has a glitch suppression circuit. (Please refer to the P89LPC952/954 data sheet, Dynamic characteristics for glitch filter specifications). input port data...
Pin P1.5 is input only. Pins P1.2 and P1.3 are configurable for either input-only or open drain. Every output on the P89LPC952/954 has been designed to sink typical LED drive current. However, there is a maximum total output current for all ports which must not be exceeded.
Page 41
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 25. Port output configuration Port pin Configuration SFR bits PxM1.y PxM2.y Alternate usage Notes P0.0 P0M1.0 P0M2.0 KBIO, CMP2, AD05 P0.1 P0M1.1 P0M2.1 KBI1, CIN2B, AD00 Refer to Section 5.6 “Port 0 and Analog Comparator functions”...
Brownout trip voltage, VBO (see P89LPC952/954 data sheet, Static characteristics), and is negated when V rises above VBO. If the P89LPC952/954 device is to operate with a power supply that can be below 2.7 V, BOE should be left in the unprogrammed state so that the device can operate at 2.4 V, otherwise continuous brownout reset may prevent...
0 to the bit. Note that if BOE (UCFG1.5) is programmed, BOF (RSTSRC.5) will be set when POF is set. If BOE is unprogrammed, BOF is meaningless. 6.3 Power reduction modes The P89LPC952/954 supports three different power reduction modes as determined by SFR bits PCON[1:0] (see Table 27).
Page 44
Power-down mode: The Power-down mode stops the oscillator in order to minimize power consumption. The P89LPC952/954 exits Power-down mode via any reset, or certain interrupts - external pins INT0/INT1, brownout Interrupt, keyboard, Real-time Clock/System Timer), watchdog, and comparator trips. Waking up by reset is only enabled if the corresponding reset is enabled, and waking up by interrupt is only enabled if the corresponding interrupt is enabled and the EA SFR bit (IEN0.7) is set.
Page 45
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 28. Power Control register (PCON - address 87h) bit allocation Symbol SMOD1 SMOD0 BOPD PMOD1 PMOD0 Reset Table 29. Power Control register (PCON - address 87h) bit description Symbol Description PMOD0 Power Reduction Mode (see Section 6.3)
Note: During a power cycle, V must fall below V (see P89LPC952/954 data sheet, Static characteristics) before power is reapplied, in order to ensure a power-on reset. Note: When using an oscillator frequency above 12 MHz, the reset input function of P1.5 must be enabled.
Page 47
UM10147 NXP Semiconductors P89LPC952/954 User manual For every reset source, there is a flag in the Reset Register, RSTSRC. The user can read this register to determine the most recent reset source. These flag bits can be cleared in software by writing a ‘0’ to the corresponding bit. More than one flag bit may be set: •...
P89LPC952/954 User manual 7.1 Reset vector Following reset, the P89LPC952/954 will fetch instructions from either address 0000h or the Boot address. The Boot address is formed by using the Boot Vector as the high byte of the address and the low byte of the address = 00h. The Boot address will be used if a UART break reset occurs or the non-volatile Boot Status bit (BOOTSTAT.0) = 1, or the...
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 36. Timer/Counter Mode register (TMOD - address 89h) bit description …continued Bit Symbol Description T1M0 Mode Select for Timer 1. These bits are used with the T1M2 bit in the TAMOD register to determine the...
Mode 3 is provided for applications that require an extra 8-bit timer. With Timer 0 in Mode 3, an P89LPC952/954 device can look like it has three Timer/Counters. Note: When Timer 0 is in Mode 3, Timer 1 can be turned on and off by switching it into and out of its own Mode 3.
Page 51
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 39. Timer/Counter Control register (TCON) - address 88h) bit allocation Symbol Reset Table 40. Timer/Counter Control register (TCON - address 88h) bit description Bit Symbol Description Interrupt 0 Type control bit. Set/cleared by software to specify falling edge/low level triggered external interrupts.
PCLK as the clock source for the timer. 9. Real-time clock system timer The P89LPC952/954 has a simple Real-time Clock/System Timer that allows a user to continue running an accurate timer while the rest of the device is powered down. The...
UM10147 NXP Semiconductors P89LPC952/954 User manual 9.1 Real-time clock source RTCS1/RTCS0 (RTCCON[6:5]) are used to select the clock source for the RTC if either the Internal RC oscillator or the internal WD oscillator is used as the CPU clock. If the internal crystal oscillator or the external clock input on XTAL1 is used as the CPU clock, then the RTC will use CCLK as its clock source.
Page 55
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 41. Real-time Clock/System Timer clock sources …continued FOSC2:0 RCCLK RTCS1:0 RTC clock source CPU clock source Low frequency crystal Low frequency crystal /DIVM Low frequency crystal /DIV Low frequency crystal Internal RC oscillator...
0. It can be cleared in software. 10. UARTs The P89LPC952/954 has two enhanced UARTs that are compatible with the conventional 80C51 UART except that Timer 2 overflow cannot be used as a baud rate source. The P89LPC952/954 does include an independent Baud Rate Generator for each UART.
FFB3H 10.6 Baud Rate generator and selection The P89LPC952/954 enhanced UART has an independent Baud Rate Generator. The baud rate is determined by a value programmed into the BRGR1_n and BRGR0_n SFRs. Each UART can use either Timer 1 or the baud rate generator output as determined by...
UM10147 NXP Semiconductors P89LPC952/954 User manual 10.7 Updating the BRGR1 and BRGR0 SFRs The baud rate SFRs, BRGR1_n and BRGR0_n must only be loaded when the Baud Rate Generator is disabled (the BRGEN_0 bit in the BRGCON_n register is logic 0). This avoids the loading of an interim value to the baud rate generator.
Page 60
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 51. Serial Port 0 Control register (S0CON - address 98h) bit description …continued Bit Symbol Description SM2_0 Enables the multiprocessor communication feature in Modes 2 and 3. In Mode 2 or 3, if SM2 is set to 1, then Rl will not be activated if the received 9th data bit (RB8) is 0.
Page 61
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 54. Serial Port modes SM0_n, SM1_n UART mode UART baud rate ⁄ CCLK Mode 0: shift register (default mode on any reset) Mode 1: 8-bit UART Variable (see Table ⁄ ⁄ CCLK CCLK...
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 57. Serial Port 1 Status register (S1STAT - address D4h) bit allocation Symbol DBMOD INTLO_1 CIDIS_1 DBISEL_ FE_1 BR_1 OE_1 STINT_1 Reset Table 58. Serial Port 1 Status register (S1STAT - address D4h) bit description...
UM10147 NXP Semiconductors P89LPC952/954 User manual Reception is initiated by clearing RI_n (SnCON.0). Synchronous serial transfer occurs and RI_n will be set again at the end of the transfer. When RI_n is cleared, the reception of the next character will begin. Refer to Figure 22 S1 ...
UM10147 NXP Semiconductors P89LPC952/954 User manual TX clock write to SBUF transmit shift start stop bit INTLO = 0 INTLO = 1 clock start ÷16 reset stop bit receive shift 002aaa926 Fig 23. Serial Port Mode 1 (only single transmit buffering case is shown).
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 59. FE_n and RI_n when SM2_n = 1 in Modes 2 and 3 Mode PCON.6 RB8_n RI_n FE_n (SMOD0) No RI_n when RB8_n = 0 Occurs during STOP Similar to Figure 24, with SMOD0 = 0, R_n Occurs during STOP...
UM10147 NXP Semiconductors P89LPC952/954 User manual – If DBISEL_n is logic 1 and INTLO_n is logic 0, a Tx interrupt will occur at the beginning of the STOP bit of the data currently in the shifter (which is also the last data).
UM10147 NXP Semiconductors P89LPC952/954 User manual If double buffering is enabled, TB8_n MUST be updated before SnBUF is written, as TB8_n will be double-buffered together with SnBUF data. The operation described in the Section 10.17 “Transmit interrupts with double buffering enabled (Modes 1, 2, and 3)” on...
UM10147 NXP Semiconductors P89LPC952/954 User manual Note that SM2_n has no effect in Mode 0, and must be logic 0 in Mode 1. 10.20 Automatic address recognition Automatic address recognition is a feature which allows the UART to recognize certain addresses in the serial bit stream by using hardware to make the comparisons.
I C-bus will not be released. The P89LPC952/954 device provides a byte-oriented I C interface. It has four operation modes: Master Transmitter Mode, Master Receiver Mode, Slave Transmitter Mode and...
C MCU INTERFACE INTERFACE 002aac130 Fig 26. I C-bus configuration. The P89LPC952/954 CPU interfaces with the I C-bus through six Special Function Registers (SFRs): I2CON (I C Control Register), I2DAT (I C Data Register), I2STAT (I Status Register), I2ADR (I C Slave Address Register), I2SCLH (SCL Duty Cycle Register High Byte), and I2SCLL (SCL Duty Cycle Register Low Byte).
UM10147 NXP Semiconductors P89LPC952/954 User manual 11.3 I C control register The CPU can read and write this register. There are two bits are affected by hardware: the SI bit and the STO bit. The SI bit is set by hardware and the STO bit is cleared by hardware.
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 66. C Control register (I2CON - address D8h) bit description …continued Bit Symbol Description C Interrupt Flag. This bit is set when one of the 25 possible I C states is entered. When EA bit and EI2C (IEN1.0) bit are both set, an interrupt is requested when SI is set.
UM10147 NXP Semiconductors P89LPC952/954 User manual The values for I2SCLL and I2SCLH do not have to be the same; the user can give different duty cycles for SCL by setting these two registers. However, the value of the register must ensure that the data rate is in the I C data rate range of 0 to 400 kHz.
UM10147 NXP Semiconductors P89LPC952/954 User manual The first byte transmitted contains the slave address of the receiving device (7 bits) and the data direction bit. In this case, the data direction bit (R/W) will be logic 0 indicating a write. Data is transmitted 8 bits at a time. After each byte is transmitted, an acknowledge bit is received.
UM10147 NXP Semiconductors P89LPC952/954 User manual slave address DATA DATA data transferred logic 0 = write (n Bytes + acknowledge) logic 1 = read A = acknowledge (SDA LOW) A = not acknowledge (SDA HIGH) from master to slave S = START condition...
UM10147 NXP Semiconductors P89LPC952/954 User manual slave address DATA DATA P/RS logic 0 = write data transferred logic 1 = read (n Bytes + acknowledge) A = acknowledge (SDA LOW) A = not acknowledge (SDA HIGH) from master to slave...
Page 77
UM10147 NXP Semiconductors P89LPC952/954 User manual I2ADR ADDRESS REGISTER P1.3 COMPARATOR INPUT FILTER P1.3/SDA SHIFT REGISTER OUTPUT STAGE I2DAT BIT COUNTER / ARBITRATION CCLK INPUT TIMING AND SYNC LOGIC FILTER CONTROL P1.2/SCL LOGIC SERIAL CLOCK OUTPUT interrupt GENERATOR STAGE timer 1 overflow P1.2...
Page 78
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 72. Master Transmitter mode Status code Status of the I Application software response Next action taken by I (I2STAT) hardware hardware to/from I2DAT to I2CON A START Load SLA+W SLA+W will be transmitted;...
Page 79
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 72. Master Transmitter mode …continued Status code Status of the I Application software response Next action taken by I (I2STAT) hardware hardware to/from I2DAT to I2CON Data byte in Load data byte or 0 Data byte will be transmitted;...
Page 80
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 73. Master Receiver mode …continued Status code Status of the I Application software response Next action taken by I C hardware (I2STAT) hardware to/from I2DAT to I2CON STA STO SI Data byte has Read data byte Data byte will be received;...
Page 81
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 74. Slave Receiver mode …continued Status code Status of the I Application software response Next action taken by I (I2STAT) hardware hardware to/from I2DAT to I2CON STO SI Previously Read data byte or 0...
Page 82
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 74. Slave Receiver mode …continued Status code Status of the I Application software response Next action taken by I (I2STAT) hardware hardware to/from I2DAT to I2CON STO SI A STOP condition No I2DAT action...
12. Serial Peripheral Interface (SPI) The P89LPC952/954 provides another high-speed serial communication interface, the SPI interface. SPI is a full-duplex, high-speed, synchronous communication bus with two operation modes: Master mode and Slave mode. Up to 3 Mbit/s can be supported in either Master or Slave mode.
Page 84
UM10147 NXP Semiconductors P89LPC952/954 User manual MISO P2.3 CPU clock 8-BIT SHIFT REGISTER MOSI P2.2 READ DATA BUFFER DIVIDER CONTROL BY 4, 16, 64, 128 LOGIC SPICLK P2.5 clock SPI clock (master) SELECT CLOCK LOGIC P2.4 MSTR SPEN SPI CONTROL...
Page 85
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 77. SPI Control register (SPCTL - address E2h) bit description Bit Symbol Description SPR0 SPI Clock Rate Select SPR1, SPR0: SPR1 ⁄ CCLK 00 — ⁄ CCLK 01 — ⁄ CCLK 10 —...
Page 86
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 80. SPI Data register (SPDAT - address E3h) bit allocation Symbol Reset master slave MISO MISO 8-BIT SHIFT 8-BIT SHIFT MOSI MOSI REGISTER REGISTER SPICLK SPICLK SPI CLOCK PORT GENERATOR 002aaa901 Fig 34. SPI single master single slave configuration.
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 81. SPI master and slave selection …continued SPEN SSIG SS Pin MSTR Master MISO MOSI SPICLK Remarks or Slave Mode Master input Hi-Z Hi-Z MOSI and SPICLK are at high-impedance to avoid bus contention when the MAster is idle.
UM10147 NXP Semiconductors P89LPC952/954 User manual slave and start sending data to it. To avoid bus contention, the SPI becomes a slave. As a result of the SPI becoming a slave, the MOSI and SPICLK pins are forced to be an input and MISO becomes an output.
Page 90
UM10147 NXP Semiconductors P89LPC952/954 User manual Clock cycle SPICLK (CPOL = 0) SPICLK (CPOL = 1) DORD = 0 MOSI (input) DORD = 1 DORD = 0 MISO (output) DORD = 1 SS (if SSIG bit = 0) 002aaa934 (1) Not defined Fig 37.
Page 91
UM10147 NXP Semiconductors P89LPC952/954 User manual Clock cycle SPICLK (CPOL = 0) SPICLK (CPOL = 1) DORD = 0 MOSI (input) DORD = 1 DORD = 0 MISO (output) DORD = 1 SS (if SSIG bit = 0) 002aaa935 (1) Not defined Fig 38.
Page 92
UM10147 NXP Semiconductors P89LPC952/954 User manual Clock cycle SPICLK (CPOL = 0) SPICLK (CPOL = 1) DORD = 0 MOSI (input) DORD = 1 DORD = 0 MISO (output) DORD = 1 SS (if SSIG bit = 0) 002aaa936 (1) Not defined Fig 39.
77). 13. Analog comparators Two analog comparators are provided on the P89LPC952/954. Input and output options allow use of the comparators in a number of different configurations. Comparator operation is such that the output is a logic 1 (which may be read in a register and/or routed to a pin) when the positive input (one of two selectable pins) is greater than the negative input (selectable from a pin or an internal reference voltage).
Page 94
UM10147 NXP Semiconductors P89LPC952/954 User manual When each comparator is first enabled, the comparator output and interrupt flag are not guaranteed to be stable for 10 microseconds. The corresponding comparator interrupt should not be enabled during that time, and the comparator interrupt flag must be cleared before the interrupt is enabled in order to prevent an immediate interrupt service.
P89LPC952/954 User manual 13.2 Internal reference voltage An internal reference voltage, Vref, may supply a default reference when a single comparator input pin is used. Please refer to the P89LPC952/954 data sheet for specifications 13.3 Comparator input pins Comparator input and reference pins maybe be used as either digital I/O or as inputs to the comparator.
UM10147 NXP Semiconductors P89LPC952/954 User manual 14. Keypad interrupt (KBI) The Keypad Interrupt function is intended primarily to allow a single interrupt to be generated when Port 0 is equal to or not equal to a certain pattern. This function can be used for bus address recognition or keypad recognition.
UM10147 NXP Semiconductors P89LPC952/954 User manual Figure 45 shows the watchdog timer in watchdog mode. It consists of a programmable 13-bit prescaler, and an 8-bit down counter. The down counter is clocked (decremented) by a tap taken from the prescaler. The clock source for the prescaler is either PCLK or the watchdog oscillator selected by the WDCLK bit in the WDCON register.
Page 100
SETB EA ;enable interrupt This sequence assumes that the P89LPC952/954 interrupt system is enabled and there is a possibility of an interrupt request occurring during the feed sequence. If an interrupt was allowed to be serviced and the service routine contained any SFR writes, it would trigger a watchdog reset.
Page 101
UM10147 NXP Semiconductors P89LPC952/954 User manual The maximum number of tclks is: ) 255 tclks 1048577 Table 93 shows sample P89LPC952/954 timeout values. Table 91. Watchdog Timer Control register (WDCON - address A7h) bit allocation Symbol PRE2 PRE1 PRE0 WDRUN...
This bit contains a hard-wired 0. Allows toggling of the DPS bit by incrementing AUXR1, without interfering with other bits in the register. SRST Software Reset. When set by software, resets the P89LPC952/954 as if a hardware reset occurred. ENT0 When set the P1.2 pin is toggled whenever Timer 0 overflows.
DPTR) will be affected by the setting of DPS. The MOVX instructions have limited application for the P89LPC952/954 since the part does not have an external data bus. However, they may be used to access Flash configuration information (see Flash Configuration section) or auxiliary data (XDATA) memory.
20-year minimum data retention 17.3 Flash programming and erase The P89LPC952/954 program memory consists 1 kB sectors. Each sector can be further divided into 64-byte pages. In addition to sector erase and page erase, a 64-byte page register is included which allows from 1 to 64 bytes of a given page to be programmed at the same time, substantially reducing overall programming time.
UM10147 NXP Semiconductors P89LPC952/954 User manual • A factory-provided default serial loader, located in upper end of user program memory, providing In-System Programming (ISP) via the serial port. • Two-wire serial debugger. 17.4 Using Flash as data storage: IAP-Lite The Flash code memory array of this device supports IAP-Lite in addition to standard IAP functions.
Page 109
UM10147 NXP Semiconductors P89LPC952/954 User manual OI flag (FMCON.0) after each erase-programming operation to see if the operation was aborted. If the operation was aborted, the user’s code will need to repeat the process starting with loading the page register.
Page 110
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 100. Flash Memory Control register (FMCON - address E4h) bit description …continued Symbol Access Description High voltage abort. Set if either an interrupt or a brown-out is detected during a program or erase cycle. Also set if the brown-out detector is disabled at the start of a program or erase cycle.
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 P89LPC952/954 contains two special Flash elements: the BOOT VECTOR and the Boot Status Bit. Following reset, the P89LPC952/954 examines the contents of the Boot Status Bit. If the Boot Status Bit is set to zero, power-up execution starts at location 0000H, which is the normal start address of the user’s application code.
The ISP feature requires that an initial character (an uppercase U) be sent to the P89LPC952/954 to establish the baud rate. The ISP firmware provides auto-echo of received characters. Once baud rate initialization has been performed, the ISP firmware will only accept Intel Hex-type records.
Page 114
Should an error occur in the checksum, the P89LPC952/954 will send an ‘X’ out the serial port indicating a checksum error. If the checksum calculation is found to match the checksum in the record, then the command will be executed.
Page 115
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 102. In-system Programming (ISP) hex record formats Record type Command/data function Program User Code Memory Page: nnaaaa00dd..ddcc Where: nn = number of bytes to program; aaaa = page address; dd..dd= data bytes; cc = checksum;...
Page 116
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 102. In-system Programming (ISP) hex record formats …continued Record type Command/data function Miscellaneous Read Functions: 01xxxx03sscc Where xxxx = required field but value is a ‘don’t care’; ss= subfunction code; cc = checksum...
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 102. In-system Programming (ISP) hex record formats …continued Record type Command/data function Read Global CRC: 00xxxx06cc Where: xxxx = required field but value is a ‘don’t care’; cc= checksum Example: 00000006FA Direct Load of Baud Rate: 02xxxx07HHLLcc Where: xxxx = required field but value is a ‘don’t care’;...
UM10147 NXP Semiconductors P89LPC952/954 User manual The WE flag is SET by writing the Set Write Enable (08H) command to FMCON followed by a key value (96H) to FMDATA: FMCON = 0x08; FMDATA = 0x96; The WE flag is CLEARED by writing the Clear Write Enable (0BH) command to FMCON followed by a key value (96H) to FMDATA, or by a reset: FMCON = 0x0B;...
Page 119
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 103. IAP error status Flag Description Operation Interrupted. Indicates that an operation was aborted due to an interrupt occurring during a program or erase cycle. Security Violation. Set if program or erase operation fails due to security settings. Cycle is aborted. Memory contents are unchanged.
Page 120
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 104. IAP function calls IAP function IAP call parameters Program User Code Page Input parameters: (requires ‘key’) ACC = 00h R3= number of bytes to program R4= page address (MSB) R5= page address (LSB)
Page 121
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 104. IAP function calls …continued IAP function IAP call parameters Misc. Read Input parameters: ACC = 03h R7= register address 00= UCFG1 01= UCFG2 02= Boot Vector 03= Status Byte 04 to 07 = reserved...
R7= data 17.17 User configuration bytes A number of user-configurable features of the P89LPC952/954 must be defined at power-up and therefore cannot be set by the program after start of execution. These features are configured through the use of an Flash byte UCFG1 shown in Table 106 Table 105.
0:4 BOOTV[0:4] Boot vector. If the Boot Vector is selected as the reset address, the P89LPC952/954 will start execution at an address comprised of 00h in the lower eight bits and this BOOTVEC as the upper eight bits after a reset.
Bit Symbol Description Boot Status Bit. If programmed to logic 1, the P89LPC952/954 will always start execution at an address comprised of 00H in the lower eight bits and BOOTVEC as the upper bits after a reset. (See Section 7.1 “Reset vector”...
UM10147 NXP Semiconductors P89LPC952/954 User manual 18. Instruction set Table 117. Instruction set summary Mnemonic Description Bytes Cycles Hex code ARITHMETIC ADD A,Rn Add register to A 28 to 2F ADD A,dir Add direct byte to A ADD A,@Ri Add indirect memory to A...
Page 127
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 117. Instruction set summary …continued Mnemonic Description Bytes Cycles Hex code XRL A,Rn Exclusive-OR register to A 68 to 6F XRL A,dir Exclusive-OR direct byte to A XRL A, @Ri Exclusive-OR indirect memory to A...
Page 128
UM10147 NXP Semiconductors P89LPC952/954 User manual Table 117. Instruction set summary …continued Mnemonic Description Bytes Cycles Hex code XCHD A,@Ri Exchange A and indirect memory nibble D6 to D7 BOOLEAN Mnemonic Description Bytes Cycles Hex code CLR C Clear carry...
Page 129
Notice: All referenced brands, product names, service names and trademarks information. are the property of their respective owners. Right to make changes — NXP Semiconductors reserves the right to make C-bus — logo is a trademark of NXP B.V. changes to information published in this document, including without limitation specifications and product descriptions, at any time and without notice.
Need help?
Do you have a question about the P89LPC952 and is the answer not in the manual?
Questions and answers