Page 1
UM10119 P89LPC938 User manual Rev. 03 — 7 June 2005 User manual Document information Info Content Keywords P89LPC938 Abstract Technical information for the P89LPC938 device.
P89LPC938 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 system-level functions have been incorporated into the P89LPC938 in order to reduce component count, board space, and system cost.
Page 11
Table 2: P89LPC938 Special function registers * indicates SFRs that are bit addressable. Name Description Bit functions and addresses Reset value addr.
Page 12
Table 2: P89LPC938 Special function registers …continued * indicates SFRs that are bit addressable. Name Description...
Page 13
Table 2: P89LPC938 Special function registers …continued * indicates SFRs that are bit addressable. Name Description...
Page 14
Table 2: P89LPC938 Special function registers …continued * indicates SFRs that are bit addressable. Name Description...
Page 15
Table 2: P89LPC938 Special function registers …continued * indicates SFRs that are bit addressable. Name Description...
Page 16
Table 2: P89LPC938 Special function registers …continued * indicates SFRs that are bit addressable. Name Description...
Page 17
Table 3: P89LPC938 extended special function registers Name Description SFR addr. Bit functions and addresses...
CODE — 64 kB of Code memory space, accessed as part of program execution and via the MOVC instruction. The P89LPC938 has 8 kB of on-chip Code memory. Table 4: Data RAM arrangement...
2. Clocks 2.1 Enhanced CPU The P89LPC938 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 P89LPC938 has a 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 ±...
2.9 Low power select The P89LPC938 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.
When used as digital I/O these pins are 5 V tolerant. If selected as input signals in ADINS, these pins will be 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 P89LPC938 data sheet for specifications.
This bit is cleared in software by writing a 1 to this bit. 4. Interrupts The P89LPC938 uses a four priority level interrupt structure. This allows great flexibility in controlling the handling of the P89LPC938’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 P89LPC938 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.
5. I/O ports The P89LPC938 has four I/O ports: Port 0, Port 1, Port 2, and Port 3. Ports 0, 1, and 2 are 8-bit ports and Port 3 is a 2-bit port. The exact number of I/O pins available depends upon...
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 P89LPC938 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 P89LPC938 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 P89LPC938 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 P89LPC938 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.
P3M2.1 XTAL1 6. Power monitoring functions The P89LPC938 incorporates power monitoring functions designed to prevent incorrect operation during initial power-on and power loss or reduction during operation. This is accomplished with two hardware functions: Power-on Detect and Brownout Detect. 6.1 Brownout detection The Brownout Detect function determines if the power supply voltage drops below a certain level.
Page 39
Brownout trip voltage, VBO (see P89LPC938 data sheet, Static characteristics), and is negated when V rises above VBO. If the P89LPC938 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 the device...
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 P89LPC938 supports three different power reduction modes as determined by SFR bits PCON[1:0] (see Table 27).
Page 41
Power-down mode: The Power-down mode stops the oscillator in order to minimize power consumption. The P89LPC938 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.
P89LPC938 User manual 7.1 Reset vector Following reset, the P89LPC938 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 device has...
Mode 3 is provided for applications that require an extra 8-bit timer. With Timer 0 in Mode 3, an P89LPC938 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.
PCLK as the clock source for the timer. 9. Real-time clock system timer The P89LPC938 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...
CCU Timer Overflow Interrupt Enable bit. 11. UART The P89LPC938 has an enhanced UART that is compatible with the conventional 80C51 UART except that Timer 2 overflow cannot be used as a baud rate source. The P89LPC938 does include an independent Baud Rate Generator. The baud rate can be selected from the oscillator (divided by a constant), Timer 1 overflow, or the independent Baud Rate Generator.
Baud Rate Generator Control 11.6 Baud Rate generator and selection The P89LPC938 enhanced UART has an independent Baud Rate Generator. The baud rate is determined by a value programmed into the BRGR1 and BRGR0 SFRs. The UART can use either Timer 1 or the baud rate generator output as determined by BRGCON[2:1]...
13. Serial Peripheral Interface (SPI) The P89LPC938 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.
88). 14. Analog comparators Two analog comparators are provided on the P89LPC938. 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).
14.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 P89LPC938 data sheet for specifications 14.3 Comparator input pins Comparator input and reference pins maybe be used as either digital I/O or as inputs to the comparator.
Page 107
MOV WFEED2,#05Ah ;do watchdog feed part 2 SETB EA ;enable interrupt This sequence assumes that the P89LPC938 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.
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 P89LPC938 as if a hardware reset occurred. ENT0 When set the P1.2 pin is toggled whenever Timer 0 overflows.
18. Data EEPROM The P89LPC938 has 512 bytes of on-chip Data EEPROM that can be used to save configuration parameters. The Data EEPROM is SFR based, byte readable, byte writable, and erasable (via row fill and sector fill).
Five Flash programming methods are available. On-chip erase and write timing generation contribute to a user-friendly programming interface. The P89LPC938 Flash reliably stores memory contents even after 100,000 erase and program cycles. The cell is designed to optimize the erase and programming mechanisms.
10-year minimum data retention 19.3 Flash programming and erase The P89LPC938 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.
The P89LPC938 contains two special Flash elements: the BOOT VECTOR and the Boot Status Bit. Following reset, the P89LPC938 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 In-System Programming facility consists of a series of internal hardware resources coupled with internal firmware to facilitate remote programming of the P89LPC938 through the serial port. This firmware is provided by Philips and embedded within each P89LPC938 device. The Philips In-System Programming facility has made in-circuit programming in an embedded application possible with a minimum of additional expense in components and circuit board area.
Should an error occur in the checksum, the P89LPC938 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.
R7= data 19.17 User configuration bytes A number of user-configurable features of the P89LPC938 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...
0:4 BOOTV[0:4] Boot vector. If the Boot Vector is selected as the reset address, the P89LPC938 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.