Other Parts Discussed in Thread: C2000WARE
2837xD的技术手册中写道:上拉电阻默认是不使能的。用于在没有外部信号输入时将输入引脚的保持在已知的状态。(原文:GPIOAll pullups are disabled by default. Pullups can be used to keep input pins in known state when there is no external signal driving them.)
按照我的理解,当把GPIO作为输出时,不需要对于GPIO上拉控制寄存器进行设置,因为默认是不使能的。但是我在官网的C2000ware提供的例程中看到对EPWM进行GPIO设置时的程序如下:
void InitEPwm1Gpio(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.
// Comment out other unwanted lines.
//
GpioCtrlRegs.GPAPUD.bit.GPIO0 = 1; // Disable pull-up on GPIO0 (EPWM1A)
GpioCtrlRegs.GPAPUD.bit.GPIO1 = 1; // Disable pull-up on GPIO1 (EPWM1B)
//
// Configure EPWM-1 pins using GPIO regs
// This specifies which of the possible GPIO pins will be EPWM1 functional
// pins.
// Comment out other unwanted lines.
//
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // Configure GPIO0 as EPWM1A
GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1; // Configure GPIO1 as EPWM1B
EDIS;
}
还是对GPIO控制寄存器力的上拉寄存器 GpioCtrlRegs.GPAPUD.bit.GPIO0 进行了不使能,这是必须的吗?