GPIO引脚控制
硬件:一般有控制器,控制引脚是输入 输出 中断功能。
DATA控制寄存器,是输出 0 还是 1.
user manual:
GPFDAT bits[0-7]
When the port is configured as an input port, the corresponding bit is the
pin state. When the port is configured as an output port, the pin state is
the same as the corresponding bit.
When the port is configured as functional pin, the undefined value will be
read
If GPF0–GPF7 will be used for wake-up signals at power down mode, the ports will be set in interrupt mode.
#define GPFC (*(volatile unsigned long *)0x56000050)
#define GPFDAT (*(volatile unsigned long *)0x56000054)
#define GPF4 (1<<8) //configure the bits 8 bit9 8 01 output bit 8 equal 1
#define GPF5 (1<<(5*2)) 配置GPIOF 4 5 6 引脚 配置bit8 10 12 位
#define GPF6 (1<<(6*2))
在配置data寄存器
wait(3000);
//GPFDAT = (~(1<<4)); // 根据i的值,点亮LED1,2,4
wait(6000);
GPFDAT = (~(1<<5)); 把每个bit位 配置 都是把1<<5,就是配置bit5,~为0
/*wait(9000); (0<<5) 这样是行不通的
GPFDAT = (~(1<<6));
*/
本文详细介绍了GPIO引脚的功能配置及使用方法。包括通过DATA控制寄存器设置输出状态,以及如何配置特定引脚作为输出或中断模式。还提供了具体的寄存器定义和配置示例。
851

被折叠的 条评论
为什么被折叠?



