Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
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?