 Hello everyone, myself Prithviraj Thambe, working as an assistant professor in Department of Electronics Engineering at Vulture Institute of Technology, Singapore. Let us learn today pin connect block of LPC1768 microcontroller. At the end of the session students will be able to illustrate the registers available in the pin connect block of LPC1768 as well as they can configure desired functions of LPC1768 port pins using pin function selector register. So, this is the outline of this presentation. So, LPC1768 is a 100 pin IC provided by NXP semiconductors. So, this LPC1768 comes with 5 ports, port 0, port 1, port 2, port 3 and port 4. So, for example port 0 has P0.0 to P0.31 pins and P1.16 to 1.31 are port 1 pins. But not all the port pins are available, some of the pins are also reserved. Also each pin can have maximum 4 functions. So, let us look at this pin connect block. So, pin connect block is nothing but bunch of registers. So, pin function selector register. So, 9 registers are available. So, this pin function selector registers controls the function of port pins. Another register, I2C pin configuration register this is only one allows configuration of I2C pins of I2C0 interface only. Then there are 9 pin mode select registers and 5 open drain mode registers. So, these registers allows the use of on chip pull up and pull down registers as well as for output special output drain operating mode is also available. So, you can set all these modes using these two registers. So, these registers allows you to prevent any input output pin from floating by either pulling them to high or low. So, one more thing all the registers are 32 bit wide. So, let us learn pin function selector register in this session. So, pin function selector register is used to configure the function of any port pin of this micro controller. All registers are memory map registers. So, you can access these registers using memory address. So, the header file takes care of this. So, these registers actually controls the multiplexer like structures allows the connection between on chip peripheral and the pin. When you select any particular function for any port pin, it will completely exclude all other functions. So, that pin will be used for only that function. You cannot use one pin at the same time for multi function. So, pin function registers are part of pin connect block. So, these 9 registers are listed here. So, each pin function select register is 30 bit wide. So, you will see that here total 9 registers are available pin cell 0 1 2 3 4 7 8 9 and 10 and they are having memory addresses as shown here. So, as I told earlier pin cell pin function select register controls a MUX like structure. So, each pin can be used for either of maximum four functions with the help of multiplexer like structure. So, here the first is the primary or default function then first alternate function second alternate function and third alternate function and this is the actual port pin. So, you can configure this port pin for either of these four functions using pin functions select register. So, let us calculate the bits required to configure functions of a port pin. So, here you will see that it is a 4 is to 1 MUX structure. So, number of bits required to configure function of a particular port pin is 2. So, four functions. So, it is a 4 is to 1 MUX requires two bits. So, these are named as port pin function select bits. So, in the datasheet you will find that for each combination there is defined function provided. So, for example, for P 0.1 for 00 this P 0.1 can be used as a GPI pin is for 01 you can use for CAN 1 RD 1 for 10 second alternate function which is your transmit pin and for 01 third alternate function I square C data line. So, pin cell 0 is the third bit wide register controls the function of port 0 and as two bits required for one port pin. So, using these 32 bits you can only configure 15 pins. So, P 0.0 to P 0.15 pin functions are controlled by pin cell 0 register. So, here one example is given. So, bit 0 and bit 1 are responsible for selecting the function of port P 0.0. So, here you will see that each pin comes with its function definitions for 00 all the pins are selected for GPI function then first alternate function second alternate function and third alternate function and by default the value of pin cell 0 is 00. So, here you will see that not all the port pins are available some of the port pins are also reserved. So, here P 0.12 to 14 are not available they are reserved. So, let us configure the function of a port pin let us select P 0.0 as a transmitter output for UR 3. So, how to select this function for P 0.0. So, we need to follow some steps. So, first logical and a mask with the default content of pin cell register why to do this to preserve the function of other port pins we never disturb the function of other port pins. So, how to create a mask? So, zeros in the bit corresponding to the pins that will be changed and once for all other pins and then logical or the result with the desired function value. So, this is the third bit format. So, here you will see that this is the predefined functions or default functions then mask I have applied. So, here for particular for this example P 0.0 I want to configure P 0.0 as a transmit output for UR 3. So, I am using 00 and for all other bits I am using one. So, this is the mask. So, if I want to write this in hex it will be like f f f f and last is a C then orring the desired function. So, I want to select this pin as a UR 3 output pin. So, 00, 01 and 10. So, 10 I should write in the particular bits. So, 10. So, the final value you will see that only these two values are changed. So, previously it was 00 and after the update it is configured for second alternate function. So, after writing these combinations in hex I will write some statements here pin cell 0 and 8 with itself with 0 x f f f f f f f c or you can write the same sentence like this pin cell 0 is equal to pin cell 0 and 8 with this value. This is the first step. So, this step is required not to disturb the functions of other port pins. Similarly, last step orring with the desired function. So, 1 0 after writing 1 0 what combination I have received here 0 0 0 and last 2. So, this is pin cell 0 odd with itself with 0 2. So, in this example we configured p 0.0 as a transmit output for UR 3. So, this is the summary for the remaining pin cell registers. Pin cell 1 is used to control the functions of port 0 pins 0 1 16 to 0.30, pin cell 2 is used to control the functions of port 1 pins ranges from 1.0 to 1.15, pin cell 3 is used to control the function of again port 1 pins 1.16 to 1.31, 4 pin cell 4 register controls the function of port 2, pin cell 7 only controls the 2 pins of port 3 p 3.25 and p 3.26 remaining pins are reserved not available for the user. Pin cell 9 again controls 2 port pins of port 4 p 4.28 and p 4.29. Pin cell 10 controls the trace function of port 2 pins p 2.2 to p 2.6 references to learn further. Thank you.