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.

PD7输出高电平

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE,GPIO_PIN_7);

GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_7,0x80);

为什么这样设定PD7没高电平输出。    

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE,GPIO_PIN_1);

GPIOPinWrite(GPIO_PORTE_BASE,GPIO_PIN_1,0x01);

PE1有输出。

 

 

  • 这个和硬件有时候有点关系,在设置GPIO的时候你可以设置成开漏输出看下:GPIOPinTypeGPIOOutputOD  

  • 上电后PD7管脚默认是NMI功能,如果要使PD7工作在GPIO功能,需要切换PD7的功能。

  • 在你的PORTD端口初始化之后增加如下的代码,切换PD7端口为GPIO口.

      HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;   

     HWREG(GPIO_PORTD_BASE + GPIO_O_CR)  = 0x80;       

    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, 0x80);      

    HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;   

    HWREG(GPIO_PORTD_BASE + GPIO_O_CR)   = 0x00;   

    HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = 0;