关于GPIO的设置GPXDAT控制方式疑问
时间:10-02
整理:3721RD
点击:
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;
#if 1 //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);
#endif
#if 0
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);
#endif
#if 0
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);
#endif
这三种方式中只有GPBDAT写0写1控制LED时GPIO60是常亮的。
请问这是为什么?
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;
#if 1 //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);
#endif
#if 0
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);
#endif
#if 0
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);
#endif
这三种方式中只有GPBDAT写0写1控制LED时GPIO60是常亮的。
请问这是为什么?
#if 1 //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);
#endif
你的源代码值编译了这里
感谢小编分享~感谢小编分享~
一起學習吧,有高手可以看看解惑嗎
具体要看外围电路,看外围电路有无虚焊,有无烧东西,确定不是硬件问题。在去排除是软件问题