GPIO MODE REGISTER
Let’s understand the GPIO mode register in this article. The very first register is the port mode register, and the name of this register is GPIOx_MODER. Here x can be replaced any GPIO port name from A to I as shown in Figure 1 and for each peripheral, there will be one moder register.
![GPIO mode register](https://fastbitlab.com/wp-content/uploads/2019/07/Screenshot-118.png)
The size of the GPIO port mode register is 32 bits, and the configuration length of each port mode register is 2 bits as shown in Figure 2.
![32-bit GPIO port mode register](https://fastbitlab.com/wp-content/uploads/2019/07/Screenshot-120.png)
These configuration bits are written by software to configure the I/O direction mode:
00: Input (reset state)
01: General purpose output mode
10: Alternate function mode
11: Analog mode
Very commonly used modes are input mode, general-purpose output mode, and alternate function mode. ADC or DAC uses Analog mode. Also, whenever a microcontroller undergoes reset all the pins of different GPIO port will be by default in the input state.
In the following article, let’s see Input configuration of Microcontroller’s GPIO Pin.
FastBit Embedded Brain Academy Courses,
Click here: https://fastbitlab.com/course1