The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

P89LPC938 User manual Rev. March 2005 User manual Document i


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



UM10119
P89LPC938 User manual
Rev. March 2005 User manual
Document information Info Keywords Abstract Content P89LPC938 Technical information P89LPC938 device.
Philips Semiconductors
UM10119
P89LPC938 User manual
Revision history Date 20050304 20050111 Description Updated Initial version
Contact information
additional information, please visit: sales office addresses, please send email
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Introduction
P89LPC938 single-chip microcontroller designed applications demanding high-integration, cost solutions over wide range performance requirements. P89LPC938 based high performance processor architecture that executes instructions four clocks, times rate standard 80C51 devices. Many system-level functions have been incorporated into P89LPC938 order reduce component count, board space, system cost.
configuration
P2.0/ICB/AD07 P2.1/OCD/AD06 P0.0/CMP2/KBI0/AD05 P1.7/OCC/AD04 P1.6/OCB P1.5/RST P3.1/XTAL1 P3.0/XTAL2/CLKOUT
P2.7/ICA P2.6/OCA P0.1/CIN2B/KBI1/AD00 P0.2/CIN2A/KBI2/AD01 P0.3/CIN1B/KBI3/AD02 P0.4/CIN1A/KBI4/AD03 P0.5/CMPREF/KBI5 P0.6/CMP1/KBI6 P0.7/T1/KBI7 P1.0/TXD P1.1/RXD P2.5/SPICLK P2.4/SS
002aab101
P89LPC938FDH
P1.4/INT1 P1.3/INT0/SDA P1.2/T0/SCL P2.2/MOSI P2.3/MISO
P89LPC938 TSSOP28 configuration.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
P2.7/ICA
P2.6/OCA
P0.1/CIN2B/KBI1/AD00 P0.2/CIN2A/KBI2/AD01 P0.3/CIN1B/KBI3/AD02 P0.4/CIN1A/KBI4/AD03 P0.5/CMPREF/KBI5 P0.6/CMP1/KBI6 P0.7/T1/KBI7 P1.0/TXD P0.1/CIN2B/KBI1/AD00 P0.2/CIN2A/KBI2/AD01 P0.3/CIN1B/KBI3/AD02 P0.4/CIN1A/KBI4/AD03
002aab085
P0.0/CMP2/KBI0/AD05
P1.7/OCC/AD04
P2.1/OCD/AD06
P1.6/OCB P1.5/RST P3.1/XTAL1 P3.0/XTAL2/CLKOUT
P1.4/INT1 P1.3/INT0/SDA P2.5/SPICLK P2.7/ICA P1.2/T0/SCL P2.2/MOSI P2.3/MISO P1.1/RXD P2.6/OCA P2.4/SS P2.0/ICB/AD07
P89LPC938 PLCC28 configuration.
P0.0/CMP2/KBI0/AD05
P1.7/OCC/AD04
P89LPC938FA
terminal index area
P1.6/OCB P1.5/RST P3.1/XTAL1 P3.0/XTAL2/CLKOUT P1.4/INT1 P1.3/INT0/SDA
P2.3/MISO P2.4/SS P2.5/SPICLK P1.1/RXD P1.0/TXD
P89LPC938FHN
P2.1/OCD/AD06
P2.0/ICB/AD07
P0.5/CMPREF/KBI5
P0.6/CMP1/KBI6 P0.7/T1/KBI7
P1.2/T0/SCL
P2.2/MOSI
002aab073
Transparent view
P89LPC938 HVQFN28 configuration.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
description
Table Symbol description TSSOP28, HVQFN28 PLCC28 P0.0 P0.7 Port Port 8-bit port with user-configurable output type. During reset Port latches configured input only mode with internal pull-up disabled. operation Port pins inputs outputs depends upon port configuration selected. Each port configured independently. Refer Section "Port configurations" page details. Keypad Interrupt feature operates with Port pins. pins have Schmitt triggered inputs. Port also provides various special functions described below: P0.0/CMP2/ KBI0/AD05 P0.1/CIN2B/ KBI1/AD00 P0.2/CIN2A/ KBI2/AD01 P0.3/CIN1B/ KBI3/AD02 P0.4/CIN1A/ KBI4/AD03 P0.5/CMPREF/ KBI5 P0.0 Port CMP2 Comparator output. KBI0 Keyboard input AD05 ADC0 channel analog input. P0.1 Port CIN2B Comparator positive input KBI1 Keyboard input AD00 ADC0 channel analog input. P0.2 Port CIN2A Comparator positive input KBI2 Keyboard input AD01 ADC0 channel analog input. P0.3 Port CIN1B Comparator positive input KBI3 Keyboard input AD02 ADC0 channel analog input. P0.4 Port CIN1A Comparator positive input KBI4 Keyboard input AD03 ADC0 channel analog input. P0.5 Port CMPREF Comparator reference (negative) input. KBI5 Keyboard input Type Description
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table Symbol
description .continued TSSOP28, HVQFN28 PLCC28 Type Description
P0.6/CMP1/ KBI6
P0.6 Port CMP1 Comparator output. KBI6 Keyboard input P0.7 Port Timer/counter external count input overflow output. KBI7 Keyboard input
P0.7/T1/KBI7
P1.0 P1.7
I/O, Port Port 8-bit port with user-configurable output type, except three pins noted below. During reset Port latches configured input only mode with internal pull-up disabled. operation configurable Port pins inputs outputs depends upon port configuration selected. Each configurable port pins programmed independently. Refer Section "Port configurations" page details. P1.2 P1.3 open drain when used outputs. P1.5 input only. pins have Schmitt triggered inputs. Port also provides various special functions described below:
P1.0/TXD P1.1/RXD P1.2/T0/SCL
P1.0 Port Transmitter output serial port. P1.1 Port Receiver input serial port. P1.2 Port (open-drain when used output). Timer/counter external count input overflow output (open-drain when used output). serial clock input/output. P1.3 Port (open-drain when used output). INT0 External interrupt input. serial data input/output. P1.4 Port INT1 External interrupt input. P1.5 Port (input only). External Reset input during power-on selected UCFG1. When functioning reset input, this resets microcontroller, causing ports peripherals take their default states, processor begins execution address Also used during power-on sequence force In-System Programming mode. When using oscillator frequency above MHz, reset input function P1.5 must enabled. external circuit required hold device reset powerup until reached specified level. When system power removed will fall below minimum specified operating voltage. When using oscillator frequency above MHz, some applications, external brownout detect circuit required hold device reset when falls below minimum specified operating voltage. P1.6 Port Output Compare
Koninklijke Philips Electronics N.V. 2004. rights reserved.
P1.3/INT0/
P1.4/INT1 P1.5/RST
P1.6/OCB
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table Symbol
description .continued TSSOP28, HVQFN28 PLCC28 Type Description
P1.7/OCC/ AD04
P1.7 Port Output Compare AD04 ADC0 channel analog input. Port Port 8-bit port with user-configurable output type. During reset Port latches configured input only mode with internal pull-up disabled. operation Port pins inputs outputs depends upon port configuration selected. Each port configured independently. Refer Section "Port configurations" page details. pins have Schmitt triggered inputs. Port also provides various special functions described below:
P2.0 P2.7
P2.0/ICB/ AD07
P2.0 Port Input Capture AD07 ADC0 channel analog input. P2.1 Port Output Compare AD06 ADC0 channel analog input. P2.2 Port MOSI master slave When configured master, this output; when configured slave, this input. P2.3 Port MISO When configured master, this input, when configured slave, this output. P2.4 Port Slave select. P2.5 Port SPICLK clock. When configured master, this output; when configured slave, this input. P2.6 Port Output Compare P2.7 Port Input Capture Port Port 2-bit port with user-configurable output type. During reset Port latches configured input only mode with internal pull-up disabled. operation Port pins inputs outputs depends upon port configuration selected. Each port configured independently. Refer Section "Port configurations" page details. pins have Schmitt triggered inputs. Port also provides various special functions described below:
P2.1/OCD/ AD06
P2.2/MOSI
P2.3/MISO
P2.4/SS P2.5/SPICLK
P2.6/OCA P2.7/ICA P3.0 P3.1
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table Symbol
description .continued TSSOP28, HVQFN28 PLCC28 Type Description
P3.0/XTAL2/ CLKOUT
P3.0 Port XTAL2 Output from oscillator amplifier (when crystal oscillator option selected Flash configuration. CLKOUT clock divided when enabled (ENCLK -TRIM.6). used clock internal oscillator, watchdog oscillator external clock input, except when XTAL1/XTAL2 used generate clock source RTC/system timer. P3.1 Port XTAL1 Input oscillator circuit internal clock generator circuits (when selected Flash configuration). port internal oscillator watchdog oscillator used clock source, XTAL1/XTAL2 used generate clock RTC/system timer. Ground: reference. Power Supply: This power supply voltage normal operation well Idle Power-Down modes.
P3.1/XTAL1
Input/Output P1.0 P1.4, P1.6, P1.7. Input P1.5.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
P89LPC938
ACCELERATED 2-CLOCK 80C51
CODE FLASH 256-BYTE DATA 512-BYTE AUXILIARY internal
UART
SPICLK MOSI MISO
I2C-BUS
512-BYTE DATA EEPROM
REAL-TIME CLOCK/ SYSTEM TIMER TIMER TIMER CMP2 ANALOG COMPARATORS CIN2A CIN1A (CAPTURE/ COMPARE UNIT) CIN2B CMP1 CIN1B
P3[1:0]
PORT CONFIGURABLE I/Os PORT CONFIGURABLE I/Os PORT CONFIGURABLE I/Os PORT CONFIGURABLE I/Os
P2[7:0]
P1[7:0]
P0[7:0]
AD00 KEYPAD INTERRUPT WATCHDOG TIMER OSCILLATOR AD02 ADC0 AD04 AD06
AD01 AD03 AD05 AD07
PROGRAMMABLE OSCILLATOR DIVIDER CONFIGURABLE OSCILLATOR
clock ON-CHIP OSCILLATOR POWER MONITOR (POWER-ON RESET, BROWNOUT RESET)
CRYSTAL RESONATOR
002aab106
P89LPC938 block diagram.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Special function registers
Remark: Special Function Registers (SFRs) accesses restricted following ways:
User must attempt access locations defined. Accesses defined locations must strictly functions SFRs. bits labeled `-', only written read follows:
Unless otherwise specified, must written with `0', return value when read (even written with `0'). reserved used future derivatives. must written with `0', will return when read. must written with `1', will return when read.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
User manual Rev. March 2005
Koninklijke Philips Electronics N.V. 2004. rights reserved.
Philips Semiconductors
Table P89LPC938 Special function registers indicates SFRs that addressable. Name Description functions addresses addr. address ACC* AD0CON AD0INS AD0MOD AD0MOD AUXR1 BRGR0[2] BRGR1[2] BRGCON CCCRA CCCRB CCCRC CCCRD CMP1 CMP2 DEECON DEEDAT DEEADR DIVM Accumulator ADC0 control register ADC0 input select ADC0 mode register ADC0 mode register Auxiliary function register register Baud rate generator rate Baud rate generator rate high Baud rate generator control Capture compare control register Capture compare control register Capture compare control register Capture compare control register Comparator control register Comparator control register Data EEPROM control register Data EEPROM data register Data EEPROM address register clock divide-by-M control ICECA2 ICECB2 EEIF ICECA1 ICECB1 HVERR ICECA0 ICECB0 ECTL1 ICESA ICESB ECTL0 ICNFA ICNFB FCOA FCOB FCOC FCOD SBRGS OCMA1 OCMB1 OCMC1 OCMD1 BRGEN OCMA0 OCMB0 OCMC0 OCMD0 CMF1 CMF2 EADR8 ENBI0 ADI07 BNDI0 CLK2 CLKLP ENADCI ADI06 BURST0 CLK1 EBRR TMM0 ADI05 SCC0 CLK0 ENT1 EDGE0 ADI04 SCAN0 ENT0 ADCI0 ADI03 SRST ENADC0 ADCS01 ADI02 ADI01 Reset value ADCS00 ADI00 00[2] 00[1] 00[1] 00000000 00000000 00000000 xxxxxx00 00000000 00000000 xxxxx000 xxxxx000 xx000000 xx000000 00001110 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000x0000 000000x0 Binary
address
P89LPC938 User manual
UM10119
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
Table P89LPC938 Special function registers .continued indicates SFRs that addressable. Name DPTR FMADRH FMADRL FMCON Description Data pointer bytes) Data pointer high Data pointer Program Flash address high Program Flash address Program Flash control (Read) Program Flash control (Write) FMDATA I2ADR
Rev. March 2005
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Philips Semiconductors
functions addresses addr. EIEE EWDRT PWDRT ES/ESR ECCU PS/PSR ESPI EKBI EADC STA.4 STA.3 STA.2 STA.1 STA.0 I2ADR.6 I2ADR.5 I2EN I2ADR.4 I2ADR.3 I2ADR.2 I2ADR.1 I2ADR.0 BUSY FMCMD. FMCMD. FMCMD. FMCMD. FMCMD. FMCMD. FMCMD.
Reset value FMCMD. CRSEL EI2C 00[1] x0000000 00[1] 00[1] 00x00000 00x00000 00000000 x00000x0 00000000 00000000 11111000 00000000 00000000 00000000 00000000 00000000 00000000 Binary 00000000 00000000 00000000 00000000 01110000
Program Flash data slave address register control register data register
address I2CON* I2DAT I2SCLH I2SCLL I2STAT ICRAH ICRAL ICRBH ICRBL IEN0* IEN1* IEN2 IP0*
Serial clock generator/SCL duty cycle register high Serial clock generator/SCL duty cycle register status register Input capture register high Input capture register Input capture register high Input capture register Interrupt enable Interrupt enable Interrupt enable Interrupt priority
address address address
P89LPC938 User manual
UM10119
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
Table P89LPC938 Special function registers .continued indicates SFRs that addressable. Name IP0H Description Interrupt priority high functions addresses addr. address IP1* IP1H IP2H KBCON KBMASK
Rev. March 2005
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Philips Semiconductors
Reset value PSH/ PSRH PCCU PCCUH PT1H PSPI PSPIH PX1H PT0H PKBI PKBIH PADC PADCH PATN _SEL PX0H PI2C PI2CH KBIF 00[1] 00[1] 00[1] 00[1] 00[1] 00x00000 00x00000 00x00000 00x00000 xxxxxx00 00000000 11111111 00000000 00000000 00000000 00000000 00000000 00000000 00[1] Binary x0000000
PADEE PADEEH
PWDRT PSTH
PBOH
Interrupt priority Interrupt priority high Interrupt priority Interrupt priority high Keypad control register Keypad interrupt mask register Keypad pattern register Output compare register high Output compare register Output compare register high Output compare register Output compare register high Output compare register Output compare register high Output compare register Port
KBPATN OCRAH OCRAL OCRBH OCRBL OCRCH OCRCL OCRDH OCRDL
P89LPC938 User manual
00000000 00000000
UM10119
address address
T1/KB7
CMP1 /KB6
CMPREF /KB5
CIN1A /KB4
CIN1B /KB3
CIN2A /KB2
CIN2B /KB1
CMP2 /KB0
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
Table P89LPC938 Special function registers .continued indicates SFRs that addressable. Name Description Port functions addresses addr. address P0M1 P0M2 P1M1 P1M2 P2M1 P2M2 P3M1 P3M2 PCON PCONA PSW* PT0AD RSTSRC RTCCON RTCH RTCL SADDR SADEN SBUF SCON* SSTAT
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual Rev. March 2005
Philips Semiconductors
Reset value INT1 INT0/ MISO T0/SCL MOSI XTAL1 XTAL2 FF[1] 00[1] D3[1] FF[1] 00[1] 03[1] 00[1] 60[1][6] 00[6] 00[6]
Binary
SPICLK
Port Port Port output mode Port output mode Port output mode Port output mode Port output mode Port output mode Port output mode Port output mode Power control register Power control register Program status word Port digital input disable Reset source register control register high register Serial port address register Serial port address enable Serial Port data buffer register Serial port control Serial port extended status register
address address
(P0M1.7) (P0M1.6) (P0M1.5) (P0M1.4) (P0M1.3) (P0M1.2) (P0M1.1) (P0M1.0) (P0M2.7) (P0M2.6) (P0M2.5) (P0M2.4) (P0M2.3) (P0M2.2) (P0M2.1) (P0M2.0) (P1M1.7) (P1M1.6) (P1M2.7) (P1M2.6) (P1M1.4) (P1M1.3) (P1M1.2) (P1M1.1) (P1M1.0)
11111111 00000000 11x1xx11 00x0xx00 11111111 00000000 xxxxxx11 xxxxxx00 00000000 00000000 00000000 xx00000x
(P1M2.4) (P1M2.3) (P1M2.2) (P1M2.1) (P1M2.0) 00[1]
(P2M1.7) (P2M1.6) (P2M1.5) (P2M1.4) (P2M1.3) (P2M1.2) (P2M1.1) (P2M1.0) (P2M2.7) (P2M2.6) (P2M2.5) (P2M2.4) (P2M2.3) (P2M2.2) (P2M2.1) (P2M2.0) SMOD1 RTCPD RTCF SMOD0 DEEPD RTCS1 BOPD VCPD RTCS0 ADPD I2PD R_BK SPPD R_WD (P3M1.1) (P3M1.0) PMOD1 R_SF ERTC PMOD0 CCUPD R_EX RTCEN
(P3M2.1) (P3M2.0) 00[1]
PT0AD.5 PT0AD.4 PT0AD.3 PT0AD.2 PT0AD.1
011xxx00 00000000
P89LPC938 User manual
00000000 00000000 00000000 xxxxxxxx 00000000 00000000
UM10119
address
SM0/FE DBMOD
INTLO
CIDIS
DBISEL
STINT
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
Table P89LPC938 Special function registers .continued indicates SFRs that addressable. Name SPCTL SPSTAT SPDAT TAMOD TCON* TCR20* TCR21
Rev. March 2005
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Philips Semiconductors
Description Stack pointer control register status register data register Timer auxiliary mode Timer control control register control register Timer high Timer high timer high interrupt control register interrupt flag register interrupt status encode register Timer Timer timer Timer mode reload register high reload register
functions addresses addr. T1GATE T1C/T T1M1 T1M0 T0GATE T0C/T T0M1 TOIE2 TOIF2 TOCIE2D TOCIE2C TOCIE2B TOCIE2A TOCF2D TOCF2C TOCF2B TOCF2A ENCINT. TICIE2B TICF2B ENCINT. PLEEN TCOU2 HLTRN HLTEN T1M2 ALTCD ALTAB PLLDV.3 TDIR2 PLLDV.2 PLLDV.1 SSIG SPIF SPEN WCOL DORD MSTR CPOL CPHA SPR1
Reset value SPR0 T0M2 00000000 00000000 0xxx0000 00000000 00000000 00000000 00000x00 00000x00 xxxxx000 00000000 00000000 00000000 00000000 00000000 00000000 Binary 00000111 00000100 00xxxxxx 00000000 xxx0xxx0
address
TMOD21 TMOD20 PLLDV.0 TICIE2A TICF2A ENCINT. T0M0 TPCR2H. TPCR2H.
TICR2 TIFR2 TISE2 TMOD TOR2H TOR2L TPCR2H TPCR2L TRIM WDCON
P89LPC938 User manual
Prescaler control register high Prescaler control register Internal oscillator trim register Watchdog control register
xxxxxx00 00000000
TPCR2L. TPCR2L. TPCR2L. TPCR2L. TPCR2L. TPCR2L. TPCR2L. TPCR2L. RCCLK PRE2 ENCLK PRE1 TRIM.5 PRE0 TRIM.4 TRIM.3 TRIM.2 WDRUN TRIM.1 WDTOF TRIM.0 WDCLK
UM10119
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
Table P89LPC938 Special function registers .continued indicates SFRs that addressable. Name WFEED1 WFEED2
Rev. March 2005
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Philips Semiconductors
Description Watchdog load Watchdog feed Watchdog feed
functions addresses addr.
Reset value Binary 11111111
ports input only (high-impedance) state after power-up. BRGR1 BRGR0 must only written BRGEN BRGCON logic written while BRGEN result unpredictable. RSTSRC register reflects cause UM10119 reset. Upon power-up reset, reset source flags cleared except BOF; power-on reset value xx110000. After reset, value 111001x1, i.e., PRE2-PRE0 logic WDRUN WDCLK WDTOF logic after watchdog reset logic after power-on reset. Other resets will affect WDTOF. power-on reset, TRIM initialized with factory preprogrammed value. Other resets will cause initialization TRIM register. only reset source that affects these SFRs power-on reset.
P89LPC938 User manual
UM10119
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
User manual Rev. March 2005
Koninklijke Philips Electronics N.V. 2004. rights reserved.
Philips Semiconductors
Table Name
P89LPC938 extended special function registers Description ADC0 high _boundary register, left (MSB) ADC0 low_boundary register (MSB) ADC0 data register right (LSB) ADC0 data register left (MSB) ADC0 data register right (LSB) ADC0 data register left (MSB) ADC0 data register right (LSB) ADC0 data register left (MSB) ADC0 data register right (LSB) ADC0 data register left (MSB) ADC0 data register right (LSB) ADC0 data register left (MSB) ADC0 data register right (LSB) ADC0 data register left (MSB) ADC0 data register right (LSB) ADC0 data register left (MSB) ADC0 data register right (LSB) ADC0 data register left (MSB) ADC0 boundary status register addr. FFEFh FFEEh FFFEh FFFFh FFFCh FFFDh FFFAh FFFBh FFF8h FFF9h FFF6h FFF7h FFF4h FFF5h FFF2h FFF3h FFF0h FFF1h FFEDh AD0DAT0[7:0] AD0DAT0[9:2] AD0DAT1[7:0] AD0DAT1[9:2] AD0DAT2[7:0] AD0DAT2[9:2] AD0DAT3[7:0] AD0DAT3[9:2] AD0DAT4[7:0] AD0DAT4[9:2] AD0DAT5[7:0] AD0DAT5[9:2] AD0DAT6[7:0] AD0DAT6[9:2] AD0DAT7[7:0] AD0DAT7[9:2] functions addresses Reset value Binary 11111111 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ADC0HBND ADC0LBND AD0DAT0R AD0DAT0L AD0DAT1R AD0DAT1L AD0DAT2R AD0DAT2L AD0DAT3R AD0DAT3L AD0DAT4R AD0DAT4L AD0DAT5R AD0DAT5L AD0DAT6R AD0DAT6L AD0DAT7R AD0DAT7L BNDSTA0
BST07 BST06 BST05 BST04 BST03 BST02 BST01 BST00
Extended SFRs logically external data memory space (XDATA) accessed using MOVX A,@DPTR MOVX @DPTR,A instructions.
P89LPC938 User manual
UM10119
Philips Semiconductors
UM10119
P89LPC938 User manual
Memory organization
read-protected calls only entrypoints
IDATA routines FFEFh FF1Fh FF00h
FF00h FFEFh
entry points for: ASM. code code
entry points
SPECIAL FUNCTION REGISTERS (DIRECTLY ADDRESSABLE)
IDATA (incl. DATA)
BYTES ON-CHIP DATA MEMORY (STACK INDIR. ADDR.)
DATA
1FFFh 1E00h 1C00h 1BFFh 1800h 17FFh 1400h 13FFh 1000h 0FFFh 0C00h 0BFFh 0800h 07FFh 0400h 03FFh 0000h
CODE (512B)* SECTOR SECTOR SECTOR SECTOR SECTOR SECTOR SECTOR SECTOR
serial loader
1FFFh
entry points for: -UART (auto-baud) -I2C, SPI, etc.* flexible choices: supplied (UART) -Philips libraries* -user-defined
BYTES ON-CHIP DATA MEMORY (STACK, DIRECT INDIR. ADDR.) REG. BANKS R[7:0]
1E00h
data memory (DATA, IDATA)
002aaa948
P89LPC938 memory map.
various P89LPC938 memory spaces follows: DATA bytes internal data memory space (00h:7Fh) accessed direct indirect addressing, using instruction other than MOVX MOVC. part Stack this area. IDATA Indirect Data. bytes internal data memory space (00h:FFh) accessed indirect addressing using instructions other than MOVX MOVC. part Stack this area. This area includes DATA area bytes immediately above Special Function Registers. Selected registers peripheral control status registers, accessible only direct addressing. CODE Code memory space, accessed part program execution MOVC instruction. P89LPC938 on-chip Code memory.
Table Type DATA IDATA Data arrangement Data Directly indirectly addressable memory Indirectly addressable memory Size (bytes)
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Clocks
Enhanced
P89LPC938 uses enhanced 80C51 which runs times speed standard 80C51 devices. machine cycle consists clock cycles, most instructions execute machine cycles.
Clock definitions
P89LPC938 device several internal clocks defined below: OSCCLK Input DIVM clock divider. OSCCLK selected from four clock sources also optionally divided slower frequency (see Figure Section "CPU Clock (CCLK) modification: DIVM register"). Note: fosc defined OSCCLK frequency. CCLK clock; output DIVM clock divider. There CCLK cycles machine cycle, most instructions executed machine cycles (two four CCLK cycles). RCCLK internal 7.373 oscillator output. PCLK Clock various peripheral devices CCLK/2.
2.2.1 Oscillator Clock (OSCCLK)
P89LPC938 provides several user-selectable oscillator options. This allows optimization range needs from high precision lowest possible cost. These options configured when FLASH programmed include on-chip watchdog oscillator, on-chip oscillator, oscillator using external crystal, external clock source. crystal oscillator optimized low, medium, high frequency crystals covering range from MHz.
2.2.2 speed oscillator option
This option supports external crystal range kHz. Ceramic resonators also supported this configuration.
2.2.3 Medium speed oscillator option
This option supports external crystal range MHz. Ceramic resonators also supported this configuration.
2.2.4 High speed oscillator option
This option supports external crystal range MHz. Ceramic resonators also supported this configuration. When using oscillator frequency above MHz, reset input function P1.5 must enabled. external circuit required hold device reset powerup until reached specified level. When system power removed will fall below minimum specified operating voltage. When using oscillator frequency above MHz, some applications, external brownout detect circuit required hold device reset when falls below minimum specified operating voltage.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Clock output
P89LPC938 supports user-selectable clock output function XTAL2 CLKOUT when crystal oscillator being used. This condition occurs different clock source been selected (on-chip oscillator, watchdog oscillator, external clock input Real-time Clock using crystal oscillator clock source. This allows external devices synchronize P89LPC938. This output enabled ENCLK TRIM register frequency this clock output that CCLK. clock output needed Idle mode, turned prior entering Idle, saving additional power. Note: reset, TRIM initialized with factory preprogrammed value. Therefore when setting clearing ENCLK bit, user should retain contents other bits TRIM register. This done reading contents TRIM register (into example), modifying writing this result back into TRIM register. Alternatively, `ANL direct' `ORL direct' instructions used clear TRIM register.
On-chip oscillator option
P89LPC938 TRIM register that used tune frequency oscillator. During reset, TRIM value initialized factory pre-programmed value adjust oscillator frequency 7.373 MHz, (Note: initial value better than please refer P89LPC938 data sheet behavior over temperature). user applications write TRIM register adjust on-chip oscillator other frequencies. Increasing TRIM value will decrease oscillator frequency.
Table Symbol Reset Table On-chip oscillator trim register (TRIM address 96h) allocation RCCLK ENCLK TRIM.5 TRIM.4 TRIM.3 TRIM.2 TRIM.1 TRIM.0
Bits loaded with factory stored value during reset.
On-chip oscillator trim register (TRIM address 96h) description Symbol TRIM.0 TRIM.1 TRIM.2 TRIM.3 TRIM.4 TRIM.5 ENCLK RCCLK when CCLK/2 output XTAL2 provided crystal oscillator being used. when selects Oscillator output clock (CCLK). This allows fast switching between clock source internal oscillator without needing through reset cycle. Description Trim value. Determines frequency internal oscillator. During reset, these bits loaded with stored factory calibration value. When writing either this register, care should taken preserve current TRIM value reading this register, modifying bits required, writing result this register.
Watchdog oscillator option
watchdog separate oscillator which frequency kHz. This oscillator used save power when high clock frequency needed.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
External clock input option
this configuration, processor clock derived from external source driving XTAL1 P3.1 pin. rate from MHz. XTAL2 P3.0 used standard port clock output. When using oscillator frequency above MHz, reset input function P1.5 must enabled. external circuit required hold device reset powerup until reached specified level. When system power removed will fall below minimum specified operating voltage. When using oscillator frequency above MHz, some applications, external brownout detect circuit required hold device reset when falls below minimum specified operating voltage.
quartz crystal ceramic resonator P89LPC932A1 XTAL1
XTAL2
002aab008
Note: oscillator must configured following modes: frequency crystal, medium frequency crystal, high frequency crystal. series resistor required limit crystal drive levels. This especially important frequency crystals (see text).
Using crystal oscillator.
XTAL1 XTAL2
HIGH FREQUENCY MEDIUM FREQUENCY FREQUENCY
OSCCLK OSCILLATOR (7.3728 WATCHDOG OSCILLATOR (400 TIMER TIMER I2C-BUS PCLK RCCLK
DIVM
CCLK PCLK
(P89LPC932A1)
002aaa891
UART
Block diagram oscillator control.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Oscillator Clock (OSCCLK) wake-up delay
P89LPC938 internal wake-up timer that delays clock until stabilizes depending clock source used. clock source three crystal selections, delay OSCCLK cycles plus clock source either internal oscillator Watchdog oscillator, delay OSCCLK cycles plus
Clock (CCLK) modification: DIVM register
OSCCLK frequency divided down, integer, times configuring dividing register, DIVM, provide CCLK. This produces CCLK frequency using following formula: CCLK frequency fosc (2N) Where: fosc frequency OSCCLK, value DIVM. Since ranges from 255, CCLK frequency range fosc fosc/510. (for CCLK fosc). This feature makes possible temporarily lower rate, reducing power consumption. dividing clock, retain ability respond events other than those that cause interrupts (i.e. events that allow exiting Idle mode) executing normal program lower rate. This often result lower power consumption than Idle mode. This allow bypassing oscillator start-up time cases where Power-down mode would otherwise used. value DIVM changed program time without interrupting code execution.
power select
P89LPC938 designed (CCLK) maximum. However, CCLK slower, CLKLP (AUXR1.7) logic lower power consumption further. reset, CLKLP logic allowing highest performance. This then software CCLK running slower.
converter
P89LPC938 10-bit, 8-channel multiplexed successive approximation analog-to-digital converter module. block diagram converter shown Figure consists 8-input multiplexer which feeds sample-and-hold circuit providing input signal comparator inputs. control logic combination with drives digital-to-analog converter which provides other input comparator. output comparator SAR.
features 10-bit, 8-channel multiplexed input, successive approximation converter. Eight result register pairs. operating modes
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Fixed channel, single conversion mode Fixed channel, continuous conversion mode Auto scan, single conversion mode Auto scan, continuous conversion mode Dual channel, continuous conversion mode Single step mode
Three conversion start modes
Timer triggered start Start immediately Edge triggered
10-bit conversion time clock Interrupt polled operation High boundary limits interrupt Clock divider Power down mode
comp INPUT CONTROL LOGIC DAC1
CCLK
002aab103
block diagram.
3.2.1 operating modes
3.2.1.1 Fixed channel, single conversion mode single input channel selected conversion. single conversion will performed result placed result register pair which corresponds selected input channel (see Table interrupt, enabled, will generated after conversion completes. input channel selected ADINS register. This mode selected setting SCAN0 ADMODA register.
Table Input channels result registers fixed channel single, auto scan single, auto scan continuous conversion modes Input channel AD00 Result register AD0DAT4R/L Input channel AD04
Result register AD0DAT0R/L
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Input channels result registers fixed channel single, auto scan single, auto scan continuous conversion modes .continued Input channel AD01 AD02 AD03 Result register AD0DAT5R/L AD0DAT6R/L AD0DAT7R/L Input channel AD05 AD06 AD07
Table
Result register AD0DAT1R/L AD0DAT2R/L AD0DAT3R/L
3.2.1.2
Fixed channel, continuous conversion mode single input channel selected continuous conversion. results conversions will sequentially placed eight result register pairs (see Table user select whether interrupt generated after every four every eight conversions. Additional conversion results will again cycle through result register pairs, overwriting previous results. Continuous conversions continue until terminated user. This mode selected setting SCC0 ADMODA register.
Table Result registers conversion results fixed channel, continuous conversion mode Contains Selected channel, first conversion result Selected channel, second conversion result Selected channel, third conversion result Selected channel, fourth conversion result Selected channel, fifth conversion result Selected channel, sixth conversion result Selected channel, seventh conversion result Selected channel, eighth conversion result
Result register AD0DAT0R/L AD0DAT1R/L AD0DAT2R/L AD0DAT3R/L AD0DAT4R/L AD0DAT5R/L AD0DAT6R/L AD0DAT7R/L
3.2.1.3
Auto scan, single conversion mode combination eight input channels selected conversion setting channel's respective ADINS register. single conversion each selected input will performed result placed result register pair which corresponds selected input channel (see Table user select whether interrupt, enabled, will generated after either first four conversions have occurred selected channels have been converted. user selects generate interrupt after first four input channels have been converted, second interrupt will generated after remaining input channels have been converted. only single channel selected this equivalent single channel, single conversion mode. channels converted from order ADINS). This mode selected setting SCAN0 ADMODA register.
3.2.1.4
Auto scan, continuous conversion mode combination eight input channels selected conversion setting channel's respective ADINS register. conversion each selected input will performed result placed result register pair which corresponds selected input channel (See Table user select whether interrupt, enabled, will generated after either first four conversions have occurred selected channels have been converted. user selects generate interrupt after four input channels have been converted, second interrupt will generated after remaining input channels have been converted. After selected channels have been
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
converted, process will repeat starting with first selected channel. Additional conversion results will again cycle through eight result register pairs, overwriting previous results. Continuous conversions continue until terminated user. channels converted from order ADINS). This mode selected setting BURST0 ADMODA register. 3.2.1.5 Dual channel, continuous conversion mode This variation auto scan continuous conversion mode where conversion occurs user-selectable inputs. combination eight input channels selected conversion. result conversion first channel placed result register pair, AD0DAT0R AD0DAT0L. result conversion second channel placed result register pair, AD0DAT1R AD0DAT1L. first channel again converted result stored AD0DAT2R AD0DAT2L. second channel again converted result placed AD0DAT3R AD0DAT3L, etc. (see Table interrupt generated, enabled, after every four eight conversions (user selectable). This mode selected setting SCC0 ADMODA register.
Table Result registers conversion results dual channel, continuous conversion mode Contains First channel, first conversion result Second channel, first conversion result First channel, second conversion result Second channel, second conversion result First channel, third conversion result Second channel, third conversion result First channel, fourth conversion result Second channel, fourth conversion result
Result register AD0DAT0R/L AD0DAT1R/L AD0DAT2R/L AD0DAT3R/L AD0DAT4R/L AD0DAT5R/L AD0DAT6R/L AD0DAT7R/L
3.2.1.6
Single step mode This special mode allows `single-stepping' auto scan conversion mode. combination eight input channels selected conversion. After each channel converted, interrupt generated, enabled, waits next start condition. result each channel placed result register which corresponds selected input channel (See Table used with start modes. This mode selected clearing BURST0, SCC0, SCAN0 bits ADMODA register.
3.2.2 Conversion mode selection bits
uses three bits ADMODA select conversion mode. These mode bits summarized Table 10,below. Combinations three bits, other than combinations shown, undefined.
Table Burst0 Conversion mode bits SCC0 Scan0 ADC0 conversion mode Single step Fixed channel, single Auto scan, single
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Conversion mode bits .continued SCC0 Scan0 ADC0 conversion mode Fixed channel, continuous Dual channel, continuous Auto scan, continuous
Table Burst0
3.2.3 Conversion start modes
3.2.3.1 Timer triggered start conversion started overflow Timer Once conversion started, additional Timer triggers ignored until conversion completed. Timer triggered start mode available operating modes.This mode selected TMMx ADCS01 ADCS00 bits (see Table Table 14). 3.2.3.2 Start immediately Programming this mode immediately starts conversion.This start mode available operating modes.This mode selected setting ADCS01 ADCS00 bits ADCON0 register (See Table Table 14). 3.2.3.3 Edge triggered conversion started rising falling edge P1.4. Once conversion started, additional edge triggers ignored until conversion completed. edge triggered start mode available operating modes.This mode selected setting ADCS01 ADCS00 bits ADCON0 register (See Table Table 14).
3.2.4 Stopping restarting conversions
conversion conversions stopped clearing ADCS01 ADCS00 bits ADCON0 (and also theTMM0 ADCON0 conversion started Timer triggered mode). Prior resuming conversions, user will need reset input multiplexer first user specified channel. This accomplished writing ADINS register with desired channels.
3.2.5 Boundary limits interrupt
converter both high boundary limit register. user select whether interrupt generated when conversion result within equal high boundary limits when conversion result outside boundary limits. interrupt will generated, enabled, result meets selected interrupt criteria. boundary limit disabled clearing boundary limit interrupt enable. early detection mechanism exists when interrupt criteria been selected outside boundary limits. this case, after four MSBs have been converted, these four bits compared with four MSBs boundary high registers. four MSBs conversion meet interrupt criteria (i.e.- outside boundary limits) interrupt will generated, enabled. four MSBs meet interrupt criteria, boundary limits will again compared after MSBs have been converted. boundary status register (BNDSTA0) flags channels which caused boundary interrupt.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
3.2.6 Clock divider
converter requires that internal clock source range maintain accuracy. programmable clock divider that divides clock from provided this purpose (See Table 16).
3.2.7 pins used with functions
analog input pins maybe used either digital inputs thus have digital input output function. order give best analog performance, pins that being used with should have their digital outputs inputs disabled have tolerance disconnected. Digital outputs disabled putting port pins into input-only mode described Port Configurations section (see Table 24). Digital inputs will disconnected automatically from these pins when been selected setting corresponding ADINS register corresponding been enabled When used digital these pins tolerant. selected input signals ADINS, these pins will tolerant corresponding enabled device power down. Otherwise will remain tolerant. Please refer P89LPC938 data sheet specifications.
3.2.8 Power-down Idle mode
Idle mode converter, enabled, will continue function cause device exit Idle mode when conversion completed interrupt enabled. Power-down mode Total Power-down mode, does function. enabled, will consume power. Power reduced disabling A/D.
Table Symbol Reset Table Control register (ADCON0 address 97h) allocation ENBI0 ENADCI0 TMM0 EDGE0 ADCI0 ENADC0 ADCS01 ADCS00
Control register (ADCON0 address 97h) description Symbol Description Timer Trigger Mode when TMM0 Conversions starts overflow Timer When TMM0 start occurs (stop mode). Immediate Start Mode. Conversion starts immediately. Edge Trigger Mode. Conversion starts when edge condition defined EDGE0 occurs. ADCS01,ADCS00 start mode bits, below.
ENADC0 ADCI0 EDGE0
Enable ADC0. When enables ADC0, when powerdown. Conversion complete Interrupt when conversion multiple conversions completed. Cleared software. edge conversion start triggered falling edge P1.4 when EDGE0 while edge-triggered mode. edge conversion start triggered rising edge P1.4 when EDGE0 while edge-triggered mode.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table
Control register (ADCON0 address 97h) description .continued Symbol TMM0 ENADCI0 ENBI0 Description Timer Trigger Mode Selects either stop mode (TMM0 timer trigger mode (TMM0 when ADCS01 ADCS00 bits Enable Conversion complete Interrupt When set, will cause interrupt ADCI0 flag interrupt enabled. Enable boundary interrupt When set, will cause interrupt boundary interrupt flag, BNDI0, interrupt enabled.
Table Symbol Reset Table
Mode register (ADMODA address 0C0h) allocation BNDI0 BURST0 SCC0 SCAN0
Mode register (ADMODA address 0C0h) description Symbol SCAN0 SCC0 BURST0 BNDI0 Description Reserved. When selects single conversion mode (auto scan fixed channel). When selects fixed dual channel, continuous conversion modes. When selects auto scan, continuous conversion mode. ADC0 boundary interrupt flag. When set, indicates that converted result inside/outside range defined ADC0 boundary registers.
Table Symbol Reset Table
Mode register (ADMODB address A1h) allocation CLK2 CLK1 CLK0 INBND0 BSA0 FCIIS
Mode register (ADMODB address A1h) description Symbol FCIIS Description Four conversion intermediate interrupt select. When will generate interrupt after four conversions fixed channel dual channel continuous modes. scan modes setting this will generate interrupt after fourth conversion number channels selected greater than four. ADC0 Boundary Select All. When BNDI0 will ADC0 input exceeds boundary limits. When BNDI0 will only AD00 input exceeded boundary limits. Reserved
BSA0
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table
Mode register (ADMODB address A1h) description .continued Symbol INBND0 Description When generates interrupt conversion result inside equal boundary limits. When cleared generates interrupt conversion result outside boundary limits.
CLK2,CLK1,CLK0 Clock divider produce clock. Divides CCLK value indicated below. resulting clock should less. minimum required maintain accuracy. CLK2:0 Divisor
Table Symbol Reset Table Table Symbol Reset
Input select (ADINS address A3h) allocation AIN07 AIN06 AIN05 AIN04 AIN03 AIN02 AIN01 AIN00
Input select (ADINS address A3h) description Symbol AIN00 AIN01 AIN02 AIN03 AIN04 AIN05 AIN06 AIN07 Description When set, enables AD00 sampling conversion. When set, enables AD01 sampling conversion. When set, enables AD02 sampling conversion. When set, enables AD03 sampling conversion. When set, enables AD04 sampling conversion. When set, enables AD05 sampling conversion. When set, enables AD06 sampling conversion. When set, enables AD07 sampling conversion.
Boundary status register (BNDSTA0 address FFEDh) allocation BST07 BST06 BST05 BST04 BST03 BST02 BST01 BST00
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table
Boundary status register (BNDSTA0 address FFEDh) description Symbol BST00 BST01 BST02 BST03 BST04 BST05 BST06 BST07 Description When set, indicates that conversion result AD00 inside/outside boundary limits. This cleared software writing this bit. When set, indicates that conversion result AD01 inside/outside boundary limits. This cleared software writing this bit. When set, indicates that conversion result AD02 inside/outside boundary limits. This cleared software writing this bit. When set, indicates that conversion result AD03 inside/outside boundary limits. This cleared software writing this bit. When set, indicates that conversion result AD04 inside/outside boundary limits. This cleared software writing this bit. When set, indicates that conversion result AD05 inside/outside boundary limits. This cleared software writing this bit. When set, indicates that conversion result AD06 inside/outside boundary limits. This cleared software writing this bit. When set, indicates that conversion result AD07 inside/outside boundary limits. This cleared software writing this bit.
Interrupts
P89LPC938 uses four priority level interrupt structure. This allows great flexibility controlling handling P89LPC938's interrupt sources. Each interrupt source individually enabled disabled setting clearing interrupt enable registers IEN0 IEN1. IEN0 register also contains global enable bit, which enables interrupts. Each interrupt source individually programmed four priority levels setting clearing bits interrupt priority registers IP0, IP0H, IP1, IP1H. interrupt service routine progress interrupted higher priority interrupt, another interrupt same lower priority. highest priority interrupt service cannot interrupted other interrupt source. requests different priority levels received simultaneously, request higher priority level serviced. requests same priority level pending start instruction cycle, internal polling sequence determines which request serviced. This called arbitration ranking. Note that arbitration ranking only used pending requests same priority level. Table summarizes interrupt sources, flag bits, vector addresses, enable bits, priority bits, arbitration ranking, whether each interrupt wake-up from Power-down mode.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Interrupt priority structure
Table IPxH Interrupt priority level Interrupt priority level Level (lowest priority) Level Level Level Priority bits
There four SFRs associated with four interrupt levels: IP0, IP0H, IP1, IP1H. Every interrupt bits IPxH therefore assigned four levels, shown Table P89LPC938 external interrupt inputs addition Keypad Interrupt function. interrupt inputs identical those present standard 80C51 microcontrollers. These external interrupts programmed level-triggered edge-triggered clearing setting Register TCON. external interrupt triggered level detected INTn pin. external interrupt edge triggered. this mode consecutive samples INTn show high level cycle level next cycle, interrupt request flag TCON set, causing interrupt request. Since external interrupt pins sampled once each machine cycle, input high level should held least machine cycle ensure proper sampling. external interrupt edge-triggered, external source hold request high least machine cycle, then hold least machine cycle. This ensure that transition detected that interrupt request flag set. automatically cleared when service routine called. external interrupt level-triggered, external source must hold request active until requested interrupt generated. external interrupt still asserted when interrupt service routine completed, another interrupt will generated. necessary clear interrupt flag when interrupt level sensitive, simply tracks input level. external interrupt been programmed level-triggered enabled when P89LPC938 into Power-down mode Idle mode, interrupt occurrence will cause processor wake-up resume operation. Refer Section "Power reduction modes" details.
External Interrupt glitch suppression
Most P89LPC938 pins have glitch suppression circuits reject short glitches (please refer P89LPC938 data sheet, Dynamic characteristics glitch filter specifications). However, pins SDA/INT0/P1.3 SCL/T0/P1.2 have glitch suppression circuits. Therefore, INT1 glitch suppression while INT0 does not.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table
Summary interrupts Interrupt flag bit(s) WDOVF/RTCF KBIF CMF1/CMF2 SPIF ADCI0, BNDI1 002Bh 0053h 0033h 003Bh 0043h 004Bh 005Bh 006Bh 0073h 0083h (IEN0.5) EWDRT (IEN0.6) EI2C (IEN1.0) EKBI (IEN1.1) (IEN1.2) ESPI (IEN1.3) ECCU(IEN1.4) (IEN1.6) (IEN1.7) EADC (IEN2.1) IP0H.5, IP0.5 IP0H.6, IP0.6 IP0H.0, IP0.0 IP0H.0, IP0.0 IP0H.0, IP0.0 IP1H.3, IP1.3 IP1H.4, IP1.4 IP0H.0, IP0.0 IP1H.7, IP1.7 IP2H.1, IP2.1 (lowest) Vector address 0003h 000Bh 0013h 001Bh 0023h Interrupt enable bit(s) (IEN0.0) (IEN0.1) (IEN0.2) (IEN0.3) ES/ESR (IEN0.4) Interrupt priority IP0H.0, IP0.0 IP0H.1, IP0.1 IP0H.2, IP0.2 IP0H.3, IP0.3 IP0H.4, IP0.4 Arbitration ranking (highest) Powerdown wake-up
Description
External interrupt Timer interrupt External interrupt Timer interrupt Serial port Serial port Brownout detect Watchdog timer/Real-time clock interrupt interrupt Comparators interrupts interrupt Capture/Compare Unit Serial port Data EEPROM converter
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
RTCF ERTC (RTCCON.1) WDOVF KBIF EKBI EWDRT CMF2 CMF1 (IE0.7) RI/RI ES/ESR EI2C SPIF ESPI interrupt(1) ECCU interrupt
wake-up power-down)
EEIF EIEE ENADCI0 ADCI0 ENBI1 BNDI1 EADC
002aab104
Section "Capture/Compare Unit (CCU)".
Interrupt sources, interrupt enables, power-down wake-up sources.
ports
P89LPC938 four ports: Port Port Port Port Ports 8-bit ports Port 2-bit port. exact number pins available depends upon clock reset options chosen (see Table 23).
Table Number pins available Reset option Number pins
Clock source On-chip oscillator watchdog oscillator
external reset (except during power External supported
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Number pins available .continued Reset option Number pins
Table
Clock source External clock input
external reset (except during power External supported[1]
Low/medium/high speed oscillator external reset (except during power (external crystal resonator) External supported[1]
Required clock frequency above MHz.
Port configurations
three port pins P89LPC938 configured software four types pin-by-pin basis, shown Table These are: quasi-bidirectional (standard 80C51 port outputs), push-pull, open drain, input-only. configuration registers each port select output type each port pin. P1.5 (RST) only input cannot configured. P1.2 (SCL/T0) P1.3 (SDA/INT0) only configured either input-only open drain.
Table PxM1.y Port output configuration settings PxM2.y Port output mode Quasi-bidirectional Push-pull Input only (high-impedance) Open drain
Quasi-bidirectional output configuration
Quasi-bidirectional outputs used both input output without need reconfigure port. This possible because when port outputs logic high, weakly driven, allowing external device pull low. When driven low, driven strongly able sink large current. There three pull-up transistors quasi-bidirectional output that serve different purposes. these pull-ups, called `very weak' pull-up, turned whenever port latch contains logic This very weak pull-up sources very small current that will pull high left floating. second pull-up, called `weak' pull-up, turned when port latch contains logic itself also logic level. This pull-up provides primary source current quasi-bidirectional that outputting this pulled external device, weak pull-up turns off, only very weak pull-up remains order pull under these conditions, external device sink enough current overpower weak pull-up pull port below input threshold voltage.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
third pull-up referred `strong' pull-up. This pull-up used speed low-to-high transitions quasi-bidirectional port when port latch changes from logic logic When this occurs, strong pull-up turns clocks quickly pulling port high. quasi-bidirectional port configuration shown Figure Although P89LPC938 device most pins V-tolerant. applied configured quasi-bidirectional mode, there will current flowing from causing extra power consumption. Therefore, applying pins configured quasi-bidirectional mode discouraged. quasi-bidirectional port Schmitt-triggered input that also glitch suppression circuit (Please refer P89LPC938 data sheet, Dynamic characteristics glitch filter specifications).
CLOCK DELAY
strong
very weak
weak
PORT port latch data
input data glitch rejection
002aaa914
Quasi-bidirectional output.
Open drain output configuration
open drain output configuration turns pull-ups only drives pull-down transistor port when port latch contains logic used logic output, port configured this manner must have external pull-up, typically resistor tied VDD. pull-down this mode same quasi-bidirectional mode. open drain port configuration shown Figure open drain port Schmitt-triggered input that also glitch suppression circuit. Please refer P89LPC938 data sheet, Dynamic characteristics glitch filter specifications.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
PORT port latch data
input data glitch rejection
002aaa915
Open drain output.
Input-only configuration
input port configuration shown Figure Schmitt-triggered input that also glitch suppression circuit. (Please refer P89LPC938 data sheet, Dynamic characteristics glitch filter specifications).
input data glitch rejection
PORT
002aaa916
Input only.
Push-pull output configuration
push-pull output configuration same pull-down structure both open drain quasi-bidirectional output modes, provides continuous strong pull-up when port latch contains logic push-pull mode used when more source current needed from port output. push-pull port configuration shown Figure push-pull port Schmitt-triggered input that also glitch suppression circuit. (Please refer P89LPC938 data sheet, Dynamic characteristics glitch filter specifications).
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
strong
port latch data
PORT
input data
glitch rejection
002aaa917
Push-pull output.
Port Analog Comparator functions
P89LPC938 incorporates Analog Comparators. order give best analog performance minimize power consumption, pins that being used analog functions must have both digital outputs digital inputs disabled. Digital outputs disabled putting port pins into input-only mode described Port Configurations section (see Figure 12). Digital inputs Port disabled through PT0AD register. Bits through this register correspond pins P0.1 through P0.5 Port respectively. Setting corresponding PT0AD disables that pin's digital input. Port bits that have their digital inputs disabled will read instruction that accesses port. reset, PT0AD bits through default logic enable digital functions.
Additional port features
After power-up, pins Input-Only mode. Please note that this different from LPC76x series devices.
After power-up, pins except P1.5, configured software. P1.5 input only. Pins P1.2 P1.3 configurable either input-only
open drain. Every output P89LPC938 been designed sink typical drive current. However, there maximum total output current ports which must exceeded. Please refer P89LPC938 data sheet detailed specifications. ports pins that function output have slew rate controlled outputs limit noise generated quickly switching output signals. slew rate factory-set approximately rise fall times.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Port output configuration Configuration bits PxM1.y PxM2.y P0M2.0 P0M2.1 P0M2.2 P0M2.3 P0M2.4 P0M2.5 P0M2.6 P0M2.7 P1M2.0 P1M2.1 P1M2.2 P1M2.3 P1M2.4 P1M2.5 P1M2.6 P1M2.7 P1M2.0 P1M2.1 P1M2.2 P1M2.3 P1M2.4 P1M2.5 P1M2.6 P1M2.7 P3M2.0 P3M2.1 Alternate usage KBIO, CMP2, AD05 KBI1, CIN2B, AD00 Refer Section "Port KBI2, CIN2A, AD01 Analog Comparator functions" usage analog inputs. KBI3, CIN1B, AD02 KBI4, CIN1A, AD03 KBI5, CMPREF KBI6, CMP1 KBI7, INTO, INT1 OCC, AD04 ICB, AD07 OCD, AD06 MOSI MISO SPICLK CLKOUT, XTAL2 XTAL1 Input-only open-drain input-only open-drain Notes P0M1.0 P0M1.1 P0M1.2 P0M1.3 P0M1.4 P0M1.5 P0M1.6 P0M1.7 P1M1.0 P1M1.1 P1M1.2 P1M1.3 P1M1.4 P1M1.5 P1M1.6 P1M1.7 P1M1.0 P1M1.1 P1M1.2 P1M1.3 P1M1.4 P1M1.5 P1M1.6 P1M1.7 P3M1.0 P3M1.1
Table Port P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7 P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 P2.6 P2.7 P3.0 P3.1
Power monitoring functions
P89LPC938 incorporates power monitoring functions designed prevent incorrect operation during initial power-on power loss reduction during operation. This accomplished with hardware functions: Power-on Detect Brownout Detect.
Brownout detection
Brownout Detect function determines power supply voltage drops below certain level. default operation Brownout Detection cause processor reset. However, alternatively configured generate interrupt setting (PCON.4) (IEN0.5) bit.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Enabling disabling Brownout Detection done BOPD (PCON.5) bit, field PMOD1/PMOD0 (PCON[1:0]) user configuration (UCFG1.5). unprogrammed state, brownout disabled regardless PMOD1/PMOD0 BOPD. programmed state, PMOD1/PMOD0 BOPD will used determine whether Brownout Detect will disabled enabled. PMOD1/PMOD0 used select power reduction mode. PMOD1/PMOD0 `11', circuitry Brownout Detection disabled lowest power consumption. BOPD defaults logic indicating brownout detection enabled power-on programmed. Brownout Detection enabled, brownout condition occurs when falls below Brownout trip voltage, (see P89LPC938 data sheet, Static characteristics), negated when rises above VBO. P89LPC938 device operate with power supply that below should left unprogrammed state that device operate otherwise continuous brownout reset prevent device from operating. Brownout Detect enabled (BOE programmed, PMOD1/PMOD0 `11', BOPD (RSTSRC.5) will when brownout detected, regardless whether reset interrupt enabled. will stay until cleared software writing logic bit. Note that unprogrammed, meaningless. programmed, initial power-on occurs, will addition power-on flag (POF RSTSRC.4). correct activation Brownout Detect, certain rise fall times must observed. Please data sheet specifications.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table (UCFG1.5) (erased) 1(program med)
Brownout options[1] PMOD1/ PMOD0 (PCON[1:0]) (total power-down) BOPD (PCON.5) (PCON.4) (IEN0.5) (IEN0.7) Description
Brownout disabled. operating range Brownout disabled. operating range However, BOPD default logic upon power-up. Brownout reset enabled. operating range Upon brownout reset, (RSTSRC.5) will indicate reset source. cleared writing logic bit. Brownout interrupt enabled. operating range Upon brownout interrupt, (RSTSRC.5) will set. cleared writing logic bit. Both brownout reset interrupt disabled. operating range However, (RSTSRC.5) will when falls Brownout Detection trip point. cleared writing logic bit.
(any mode (brownout other than total detect power-down) power-down)
(brownout (brownout detect active) detect generates reset)
(brownout (enable detect brownout generates interrupt) interrupt)
(global interrupt enable)
Cannot used with operation above this requires above.
Power-on detection
Power-On Detect function similar Brownout Detect, designed work power initially comes before power supply voltage reaches level where Brownout Detect function. flag (RSTSRC.4) indicate initial power-on condition. flag will remain until cleared software writing logic bit. Note that (UCFG1.5) programmed, (RSTSRC.5) will when set. unprogrammed, meaningless.
Power reduction modes
P89LPC938 supports three different power reduction modes determined bits PCON[1:0] (see Table 27).
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table
Power reduction modes
PMOD1 PMOD0 Description (PCON.1) (PCON.0) Normal mode (default) power reduction. Idle mode. Idle mode leaves peripherals running order allow them activate processor when interrupt generated. enabled interrupt source reset terminate Idle mode. Power-down mode: Power-down mode stops oscillator order minimize power consumption. P89LPC938 exits Power-down mode reset, certain interrupts external pins INT0/INT1, brownout Interrupt, keyboard, Real-time Clock/System Timer), watchdog, comparator trips. Waking reset only enabled corresponding reset enabled, waking interrupt only enabled corresponding interrupt enabled (IEN0.7) set. External interrupts should programmed level-triggered mode used exit Power-down mode. Power-down mode internal oscillator disabled unless both oscillator been selected system clock enabled. Power-down mode, power supply voltage reduced keep-alive voltage VRAM. This retains contents point where Power-down mode entered. contents guaranteed after been lowered VRAM, therefore recommended wake-up processor Reset this situation. must raised within operating range before Power-down mode exited. When processor wakes from Power-down mode, will start oscillator immediately begin execution when oscillator stable. Oscillator stability determined counting 1024 clocks after start-up when crystal oscillator configurations used, clocks after start-up internal external clock input configurations. Some chip functions continue operate draw power during Power-down mode, increasing total power used during power-down. These include:
Brownout Detect Watchdog Timer WDCLK (WDCON.0) logic Comparators (Note: Comparators powered down separately with PCONA.5 logic comparators disabled); Real-time Clock/System Timer (and crystal oscillator circuitry this block using unless RTCPD, i.e., PCONA.7 logic
Total Power-down mode: This same Power-down mode except that Brownout Detection circuitry voltage comparators also disabled conserve additional power. Note that brownout reset interrupt will occur. Voltage comparator interrupts Brownout interrupt cannot used wake-up source. internal oscillator disabled unless both oscillator been selected system clock enabled. following wake-up options supported:
Watchdog Timer WDCLK (WDCON.0) logic Could generate Interrupt Reset, either wake device External interrupts INTO/INT1 (when programmed level-triggered mode). Keyboard Interrupt Real-time Clock/System Timer (and crystal oscillator circuitry this block using unless RTCPD, i.e., PCONA.7 logic
Note: Using internal RC-oscillator clock during power-down result relatively high power consumption. Lower power consumption achieved using external frequency clock when Real-time Clock running during power-down.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table Symbol Reset Table
Power Control register (PCON address 87h) allocation SMOD1 SMOD0 BOPD PMOD1 PMOD0
Power Control register (PCON address 87h) description Symbol PMOD0 PMOD1 BOPD General Purpose Flag read written user software, effect operation General Purpose Flag read written user software, effect operation Brownout Detect Interrupt Enable. When logic Brownout Detection will generate interrupt. When logic Brownout Detection will cause reset Brownout Detect power-down. When logic Brownout Detect powered down therefore disabled. When logic Brownout Detect enabled. (Note: BOPD must logic before programming erasing commands issued. Otherwise these commands will aborted.) Framing Error Location: Description Power Reduction Mode (see Section 6.3)
SMOD0
SMOD1
When logic SCON accessed UART. When logic SCON accessed framing error status (FE) UART
Double Baud Rate serial port (UART) when Timer used baud rate source. When logic Timer overflow rate supplied UART. When logic Timer overflow rate divided before being supplied UART. (See Section
Table Symbol Reset Table
Power Control register (PCONA address B5h) allocation RTCPD DEEPD VCPD ADPD I2PD SPPD CCUPD
Power Control register (PCONA address B5h) description Symbol CCUPD Description Compare/Capture Unit (CCU) power-down: When logic internal clock disabled. Note that either Power-down mode Total Power-down mode, clock will disabled regardless this bit. (Note: This overridden CCUDIS FCFG1. CCUDIS powered down.) Serial Port (UART) power-down: When logic internal clock UART disabled. Note that either Power-down mode Total Power-down mode, UART clock will disabled regardless this bit. power-down: When logic internal clock disabled. Note that either Power-down mode Total Power-down mode, clock will disabled regardless this bit. power-down: When logic internal clock I2C-bus disabled. Note that either Power-down mode Total Power-down mode, clock will disabled regardless this bit.
SPPD
I2PD
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table
Power Control register (PCONA address B5h) description .continued Symbol ADPD VCPD Description converter power-down: When logic powered down. Analog Voltage Comparators power-down: When logic voltage comparators powered down. User must disable voltage comparators prior setting this bit. Data EEPROM power-down: When logic Data EEPROM powered down. Note that either Power-down mode Total Power-down mode, Data EEPROM will powered down regardless this bit. Real-time Clock power-down: When logic internal clock Real-time Clock disabled.
DEEPD
RTCPD
Reset
P1.5/RST function either active reset input digital input, P1.5. (Reset Enable) UCFG1, when enables external reset input function P1.5. When cleared, P1.5 used input pin. Note: During power-on sequence, selection overridden this will always functions reset input. external circuit connected this should hold this during Power-on sequence this will keep device reset. After power-on this input will function either external reset input digital input defined bit. Only power-on reset will temporarily override selection defined bit. Other sources reset will override bit. Note: During power cycle, must fall below VPOR (see P89LPC938 data sheet, Static characteristics) before power reapplied, order ensure power-on reset. Note: When using oscillator frequency above MHz, reset input function P1.5 must enabled. external circuit required hold device reset powerup until reached specified level. When system power removed will fall below minimum specified operating voltage. When using oscillator frequency above MHz, some applications, external brownout detect circuit required hold device reset when falls below minimum specified operating voltage. Reset triggered from following sources (see Figure 14):
External reset (during power-on user configured UCFG1); Power-on Detect; Brownout Detect; Watchdog Timer; Software reset; UART break detect reset.
every reset source, there flag Reset Register, RSTSRC. user read this register determine most recent reset source. These flag bits cleared software writing logic corresponding bit. More than flag set:
During power-on reset, both other flag bits
cleared.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
other reset, previously flag bits that have been cleared will remain
set.
(UCFG1.6) WDTE (UCFG1.7) watchdog timer reset software reset SRST (AUXR1.3) chip reset power-on detect UART break detect EBRR (AUXR1.6) brownout detect reset BOPD (PCON.5)
002aaa918
Block diagram reset. Table Symbol Reset[1]
Reset Sources register (RSTSRC address DFh) allocation R_BK R_WD R_SF R_EX
value shown power-on reset. Other reset sources will their corresponding bits.
Table R_EX R_SF R_WD R_BK
Reset Sources register (RSTSRC address DFh) description external reset Flag. When this logic indicates external reset. Cleared software writing logic Power-on reset. still asserted after Power-on reset over, R_EX will set. software reset Flag. Cleared software writing logic Power-on reset Watchdog Timer reset flag. Cleared software writing logic Power-on reset.(NOTE: UCFG1.7 must break detect reset. break detect occurs EBRR (AUXR1.6) logic system reset will occur. This indicate that system reset caused break detect. Cleared software writing logic Power-on reset. Power-on Detect Flag. When Power-on Detect activated, flag indicate initial power-up condition. flag will remain until cleared software writing logic bit. (Note: Power-on reset, both this will while other flag bits cleared.) Brownout Detect Flag. When Brownout Detect activated, this set. will remain until cleared software writing logic bit. (Note: Power-on reset, both this will while other flag bits cleared.) reserved
Symbol Description
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Reset vector
Following reset, P89LPC938 will fetch instructions from either address 0000h Boot address. Boot address formed using Boot Vector high byte address byte address 00h. Boot address will used UART break reset occurs non-volatile Boot Status (BOOTSTAT.0) device been forced into mode. Otherwise, instructions will fetched from address 0000H.
Timers
P89LPC938 general-purpose counter/timers which upward compatible with 80C51 Timer Timer Both configured operate either timers event counters (see Table 35). option automatically toggle upon timer overflow been added. `Timer' function, timer incremented every PCLK. `Counter' function, register incremented response 1-to-0 transition corresponding external input T1). external input sampled once during every machine cycle. When high during cycle next cycle, count incremented. count value appears register during cycle following which transition detected. Since takes machine cycles (four clocks) recognize 1-to-0 transition, maximum count rate clock frequency. There restrictions duty cycle external input signal, ensure that given level sampled least once before changes, should held least full machine cycle. `Timer' `Counter' function selected control bits TnC/T Timers respectively) Special Function Register TMOD. Timer Timer have five operating modes (modes which selected bit-pairs (TnM1, TnM0) TMOD TnM2 TAMOD. Modes same both Timers/Counters. Mode different. operating modes described later this section.
Table Symbol Reset Table T0M0 T0M1 T0C/T Timer/Counter Mode register (TMOD address 89h) allocation T1GATE T1C/T T1M1 T1M0 T0GATE T0C/T T0M1 T0M0
Timer/Counter Mode register (TMOD address 89h) description Description Mode Select Timer These bits used with T0M2 TAMOD register determine Timer mode (see Table 37). Timer Counter selector Timer Cleared Timer operation (input from CCLK). Counter operation (input from input pin).
Symbol
T0GATE Gating control Timer When set, Timer/Counter enabled only while INT0 high control set. When cleared, Timer enabled when control set.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table T1M0 T1M1 T1C/T
Timer/Counter Mode register (TMOD address 89h) description .continued Description Mode Select Timer These bits used with T1M2 TAMOD register determine Timer mode (see Table 37). Timer Counter Selector Timer Cleared Timer operation (input from CCLK). Counter operation (input from input pin).
Symbol
T1GATE Gating control Timer When set, Timer/Counter enabled only while INT1 high control set. When cleared, Timer enabled when control set. Timer/Counter Auxiliary Mode register (TAMOD address 8Fh) allocation T1M2 T0M2
Table Symbol Reset Table T0M2
Timer/Counter Auxiliary Mode register (TAMOD address 8Fh) description Description Mode Select Timer These bits used with T0M2 TAMOD register determine Timer mode (see Table 37). reserved Mode Select Timer These bits used with T1M2 TAMOD register determine Timer mode (see Table 37). following timer modes selected timer mode bits TnM[2:0]: 8048 Timer `TLn' serves 5-bit prescaler. (Mode 16-bit Timer/Counter `THn' `TLn' cascaded; there prescaler.(Mode 8-bit auto-reload Timer/Counter. holds value which loaded into when overflows. (Mode Timer dual 8-bit Timer/Counter this mode. 8-bit Timer/Counter controlled standard Timer control bits. 8-bit timer only, controlled Timer control bits (see text). Timer this mode stopped. (Mode Reserved. User must configure this mode. Reserved. User must configure this mode. mode (see Section 8.5). Reserved. User must configure this mode.
Symbol
T1M2
reserved
Mode
Putting either Timer into Mode makes look like 8048 Timer, which 8-bit Counter with divide-by-32 prescaler. Figure shows Mode operation. this mode, Timer register configured 13-bit register. count rolls over from sets Timer interrupt flag TFn. count input enabled Timer when either TnGATE INTn (Setting TnGATE allows Timer controlled external input INTn, facilitate pulse width measurements). control Special Function Register TCON (Table 39). TnGATE TMOD register.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
13-bit register consists bits lower bits TLn. upper bits indeterminate should ignored. Setting flag (TRn) does clear registers. Mode operation same Timer Timer Figure There different GATE bits, Timer (TMOD.7) Timer (TMOD.3).
Mode
Mode same Mode except that bits timer register (THn TLn) used. Figure
Mode
Mode configures Timer register 8-bit Counter (TLn) with automatic reload, shown Figure Overflow from only sets TFn, also reloads with contents THn, which must preset software. reload leaves unchanged. Mode operation same Timer Timer
Mode
When Timer Mode stopped. effect same setting Timer Mode establishes separate 8-bit counters. logic Mode Timer shown Figure uses Timer control bits: T0C/T, T0GATE, TR0, INT0, TF0. locked into timer function (counting machine cycles) takes over from Timer Thus, controls `Timer interrupt. Mode provided applications that require extra 8-bit timer. With Timer Mode P89LPC938 device look like three Timer/Counters. Note: When Timer Mode Timer turned switching into Mode still used serial port baud rate generator, application requiring interrupt.
Mode
this mode, corresponding timer changed with full period timer clocks (see Figure 19). structure similar mode except that:
Timers respectively) cleared hardware; period THn, should between 254, and; high period always 256-THn. Loading with will force high, loading with will force low.
Note that interrupt still enabled high transition TFn, that still cleared software like other modes.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table Symbol Reset Table
Timer/Counter Control register (TCON) address 88h) allocation
Timer/Counter Control register (TCON address 88h) description Description Interrupt Type control bit. Set/cleared software specify falling edge/low level triggered external interrupts. Interrupt Edge flag. hardware when external interrupt edge detected. Cleared hardware when interrupt processed, software. Interrupt Type control bit. Set/cleared software specify falling edge/low level triggered external interrupts. Interrupt Edge flag. hardware when external interrupt edge detected. Cleared hardware when interrupt processed, software. Timer control bit. Set/cleared software turn Timer/Counter on/off. Timer overflow flag. hardware Timer/Counter overflow. Cleared hardware when processor vectors interrupt routine, software. (except mode where cleared hardware) Timer control bit. Set/cleared software turn Timer/Counter on/off Timer overflow flag. hardware Timer/Counter overflow. Cleared hardware when interrupt processed, software (except mode above, when cleared hardware).
Symbol
PCLK
control (5-bits) (8-bits)
overflow interrupt
toggle gate INTn ENTn
002aaa919
Timer/counter Mode (13-bit counter).
PCLK
control (8-bits) (8-bits)
overflow interrupt
toggle gate INTn ENTn
002aaa920
Timer/counter mode (16-bit counter).
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
PCLK
control (8-bits) reload
overflow interrupt
toggle
gate INTn (8-bits)
ENTn
002aaa921
Timer/counter Mode (8-bit auto-reload).
PCLK
control (8-bits)
overflow toggle interrupt
gate INT0 ENT0 (AUXR1.4)
(P1.2 open drain)
osc/2 control
(8-bits)
overflow interrupt
toggle (P0.7) ENT1 (AUXR1.5)
002aaa922
Timer/counter Mode (two 8-bit counters).
PCLK control (8-bits)
overflow interrupt
reload falling transition (256 THn) rising transition
toggle gate INTn (8-bits)
ENTn
002aaa923
Timer/counter mode (PWM auto-reload).
Timer overflow toggle output
Timers configured automatically toggle port output whenever timer overflow occurs. same device pins that used count inputs outputs also used timer toggle outputs. This function enabled
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
control bits ENT0 ENT1 AUXR1 register, apply Timer Timer respectively. port outputs will logic prior first timer overflow when this mode turned order this mode function, must cleared selecting PCLK clock source timer.
Real-time clock system timer
P89LPC938 simple Real-time Clock/System Timer that allows user continue running accurate timer while rest device powered down. Real-time Clock interrupt wake-up source (see Figure 20). Real-time Clock 23-bit down counter. clock source this counter either clock (CCLK) XTAL1-2 oscillator, provided that XTAL1-2 oscillator being used clock. XTAL1-2 oscillator used clock, then will CCLK clock source regardless state RTCS1:0 RTCCON register. There three SFRs used RTC: RTCCON Real-time Clock control. RTCH Real-time Clock counter reload high (bits 15). RTCL Real-time Clock counter reload (bits Real-time clock system timer enabled setting RTCEN (RTCCON.0) bit. Real-time Clock 23-bit down counter (initialized when RTCEN that comprised 7-bit prescaler 16-bit loadable down counter. When RTCEN written with logic counter first loaded with (RTCH, RTCL, `1111111') will count down. When reaches 0's, counter will reloaded again with (RTCH, RTCL, `1111111') flag RTCF (RTCCON.7) will set.
power-on reset
RTCH
RTCL
RESET XTAL2 XTAL1
RELOAD UNDERFLOW FREQUENCY MEDIUM FREQUENCY HIGH FREQUENCY CCLK internal oscillators RTCS1 RTCS2 select
002aaa924
7-BIT PRESCALER ÷128
23-BIT DOWN COUNTER
wake-up from power-down RTCF Interrupt enabled (shared with WDT) underflow flag ERTC RTCEN enable
Real-time clock/system timer block diagram.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Real-time clock source
RTCS1/RTCS0 (RTCCON[6:5]) used select clock source either Internal oscillator internal oscillator used clock. internal crystal oscillator external clock input XTAL1 used clock, then will CCLK clock source.
Changing RTCS1/RTCS0
RTCS1/RTCS0 cannot changed currently enabled (RTCCON.0 Setting RTCEN updating RTCS1/RTCS0 done single write RTCCON. However, RTCEN this must first cleared before updating RTCS1/RTCS0.
Real-time clock interrupt/wake-up
ERTC (RTCCON.1), EWDRT (IEN1.0.6) (IEN0.7) logic RTCF used interrupt source. This interrupt vector shared with watchdog timer. also source wake-up device.
Reset sources affecting Real-time clock
Only power-on reset will reset Real-time Clock associated SFRs their default state.
Table FOSC2:0 Real-time Clock/System Timer clock sources RCCLK RTCS1:0 Internal oscillator Medium frequency crystal /DIVM Medium frequency crystal Internal oscillator Internal oscillator Medium frequency crystal Medium frequency crystal /DIVM High frequency crystal /DIVM High frequency crystal Internal oscillator clock source High frequency crystal clock source High frequency crystal /DIVM
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Real-time Clock/System Timer clock sources .continued RCCLK RTCS1:0 Internal oscillator Internal oscillator Medium frequency crystal /DIVM frequency crystal Internal oscillator /DIVM High frequency crystal Medium frequency crystal frequency crystal Internal oscillator High frequency crystal Watchdog oscillator Medium frequency crystal /DIVM frequency crystal Watchdog oscillator /DIVM High frequency crystal Medium frequency crystal frequency crystal Internal oscillator undefined undefined External clock input undefined undefined External clock input /DIVM Internal oscillator Internal oscillator High frequency crystal frequency crystal /DIV frequency crystal Internal oscillator clock source frequency crystal clock source frequency crystal /DIVM
Table FOSC2:0
External clock input /DIVM External clock input Internal oscillator
Internal oscillator
Table Symbol Reset
Real-time Clock Control register (RTCCON address D1h) allocation RTCF RTCS1 RTCS0 ERTC RTCEN
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Real-time Clock Control register (RTCCON address D1h) description Description Real-time Clock enable. Real-time Clock will enabled this logic Note that this will power-down Real-time Clock. RTCPD (PCONA.7) set, will power-down disable this block regardless RTCEN. Real-time Clock interrupt enable. Real-time Clock shares same interrupt watchdog timer. Note that user configuration WDTE (UCFG1.7) logic watchdog timer enabled generate interrupt. Users read RTCF (RTCCON.7) determine whether Real-time Clock caused interrupt. reserved Real-time Clock source select (see Table 40). Real-time Clock Flag. This logic when 23-bit Real-time Clock reaches count logic cleared software.
Table
Symbol RTCEN
ERTC
RTCS0 RTCS1 RTCF
Capture/Compare Unit (CCU)
This unit features:
16-bit timer with 16-bit reload overflow Selectable clock (CCUCLK), with prescaler divide clock source integer
between 1024.
Four Compare outputs with selectable polarity Symmetrical Asymmetrical selection Seven interrupts with common interrupt vector (one Overflow, 2xCapture,
4xCompare), safe 16-bit read/write shadow registers.
Capture inputs with event counter digital noise rejection filter
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
16-BIT SHADOW REGISTER TOR2H TOR2L
16-BIT SHADOW REGISTER OCRxH OCRxL
16-BIT COMPARE VALUE
16-BIT TIMER RELOAD REGISTER OVERFLOW/ UNDERFLOW
TIMER COMPARE
COMPARE CHANNELS
FCOx
16-BIT UP/DOWN TIMER WITH RELOAD
16-BIT CAPTURE REGISTER ICRxH, EVENT COUNTER
ICNFx NOISE FILTER
ICESx EDGE SELECT
10-BIT DIVIDER INTERRUPT FLAG TICF2x CAPTURE CHANNELS
4-BIT DIVIDER
002aab009
Capture Compare Unit block diagram.
10.1 Clock (CCUCLK)
runs CCUCLK, which either PCLK basic timer mode output (see Figure 21). designed clock source between that multiplied produce CCUCLK between mode (asymmetrical symmetrical). contains 4-bit divider (PLLDV3:0 bits TCR21 register) help divide PCLK into frequency between
10.2 Clock prescaling
This CCUCLK further divided down prescaler. prescaler implemented 10-bit free-running counter with programmable reload overflow. Writing value prescaler will cause prescaler restart.
10.3 Basic timer operation
Timer free-running up/down counter counting pace determined prescaler. timer started setting Mode Select bits TMOD21 TMOD20 Control Register (TCR20) shown table TCR20 register description (Table 47). direction control bit, TDIR2, determines direction count. TDIR2 Count TDIR2 Count down. timer counting direction changed while counter running, count sequence will reversed CCUCLK cycle following write TDIR2. timer written read time newly-written values will take effect when prescaler overflows. timer accessible through SFRs, TL2(low byte) TH2(high byte). third 16-bit SFR, TOR2H:TOR2L, determines overflow reload value. TL2, TOR2H, TOR2L will after reset
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Up-counting: When timer contents FFFFH, next CCUCLK cycle will counter value contents TOR2H:TOR2L. Down-counting: When timer contents 0000H, next CCUCLK cycle will counter value contents TOR2H:TOR2L. During CCUCLK cycle when reload performed, Timer Overflow Interrupt Flag (TOIF2) Interrupt Flag Register (TIFR2) will set, and, IEN0 register ECCU IEN1 register (IEN1.4) set, program execution will vector overflow interrupt. user clear interrupt flag software writing logic When writing reload registers, TOR2H TOR2L, values written stored 8-bit shadow registers. order latch contents shadow registers into TOR2H TOR2L, user must write logic Timer Compare/Overflow Update TCOU2, Timer Control Register (TCR21). function this depends whether timer running mode basic timer mode. basic timer mode, writing TCOU2 will cause values latched immediately value TCOU2 will always read zero. mode, writing TCOU2 will cause contents shadow registers updated next Timer overflow. long latch pending, TCOU2 will read will return zero when latching takes place. TCOU2 also controls latching Output Compare registers OCR2A, OCR2B OCR2C. When writing timer high byte, TH2, value written stored shadow register. When written, contents TH2's shadow register transferred same time that gets updated. Thus, should written prior writing TL2. write followed another write TL2, without being written between, value will transferred directly high byte timer. 16-bit Timer used 8-bit timer, user write (for upcounting) (for downcounting) TH2. When written, FFh:TH2 (for upcounting) (for downcounting) will loaded Timer. user will need rewrite again 8-bit timer operation unless there change count direction When reading timer, must read first. When read, contents timer high byte transferred shadow register same PCLK cycle read performed. When read, contents shadow register read instead. read from followed another read from without being read between, high byte timer will transferred directly TH2.
Table Symbol Reset Table prescaler control register, high byte (TPCR2H address CBh) allocation TPCR2H.1 TPCR2H.0
prescaler control register, high byte (TPCR2H address CBh) description Description Prescaler Prescaler
Symbol TPCR2H.0 TPCR2H.1
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table Symbol Reset
prescaler control register, byte (TPCR2L address CAh) allocation TPCR2L.7 TPCR2L.6 Table TPCR2L.5 TPCR2L.4 TPCR2L.3 TPCR2L.2 TPCR2L.1 TPCR2L.0
prescaler control register, byte (TPCR2L address CAh) description Symbol TPCR2L.0 TPCR2L.1 TPCR2L.2 TPCR2L.3 TPCR2L.4 TPCR2L.5 TPCR2L.6 TPCR2L.7 Description Prescaler Prescaler Prescaler Prescaler Prescaler Prescaler Prescaler Prescaler
Table Symbol Reset Table
control register (TCR20 address C8h) allocation PLLEN HLTRN HLTEN ALTCD ALTAB TDIR2 TMOD21 TMOD20
control register (TCR20 address C8h) description Description Timer mode (TMOD21, TMOD20): Timer stopped Basic timer function Asymmetrical (uses clock source) Symmetrical (uses clock source)
Symbol TMOD20/21
TDIR2 ALTAB ALTCD HLTEN HLTRN PLLEN
Count direction Timer. When logic count When logic count down. channel alternately output enable. When this set, output channel alternately gated every counter cycle. channel alternately output enable. When this set, output channel alternately gated every counter cycle. Halt Enable. When logic capture event enabled Input Capture will immediately stop activity pins them predetermined state. Halt. When indicates halt took place. order re-activate PWM, user must clear HLTRN bit. Phase Locked Loop Enable. When logic starts operation. After lock this will read back one.
10.4 Output compare
four output compare channels controlled through four 16-bit SFRs, OCRAH:OCRAL, OCRBH:OCRBL, OCRCH:OCRCL, OCRDH: OCRDL. Each output compare channel needs enabled order operate. channel enabled selecting Compare Output Action setting OCMx1:0 bits Capture Compare Control Register CCCRx When compare channel enabled, user
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
will have associated desired output mode connect pin. (Note: bits port pins P2.6, P1.6, P1.7, P2.1 must logic order compare channel outputs visible port pins.) When contents TH2:TL2 match that OCRxH:OCRxL, Timer Output Compare Interrupt Flag TOCFx TIFR2. This happens CCUCLK cycle after compare takes place. Timer Output Compare Interrupt Enable TOCIE2x TICR2 register), well ECCU IEN1 set, program counter will vectored corresponding interrupt. user must manually clear writing logic bits OCCRx, Output Compare Mode bits OCMx1 OCMx0 select what action taken when compare match occurs. Enabled compare actions take place even interrupt disabled. order Compare Output Action occur, compare values must within counting range timer. When compare channel enabled, (which must configured output) will connected internal latch controlled compare logic. value this latch zero from reset changed invoking forced compare. forced compare generated writing logic Force Compare Output FCOx OCCRx. Writing this generates transition corresponding OCMx1/OCMx0 without causing interrupt. basic timer operating mode FCOx bits always read zero. (Note: This different function mode.) When output compare enabled connected compare latch, state compare remains unchanged until compare event forced compare occurs.
Table Symbol Reset Table Capture compare control register (CCRx address Exh) allocation ICECx2 ICECx1 ICECx0 ICESx ICNFx FCOx OCMx1 OCMx0
Capture compare control register (CCRx address Exh) description Description Output Compare Mode. Force Compare Output Bit. When set, invoke force compare. Input Capture Noise Filter Enable Bit. When logic capture logic needs four consecutive samples same value order recognize edge capture event. inputs sampled every CCLK periods regardless speed timer. Input Capture Edge Select Bit. When logic Negative edge triggers capture, When logic Positive edge triggers capture. Capture Delay Setting Table details. Capture Delay Setting Table details. Capture Delay Setting Table details.
Symbol OCMx0 OCMx1 FCOx ICNFx
ICESx ICECx0 ICECx1 ICECx2
When user writes change output compare value, values written OCRH2x OCRL2x transferred 8-bit shadow registers. order latch contents shadow registers into capture compare register, user must write logic Timer Compare/Overflow Update TCOU2, Control Register TCR21. function this depends whether timer running mode
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
basic timer mode. basic timer mode, writing TCOU2 will cause values latched immediately value TCOU2 will always read zero. mode, writing TCOU2 will cause contents shadow registers updated next Timer overflow. long latch pending, TCOU2 will read will return zero when latch takes place. TCOU2 also controls latching Output Compare registers well Timer Overflow Reload registers TOR2.
10.5 Input capture
Input capture always enabled. Each time capture event occurs input capture pins, contents timer transferred corresponding 16-bit input capture register ICRAH:ICRAL ICRBH:ICRBL. capture event defined Input Capture Edge Select ICESx being CCCRx register. user will have configure associated input order external event trigger capture. simple noise filter enabled input capture input. When Input Capture Noise Filter ICNFx set, capture logic needs four consecutive samples same value order recognize edge capture event. inputs sampled every CCLK periods regardless speed timer. event counter delay capture number capture events. three bits ICECx2, ICECx1 ICECx0 CCCRx register determine number edges capture logic before input capture occurs. When capture event detected, Timer Input Capture Interrupt Flag TICF2x (TIFR2.1 TIFR2.0) set. Timer Input Capture Enable TICIE2x (TICR2.1 TICR2.0) well ECCU (IEN1.4) set, program counter will vectored corresponding interrupt. interrupt flag must cleared manually writing logic When reading input capture register, ICRxL must read first. When ICRxL read, contents capture register high byte transferred shadow register. When ICRxH read, contents shadow register read instead. read from ICRxL followed another read from ICRxL without ICRxH being read between, value capture register high byte (from last ICRxL read) will shadow register).
Table ICECx2 Event delay counter input capture ICECx1 ICECx0 Delay (numbers edges)
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
10.6 operation
Operation main modes, asymmetrical symmetrical. These modes timer operation selected writing TMOD21:TMOD20 shown Section 10.3 "Basic timer operation". asymmetrical operation, Timer operates downcounting mode regardless setting TDIR2. this case, TDIR2 will always read symmetrical mode, timer counts up/down alternately value TDIR2 effect. main difference from basic timer operation operation compare module, which mode used waveform generation. Table shows behavior compare pins mode. user will have configure output compare pins outputs order enable output. with basic timer operation, when (compare) pins connected compare logic, their logic state remains unchanged. However, since used hold halt value, only compare event change state pin.
TOR2
compare value timer value 0x0000
non-inverted
inverted
002aaa893
Asymmetrical PWM, downcounting.
TOR2
compare value timer value non-inverted
inverted
002aaa894
Symmetrical PWM.
Timer Overflow interrupt flag when counter changes direction top. example, contains 01FFH, Timer will count: .01FEH, 01FFH, 01FEH,. flag counter cycle after change from TOR-1.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
When timer changes direction bottom, this example, counts .,0001H, 0000H, 0001H,. Timer overflow interrupt flag counter CCUCLK cycle after transition from 0001H 0000H. status TDIR2 TCR20 reflects current counting direction. Writing this while operating symmetrical mode effect.
10.7 Alternating output mode
asymmetrical mode, user program channels alternating pairs bridge drive control. setting ALTAB ALTCD bits TCR20, output these channels alternately gated every counter cycle. This shown following figure:
TOR2 compare value compare value timer value
output (P2.6)
output (P1.6)
002aaa895
Alternate output mode. Table OCMx1[1] Output compare behavior OCMx0[1] Output Compare behavior Basic timer mode Asymmetrical Symmetrical Output compare disabled. power-on, this default state, pins configured inputs. when compare operation. Cleared compare match.[2] Non-Inverted PWM. compare match. Cleared Timer underflow. Inverted PWM. Cleared compare match. Timer underflow.[2] Non-Inverted PWM. Cleared compare match, upcounting. compare match, downcounting. Inverted PWM. compare match, upcounting. Cleared compare match, downcounting.[2]
Toggles compare match[2]
`ON' means CCUCLK cycle after event takes place.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
10.8 Synchronized register update
When OCRx registers written, built mechanism ensures that value updated middle pulse. This could result odd-length pulse. When registers written, values placed shadow registers, case basic timer operation mode. Writing TCOU2 will cause contents shadow registers updated next Timer overflow. OCRxH and/or OCRxL read before value updated, most currently written value read.
10.9 HALT
Setting HLTEN TCR20 enables Halt Function. When halt function enabled, capture event enabled Input Capture will immediately stop activity pins them predetermined state defined FCOx bit. Mode, FCOx bits CCCRx register hold value forced during halt. value setting read back. capture function interrupt will still operate normal even this added functionality enabled. When unit halted, timer will still normal. HLTRN TCR20 will indicate that halt took place. order re-activate PWM, user must clear HLTRN bit. user force unit into halt writing logic HLTRN bit.
10.10 operation
module features Phase Locked Loop that used generate CCUCLK frequency between MHz. this frequency module provides ultrasonic frequency with 10-bit resolution provided that crystal frequency higher (The resolution programmable bits writing TOR2H:TOR2L). input signal generates output signal times input frequency. This signal used clock timer. user will have divider that scales PCLK factor This divider found register TCR21. frequency expressed follows: frequency PCLK (N+1) Where: value PLLDV3:0. Since ranges CCLK frequency range PCLK PCLK/16.
Table Symbol Reset control register (TCR21 address F9h) allocation TCOU2 PLLDV.3 PLLDV.2 PLLDV.1 PLLDV.0
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table
control register (TCR21 address F9h) description Description frequency divider. Reserved. basic timer mode, writing logic TCOU2 will cause values latched immediately value TCOU2 will always read logic mode, writing logic TCOU2 will cause contents shadow registers updated next Timer overflow. long latch pending, TCOU2 will read logic will return logic when latching takes place. TCOU2 also controls latching Output Compare registers OCRAx, OCRBx OCRCx.
Symbol PLLDV.3:0 TCOU2
Setting PLLEN TCR20 starts PLL. When PLLEN set, will read back until lock. this time, unit ready operate timer enabled. following start-up sequence recommended: module without starting timer. Calculate right division factor that receives input clock signal MHz. Write this value PLLDV. PLLEN. Wait until reads Start timer writing value bits TMOD21, TMOD20 When timer runs from PLL, timer operates asynchronously rest microcontroller. Some restrictions apply:
user discouraged from writing reading timer asynchronous mode.
results unpredictable
Interrupts flags asynchronous. There will delay event
actually recognized until some CCLK cycles later (for interrupts reads)
10.11 interrupt structure
There seven independent sources interrupts CCU: timer overflow, captured input events Input Capture blocks A/B, compare match events Output Compare blocks through common interrupt vector used service routine interrupts occur simultaneously system usage. resolve this situation, priority encode function seven interrupt bits TIFR2 implemented (after each AND-ed with corresponding interrupt enable TICR2 register). order priority fixed follows, from highest lowest:
TOIF2 TICF2A TICF2B TOCF2A TOCF2B TOCF2C TOCF2D
interrupt service routine follows: Read priority-encoded value from TISE2 register determine interrupt source handled.
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
After current (highest priority) event serviced, write logic corresponding interrupt flag TIFR2 register clear flag. Read TISE2 register. priority-encoded interrupt source `000', interrupts serviced return from interrupt occur. Otherwise, return step next interrupt.
(IEN0.7) ECCU (IEN1.4) TOIE2 (TICR2.7) TOIF2 (TIFR2.7) TICIE2A (TICR2.0) TICF2A (TIFR2.0) TICIE2B (TICR2.1) TICF2B (TIFR2.1) TOCIE2A (TICR2.3) TOCF2A (TIFR2.3) TOCIE2B (TICR2.4) TOCF2B (TIFR2.4) TOCIE2C (TICR2.5) TOCF2C (TIFR2.5) TOCIE2D (TICR2.6) TOCF2D (TIFR2.6) interrupt
other interrupt sources
ENCINT.0 PRIORITY ENCODER ENCINT.1 ENCINT.2
002aaa896
Capture/compare unit interrupts.
Table Symbol Reset
interrupt status encode register (TISE2 address DEh) allocation ENCINT.2 ENCINT.1 ENCINT.0
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table
interrupt status encode register (TISE2 address DEh) description Description Interrupt Encode output. When multiple interrupts happen, more than interrupt flag Interrupt Flag Register (TIFR2). encoder output read determine which interrupt serviced. user must write logic clear corresponding interrupt flag TIFR2 register after corresponding interrupt been serviced. Refer Table TIFR2 description. interrupt pending. Output Compare Event interrupt (lowest priority) Output Compare Event interrupt. Output Compare Event interrupt. Output Compare Event interrupt. Input Capture Event interrupt. Input Capture Event interrupt. Timer Overflow interrupt (highest priority).
Symbol ENCINT.2:0
Table Symbol Reset Table
Reserved. interrupt flag register (TIFR2 address E9h) allocation TOIF2 TOCF2D TOCF2C TOCF2B TOCF2A TICF2B TICF2A
interrupt flag register (TIFR2 address E9h) description Description Input Capture Channel Interrupt Flag Bit. hardware when input capture event detected. Cleared software. Input Capture Channel Interrupt Flag Bit. hardware when input capture event detected. Cleared software. Reserved future use. Should logic user program. Output Compare Channel Interrupt Flag Bit. hardware when contents TH2:TL2 match that OCRHA:OCRLA. Compare channel must enabled order generate this interrupt. IEN0, ECCU IEN1 TOCIE2A set, program counter will vectored corresponding interrupt. Cleared software. Output Compare Channel Interrupt Flag Bit. hardware when contents TH2:TL2 match that OCRHB:OCRLB. Compare channel must enabled order generate this interrupt. IEN0, ECCU IEN1 TOCIE2B set, program counter will vectored corresponding interrupt. Cleared software. Output Compare Channel Interrupt Flag Bit. hardware when contents TH2:TL2 match that OCRHC:OCRLC. Compare channel must enabled order generate this interrupt. IEN0, ECCU IEN1 TOCIE2C set, program counter will vectored corresponding interrupt. Cleared software. Output Compare Channel Interrupt Flag Bit. hardware when contents TH2:TL2 match that OCRHD:OCRLD. Compare channel must enabled order generate this interrupt. IEN0, ECCU IEN1 TOCIE2D set, program counter will vectored corresponding interrupt. Cleared software. Timer Overflow Interrupt Flag bit. hardware Timer overflow. Cleared software.
Symbol TICF2A TICF2B TOCF2A
TOCF2B
TOCF2C
TOCF2D
TOIF2
Koninklijke Philips Electronics N.V. 2004. rights reserved.
User manual
Rev. March 2005
Philips Semiconductors
UM10119
P89LPC938 User manual
Table Symbol Reset Table
interrupt control register (TICR2 address C9h) allocation TOIE2 TOCIE2D TOCIE2C TOCIE2B TOCIE2A TICIE2B TICIE2A
interrupt control register (TICR2 address C9h) description Description Input Ca

Other recent searches


to125 - to125   to125 Datasheet
TND013S - TND013S   TND013S Datasheet
RTC8583 - RTC8583   RTC8583 Datasheet
RTC8593 - RTC8593   RTC8593 Datasheet
PH1214-30EL - PH1214-30EL   PH1214-30EL Datasheet
MMG3006NT1 - MMG3006NT1   MMG3006NT1 Datasheet
M38503G4AFP - M38503G4AFP   M38503G4AFP Datasheet
APSC03-41PWFA - APSC03-41PWFA   APSC03-41PWFA Datasheet
A2919 - A2919   A2919 Datasheet
0479460000 - 0479460000   0479460000 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive