GPIO




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));   
  */
  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值