码迷,mamicode.com
首页 > 其他好文 > 详细

F28335 gpio的疑问

时间:2015-07-16 18:13:24      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

今天好不容易搭建完开发环境CCS5.4,正式开始学习F28335

看着官方例程和数据手册学习。。。。遇见一个很奇怪的问题

第一步配置IO口为输出

EALLOW;
GpioCtrlRegs.GPBPUD.bit.GPIO32  = 0;  // Enable the internal pullup on the specified pin
GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 0; // general purpose I/O
GpioCtrlRegs.GPBDIR.bit.GPIO32 = 1;  //Configures the GPIO pin as an output
GpioCtrlRegs.GPBPUD.bit.GPIO60  = 0;  // Enable the internal pullup on the specified pin
GpioCtrlRegs.GPBMUX2.bit.GPIO60 = 0; // general purpose I/O
GpioCtrlRegs.GPBDIR.bit.GPIO60 = 1;  //Configures the GPIO pin as an output
GpioCtrlRegs.GPBPUD.bit.GPIO61  = 0;  // Enable the internal pullup on the specified pin
GpioCtrlRegs.GPBMUX2.bit.GPIO61 = 0; // general purpose I/O
GpioCtrlRegs.GPBDIR.bit.GPIO61 = 1;  //Configures the GPIO pin as an output
EDIS;

 方法一:  //gpio60对应的LED不闪烁,一直亮
  GpioDataRegs.GPBDAT.bit.GPIO32 =0;
  GpioDataRegs.GPBDAT.bit.GPIO60 =0;
  GpioDataRegs.GPBDAT.bit.GPIO61 =0;
  DSP28x_usDelay(10000000);
  GpioDataRegs.GPBDAT.bit.GPIO32 =1;
  GpioDataRegs.GPBDAT.bit.GPIO60 =1;
  GpioDataRegs.GPBDAT.bit.GPIO61 =1;
  DSP28x_usDelay(10000000);
 方法二led都正常闪烁
  GpioDataRegs.GPBSET.bit.GPIO32 =1;
  GpioDataRegs.GPBSET.bit.GPIO60 =1;
  GpioDataRegs.GPBSET.bit.GPIO61 =1;
  DSP28x_usDelay(10000000);
  GpioDataRegs.GPBCLEAR.bit.GPIO32 =1;
  GpioDataRegs.GPBCLEAR.bit.GPIO60 =1;
  GpioDataRegs.GPBCLEAR.bit.GPIO61 =1;
  DSP28x_usDelay(10000000);
  方法三 led都正常闪烁
  GpioDataRegs.GPBTOGGLE.bit.GPIO32 =1;
  GpioDataRegs.GPBTOGGLE.bit.GPIO60 =1;
  GpioDataRegs.GPBTOGGLE.bit.GPIO61 =1;
  DSP28x_usDelay(10000000);
  GpioDataRegs.GPBTOGGLE.bit.GPIO32 =1;
  GpioDataRegs.GPBTOGGLE.bit.GPIO60 =1;
  GpioDataRegs.GPBTOGGLE.bit.GPIO61 =1;
  DSP28x_usDelay(10000000);
 我觉得这几种方法本质上应该是一样的但为什么。。。

F28335 gpio的疑问

标签:

原文地址:http://www.cnblogs.com/zheming/p/4651553.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!