#include <msp430.h> void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode // to activate previously configured port settings P1DIR = 0x01; // Set P1.0 to output direction P1OUT = 0x00; P1REN = 0x00; while(1){ if ((P1IN & 0x08) == 0x08) P1OUT = 0x01; else P1OUT = 0x00; } }
In this code, i am try to achieve a voltage detecttion, however, i don't know the meaning of code "PM5CTL0 &= ~LOCKLPM5;". if i delete it, the output of specific pin would keep in off state.
So i want to the accurate meaning of the code "PM5CTL0 &= ~LOCKLPM5;" and how to use it correctly.