NXP Semiconductors P89LPC9321 UM10310 User Manual

Page 138

Advertising
background image

UM10310

All information provided in this document is subject to legal disclaimers.

© NXP B.V. 2010. All rights reserved.

User manual

Rev. 2 — 1 November 2010

138 of 139

continued >>

NXP Semiconductors

UM10310

P89LPC9321 User manual

23. Contents

1

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.1

Pin configuration . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2

Pin description . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.3

Functional diagram . . . . . . . . . . . . . . . . . . . . . . 8

1.4

Block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 9

1.5

Special function registers . . . . . . . . . . . . . . . . 10

1.6

Memory organization . . . . . . . . . . . . . . . . . . . 20

2

Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2.1

Enhanced CPU . . . . . . . . . . . . . . . . . . . . . . . . 21

2.2

Clock definitions . . . . . . . . . . . . . . . . . . . . . . . 21

2.2.1

Oscillator Clock (OSCCLK). . . . . . . . . . . . . . . 21

2.3

External crystal oscillator option . . . . . . . . . . . 21

2.3.1

Low speed oscillator option . . . . . . . . . . . . . . 21

2.3.2

Medium speed oscillator option . . . . . . . . . . . 22

2.3.3

High speed oscillator option . . . . . . . . . . . . . . 22

2.4

Clock output . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2.5

On-chip RC oscillator option . . . . . . . . . . . . . . 22

2.6

Watchdog oscillator option . . . . . . . . . . . . . . . 23

2.7

External clock input option . . . . . . . . . . . . . . . 23

2.8

Clock sources switch on the fly. . . . . . . . . . . . 24

2.9

Oscillator Clock (OSCCLK) wake-up delay . . 25

2.10

CPU Clock (CCLK) modification: DIVM
register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

2.11

Low power select . . . . . . . . . . . . . . . . . . . . . . 25

3

Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.1

Interrupt priority structure . . . . . . . . . . . . . . . . 26

3.2

External Interrupt pin glitch suppression. . . . . 27

4

I/O ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

4.1

Port configurations . . . . . . . . . . . . . . . . . . . . . 29

4.2 Quasi-bidirectional

output configuration . . . . . 29

4.3 Open

drain

output

configuration . . . . . . . . . . . 30

4.4

Input-only configuration . . . . . . . . . . . . . . . . . 31

4.5

Push-pull output configuration . . . . . . . . . . . . 31

4.6

Port 0 and Analog Comparator functions . . . . 31

4.7

Additional port features. . . . . . . . . . . . . . . . . . 32

5

Power monitoring functions . . . . . . . . . . . . . . 33

5.1

Brownout detection . . . . . . . . . . . . . . . . . . . . . 33

5.2

Power-on detection. . . . . . . . . . . . . . . . . . . . . 34

5.3

Power reduction modes . . . . . . . . . . . . . . . . . 34

6

Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

6.1

Reset vector . . . . . . . . . . . . . . . . . . . . . . . . . . 38

7

Timers 0 and 1 . . . . . . . . . . . . . . . . . . . . . . . . . 39

7.1

Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7.2

Mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7.3

Mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

7.4

Mode 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

7.5

Mode 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

7.6

Timer overflow toggle output . . . . . . . . . . . . . 43

8

Real-time clock system timer. . . . . . . . . . . . . 43

8.1

Real-time clock source. . . . . . . . . . . . . . . . . . 44

8.2

Changing RTCS1/RTCS0 . . . . . . . . . . . . . . . 45

8.3

Real-time clock interrupt/wake-up . . . . . . . . . 45

8.3.1

Real-time clock read back . . . . . . . . . . . . . . . 45

8.4

Reset sources affecting the Real-time clock . 45

9

Capture/Compare Unit (CCU) . . . . . . . . . . . . . 47

9.1

CCU Clock (CCUCLK) . . . . . . . . . . . . . . . . . . 47

9.2

CCU Clock prescaling . . . . . . . . . . . . . . . . . . 47

9.3

Basic timer operation . . . . . . . . . . . . . . . . . . . 48

9.4

Output compare . . . . . . . . . . . . . . . . . . . . . . . 50

9.5

Input capture . . . . . . . . . . . . . . . . . . . . . . . . . 52

9.6

PWM operation . . . . . . . . . . . . . . . . . . . . . . . 52

9.7

Alternating output mode. . . . . . . . . . . . . . . . . 54

9.8

Synchronized PWM register update . . . . . . . 54

9.9

HALT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

9.10

PLL operation. . . . . . . . . . . . . . . . . . . . . . . . . 55

9.11

CCU interrupt structure . . . . . . . . . . . . . . . . . 56

10

UART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

10.1

Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

10.2

Mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

10.3

Mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

10.4

Mode 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

10.5

SFR space . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

10.6

Baud Rate generator and selection . . . . . . . . 60

10.7

Updating the BRGR1 and BRGR0 SFRs . . . . 60

10.8

Framing error . . . . . . . . . . . . . . . . . . . . . . . . . 61

10.9

Break detect. . . . . . . . . . . . . . . . . . . . . . . . . . 61

10.10

More about UART Mode 0 . . . . . . . . . . . . . . . 63

10.11

More about UART Mode 1 . . . . . . . . . . . . . . . 64

10.12

More about UART Modes 2 and 3 . . . . . . . . . 65

10.13

Framing error and RI in Modes 2 and 3 with
SM2 = 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

10.14

Break detect. . . . . . . . . . . . . . . . . . . . . . . . . . 66

10.15

Double buffering. . . . . . . . . . . . . . . . . . . . . . . 66

10.16

Double buffering in different modes . . . . . . . . 66

10.17

Transmit interrupts with double buffering enabled
(Modes 1, 2, and 3) . . . . . . . . . . . . . . . . . . . . 66

10.18

The 9th bit (bit 8) in double buffering (Modes 1, 2,
and 3). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

10.19 Multiprocessor

communications. . . . . . . . . . . 68

10.20

Automatic address recognition. . . . . . . . . . . . 69

11 I

2

C interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

11.1 I

2

C data register . . . . . . . . . . . . . . . . . . . . . . . 71

11.2 I

2

C slave address register . . . . . . . . . . . . . . . 71

Advertising