0
\$\begingroup\$

I am new to programming microcontroller.

what does the following like of code do:

WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD 

i have looked at the technical reference document but i dont understand how the watchdog timer is stopped by that line of code.

can someone please explain how that code works piece by piece.

\$\endgroup\$
5
\$\begingroup\$

Go to TI's web site and locate the main page for your MSP430 processor. (I'm not as familiar with the MSP432.) For example, here is the site for the MSP430G2553. Once there, find and get the User Guide for the family. For example, this MSP430G2553 User Guide -- SLAU144J. Once you have that, go find the section on the Watchdog and look up the control register (WDTCTL) page: in this case, it would be on page 347 of SLAU144J. There you should easily see what that line does, and why. One part is the required password. The other part is a bit that enables or disables the watchdog. Setting it to a "1" disables it. ORing the bit and the password together is a quick way of creating the right constant. This is then simply written to the control register.

If you are having a hard time finding your way around the documents, I see many more questions ahead for you.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.