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 read速度?

Other Parts Discussed in Thread: TM4C123GH6PZ

IC: TM4C123GH6PZ

我把兩個GPIO連在一起,一個out一個in

其中只改變輸出後讀取的間隔時間

延遲 0.01s 和 1ms

結果P3V3讀取的值

延遲0.01s會正常

但延遲1ms,第一次(讀到0)和第二次(讀到1)讀取出來卻不一定

是GPIO拉H和L速度太慢還是讀取速度有限制??

GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_4, GPIO_PIN_4);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, GPIO_PIN_5);
SysCtlDelay(SysCtlClockGet()/(3*100)); // delay 0.01s <<<<<<<只改變這個時間
PV12_Status = (GPIOPinRead(GPIO_PORTD_BASE, GPIO_PIN_0));
P3V3_Status = (GPIOPinRead(GPIO_PORTD_BASE, GPIO_PIN_1));

if(PV12_Status != GPIO_PIN_0)
{
snprintf( Msg, sizeof(Msg)-1, "%d_%d\r\n",PV12_Status, GPIOPinRead(GPIO_PORTD_BASE, GPIO_PIN_0));
UARTSend((uint8_t *)Msg, strlen(Msg));
}
else
{
snprintf( Msg, sizeof(Msg)-1, "%d\r\n",GPIOPinRead(GPIO_PORTD_BASE, GPIO_PIN_0));
UARTSend((uint8_t *)Msg, strlen(Msg));
}

if(P3V3_Status != GPIO_PIN_1)
{
snprintf( Msg, sizeof(Msg)-1, "%d_%d\r\n",P3V3_Status, GPIOPinRead(GPIO_PORTD_BASE, GPIO_PIN_1));
UARTSend((uint8_t *)Msg, strlen(Msg));
}
else
{
snprintf( Msg, sizeof(Msg)-1, "%d\r\n",GPIOPinRead(GPIO_PORTD_BASE, GPIO_PIN_1));
UARTSend((uint8_t *)Msg, strlen(Msg));
}

  • 拉H和L的速度,达到1ms松松的。读的速度,也应该很快的,因为有PWM捕获的速度在那里。我怀疑的是,是不能这么对接使用的,或者说这样即使可以,但是也有速度限制的。