Posts

Showing posts from May, 2021

Introduction of IODIR,PINSEL,IOSET and IOCLR Registers

Image
How to select the direction of the port? IODIR is the command used to set the direction of the port as an input or an output. For setting the pin as an input pin we need to provide logic 0 and for setting the pin as an output pin we need to provide logic 1 to the respective pin. By default, on reset, all the pins are acting as an input so there is no need to set the pin as an input pin if we are resetting the arm7. But for setting the pin as an output pin we need to provide logic 0. Let's take the below example:   Supposed I want to set pin 3 of port 0 as an output then I will provide logic 1 to pin 3 of port 0. IODIR0: IODIR0 = 0x00000008 Supposed I want to set pin 16, pin 15, pin 2 and pin 1 of port 1 as an output then I will change the bits as follows: IODIR0 = 0x00018006; How to select the pin for a particular function? In arm7 each pin has multiple functions, to select the particular function of the respective pin  PINSEL  register is used. To select the particular function in