Tool/software: Code Composer Studio
Hi,
I am confused about the function of Uint16 GPIO_ReadPin(Uint16 pin).
The following code is in the infinite loop and I am using GPIO_ReadPin(119).
The result is very strange. I use scope to measure the waveform of GPIO119 and it is low all the time.
However my SYS_flag sometimes is 2 and sometimes I got sys_err = 2. This means when GPIO_ReadPin(119) is read first time, GPIO_ReadPin(119)=0, then GPIO_ReadPin(119)=1 the second time and sometimes GPIO_ReadPin(119)=0 again the third time.
Why GPIO_ReadPin(119) can't be the same value all the time? What is the return value of GPIO_ReadPin(119) except 0, 1? -Thanks!
main ()
{
……
for (;;)
{
if (SYS_flag == 0)
{
if (GPIO_ReadPin(119)== 0)
SYS_flag = 1;
else
{
if (GPIO_ReadPin(119) != 0)
sys_err = 1;
}
if (SYS_flag == 1)
{
if (GPIO_ReadPin(119)!= 0)
SYS_flag = 2;
}
if (SYS_flag == 2)
{
if (GPIO_ReadPin(119)!= 0)
sys_err = 2;
}
}
}
}