Introduction_ARM 7
LPC2148
PINSEL register : ( 32 bit ) Pin select register.
              This register is use to determine /assign  function of/to a particular pin on LPC2138.
                                               PINSEL0 ---> Port 0.0 to Port 0.15
                                               PINSEL1 ---> Port 0.16 to Port 0.31
                                               Reserved ---> Port 1.0 to Port 1.15
                                               PINSEL2 ---> Port 1.16 to Port 1.32
|  | 
| PINSEL 1 | 
|  | 
| PINSEL 2 | 
                                                        0 0 - First Config.
                                                        0 1 - Second Config.
                                                        1 0 - Third Config.
                                                        1 1 - Fourth Config.
Suppose you want to set P0.15 in SECOND config. 
The value of Pinsel would be :
                                         PINSEL0 = 0X40000000;
Input / Output Directional register : ( 32 bit ) IODIR register.
                This register is use to select the direction of the pin.
                It can be either an input or an output.
                                               Input = 0       &      Output = 1
|  | 
| IODIR0 for Port 0 | 
|  | 
| IODIR1 for Port 1 | 
Suppose you want to set P0.0 ,P0.1 & P0.2 in output config. 
                                                   IODIR0 = 0X00000007;
Input / Output Set register : ( 32 bit ) IOSET register.
                                              This register is use to set the pin.
     Giving value 1 to a particular pin will send high voltage to a device connected to that port pin.
|  | 
| IOSET0 for Port 0 | 
Suppose you want to set P0.0 ,P0.1 & P0.2 to high. 
                                                   IOSET0 = 0X00000007;
Input / Output Clear register : ( 32 bit ) IOCLR register.
                                              This register is use to clear the pin.
     Giving value 1 to a particular pin will send low voltage to a device connected to that port pin.
Input / Output Pin register : ( 32 bit ) IOPINX register.
                                         This register is use to check the current status of the pin.

Comments
Post a Comment