在初始化时将GPIO口配置为PWM模式还能在设定数据寄存器的值为1吗?如下:
GpioCtrlRegs.GPAGMUX1.bit.GPIO0 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; //配置为EPWM1A
GpioCtrlRegs.GPAPUD.bit.GPIO0 = 1; //关闭上拉;
GpioDataRegs.GPASET.bit.GPIO0= 1; //默认输出设置为1
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
在初始化时将GPIO口配置为PWM模式还能在设定数据寄存器的值为1吗?如下:
GpioCtrlRegs.GPAGMUX1.bit.GPIO0 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; //配置为EPWM1A
GpioCtrlRegs.GPAPUD.bit.GPIO0 = 1; //关闭上拉;
GpioDataRegs.GPASET.bit.GPIO0= 1; //默认输出设置为1
已经设置为PWM输出的话,是不可以在设定数据寄存器的值的。
例程中的配置如下
// // InitEPwm3Gpio - Initialize EPWM3 GPIOs // void InitEPwm3Gpio(void) { EALLOW; // // Disable internal pull-up for the selected output pins // for reduced power consumption // Pull-ups can be enabled or disabled by the user. // This will enable the pullups for the specified pins. // Comment out other unwanted lines. // GpioCtrlRegs.GPAPUD.bit.GPIO4 = 1; // Disable pull-up on GPIO4 (EPWM3A) GpioCtrlRegs.GPAPUD.bit.GPIO5 = 1; // Disable pull-up on GPIO5 (EPWM3B) // // Configure EPwm-3 pins using GPIO regs // This specifies which of the possible GPIO pins will be EPWM3 functional pins. // Comment out other unwanted lines. // GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 1; // Configure GPIO4 as EPWM3A GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 1; // Configure GPIO5 as EPWM3B EDIS; }