Introduction to ARM LPC1768 GPIO Register set.

Introduction to ARM LPC1768 GPIO Register set:


Registers on LPC1768 are present on Peripheral AHB bus(Advanced High performance Bus) for fast read/write timing.
So, these are basically Fast I/O or Enhanced I/O and hence the naming convention in datasheet uses a prefix of “FIO” instead of something like “GIO” for all the registers related to GPIO.

1) FIODIR 
2) FIOMASK 
3) FIOPIN 
4) FIOSET 
5) FIOCLR 

1) FIODIR : 

     This is the GPIO direction control register.
Example:
Lets say we want to set PIN 3 on Port 0 as output.
CASE 1. LPC_GPIO0->FIODIR = (1<<3); //(binary using left shift - direct assign: other pins set to 0)

CASE 2. LPC_GPIO0->FIODIR |= 0x0000008; // or 0x8; (hexadecimal - OR and assign: other pins not affected)

2) FIOMASK : 
This gives masking mechanism for any pin i.e. it is used for Pin access control
3) FIOPIN :
 This register can be used to Read or Write values directly to the pins. Regardless of the direction set for the particular pins it gives the current start of the GPIO pin when read.
4) FIOSET : 
It is used to drive an ‘output’ configured pin to Logic 1 i.e HIGH.
Writing Zero does NOT have any effect and hence it cannot be used to drive a pin to Logic 0 i.e LOW. For driving pins LOW FIOCLR is used which is explained below.
5) FIOCLR :
 It is used to drive an ‘output’ configured pin to Logic 0 i.e LOW. Writing Zero does NOT have any effect and hence it cannot be used to drive a pin to Logic 1.
Pin Connect Block:
Every GPIO pin has a minimum of one function and maximum of four functions.The required function can be selected by configuring the PINSEL register.

Pin function select Registers:
·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.0 to P1.15 
·PINSEL3 selects functions of pins P1.16 to P1.31
 
·PINSEL4 selects functions of pins P2.0 to P2.15 
·PINSEL5 selects functions of pins P2.16 to P2.31
 
·PINSEL6 selects functions of pins P3.0 to P3.15  
·PINSEL7 selects functions of pins P3.16 to P3.31
·PINSEL8 selects functions of pins P4.0 to P4.15 
·PINSEL9 selects functions of pins P4.16 to P4.31 









Comments

Popular posts from this blog

7-segment LED interface

Interface a Stepper motor