11.1.6.
11.2.
Timer0/1 Register .................................................................................................................52
Timer2..........................................................................................................................54
Capture Mode (CP) Structure ...............................................................................................54
Auto-Reload Mode (AR) Structure........................................................................................55
Baud-Rate Generator Mode (BRG) Structure.......................................................................56
Programmable Clock Output from Timer 2 Structure ...........................................................57
Timer2 Register ....................................................................................................................57
Timer0/1 Sample Code.................................................................................................60
11.2.1.
11.2.2.
11.2.3.
11.2.4.
11.2.5.
11.3.
12.Serial Port 0 (UART0).................................................................................. 62
12.1.
12.2.
12.3.
12.4.
12.5.
12.6.
12.7.
Serial Port 0 Mode 0.....................................................................................................62
Serial Port 0 Mode 1.....................................................................................................65
Serial Port 0 Mode 2 and Mode 3 .................................................................................66
Frame Error Detection ..................................................................................................66
Multiprocessor Communications...................................................................................67
Automatic Address Recognition....................................................................................67
Baud Rate Setting ........................................................................................................68
Baud Rate in Mode 0 ............................................................................................................69
Baud Rate in Mode 2 ............................................................................................................69
Baud Rate in Mode 1 & 3......................................................................................................69
Serial Port 0 Register ...................................................................................................70
12.7.1.
12.7.2.
12.7.3.
12.8.
13.Serial Port 1 (UART1).................................................................................. 73
13.1.
Serial Port 1 Baud Rates ..............................................................................................73
Baud Rate in Mode 0 ............................................................................................................73
Baud Rate in Mode 2 ............................................................................................................73
Baud Rate in Mode 2 ............................................................................................................73
UART1 Baud Rate Timer used for UART0....................................................................73
Serial Port 1 Register ...................................................................................................74
Serial Port Sample Code ..............................................................................................76
13.1.1.
13.1.2.
13.1.3.
13.2.
13.3.
13.4.
14.Programmable Counter Array (PCA) ........................................................... 78
14.1.
14.2.
14.3.
14.4.
PCA Overview..............................................................................................................78
PCA Timer/Counter ......................................................................................................79
Compare/Capture Modules...........................................................................................82
Operation Modes of the PCA........................................................................................84
Capture Mode .......................................................................................................................84
16-bit Software Timer Mode..................................................................................................84
High Speed Output Mode .....................................................................................................85
PWM Mode ...........................................................................................................................85
Enhance PWM Mode............................................................................................................86
PCA Sample Code .......................................................................................................89
14.4.1.
14.4.2.
14.4.3.
14.4.4.
14.4.5.
14.5.
15.Serial Peripheral Interface (SPI) .................................................................. 90
15.1.
Typical SPI Configurations ...........................................................................................90
Single Master & Single Slave................................................................................................90
Dual Device, where either can be a Master or a Slave ........................................................91
Single Master & Multiple Slaves ...........................................................................................91
Configuring the SPI ......................................................................................................93
Additional Considerations for a Slave...................................................................................93
Additional Considerations for a Master.................................................................................93
Mode Change on nSS-pin.....................................................................................................94
Write Collision .......................................................................................................................94
SPI Clock Rate Select...........................................................................................................94
Data Mode....................................................................................................................95
SPI Register .................................................................................................................97
SPI Sample Code.........................................................................................................99
15.1.1.
15.1.2.
15.1.3.
15.2.
15.2.1.
15.2.2.
15.2.3.
15.2.4.
15.2.5.
15.3.
15.4.
15.5.
16.Keypad Interrupt (KBI)............................................................................... 103
16.1.
16.2.
Keypad Register.........................................................................................................103
Keypad Interrupt Sample Code...................................................................................105
17.10-Bit ADC................................................................................................. 106
6
MG82FE/L532 Data Sheet
MEGAWIN