Read GPIO input | Cypress Semiconductor
Read GPIO input
I have a issue with reading GPIO input value with the code as below:
// set P0 drive mode = highZ
//read P0 input to temp
temp |= (PRT0DR&0x04)<<7;
P0 is set as StdCPU. While I give a 5V input to P0 port, and expect the variable temp will have a value of 80h after executing the above code. However, the temp value is always 0. I am wondering it is the correct way to read the input of port P0?
appreciate any help and suggestion.