Pin Connect Block in LPC2148
Pin Connect Block
- 64 pins are attached to two 32-bit I/O ports, Port-0 & Port-1.
- Port-0, Port-1 pins are designated as P0.0 – P0.31 & P1.0 - P1.31.
- Pins P0.24, P0.26, P0.27, P1.0-P1.15 are unavailable.
- Pin functions are multiplexed, up to 4 functions assigned to each pin.
- Port-0 pins multiplex peripheral pin, & comm. interface pin functions
- Port-1 pins multiplex JTAG interface, Trace function
- Advantages: keeps size small, adds more functionalities to devices
- Disadvantages: if functions not carefully selected, some can’t be availed
- Pin function select Registers: PINSEL0, PINSEL1, PINSEL2
- PINSEL0 selects functions of pins P0.0 to P0.15,
- PINSEL1 selects functions of pins P0.16 to P0.31
- PINSEL2 selects functions of pins P1.16 to P1.31
Pin function selection: Examples
- Configuring P0.0 and P0.1 of Port-0 as I/O pins for TxD0 and RxD0 functions of UART0 in ‘C’:
- PINSEL0=0x00000000; //clear bits[3:2], [1:0] of PINSEL0 register, hence assign P0.0, P0.1 general purpose I/O function
- PINSEL0=0x00000005; //place 01 in bits[3:2], [1:0] of PINSEL0 register which selects TxD0 for P0.0 & RxD0 for P0.1 pins
- For using DAC, select Aout function for P0.25 pin.
- PINSEL1=0X00080000...//place 10 into bits[19:18] of PINSEL1 reg.select Aout function for P0.25
- WikiNote Foundation
Last modified: Thursday, 19 September 2019, 2:04 PM