GPIOX-> IDR & GPIO_Pin_X implements data collection instructions.

In general, the core is at 72Mhz, the IO speed is 50Mhz, and the response time of the external interrupt is about 6 cycles of 168ns.

GPIOX-> IDR & GPIO_Pin_X thinks that the value of reading this register is 1 in a project, in fact it is the register status of this IO indexed by pin, this value is not 1.

GPIOX-> IDR is the status of each port register.

First turn on the peripheral clock to initialize the pin configuration state.

The value of the IO register will change when there is an external input. For example, read the second pin of GPIOA. When the external input is 1, the value read is 0x00000002 & 0x2 = 0x2;

So the value is 2. If Xiongtai wants to implement data reading, the implementation method is: (GPIOX-> IDR & GPIO_Pin_X)? 1: 0; In this way, the status value can be obtained.

Guess you like

Origin www.cnblogs.com/luxingsh/p/12716466.html