There are some errors (PxSEL has nothing to do with analog inputs (see table 18 of the datasheet), and writing PxIN does not make sense). However, this code correctly configures P1.2 as general-purpose input. If you're seeing a PWM signal, it's generated by the external circuit, or there is some other code that reconfigures the pin, or this is not the code that is actually running on the device.
↧