F28335 gpio的疑问

今天好不容易搭建完开发环境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);
 我觉得这几种方法本质上应该是一样的但为什么。。。

posted on 2015-07-16 15:56  kakegaenonai  阅读(1215)  评论(0编辑  收藏  举报

导航