0
\$\begingroup\$

In our design, pin 4.7 of msp430 is connected to the KILL pin of the ON/OFF switch IC which is active LOW. So when ever I set the pin 4.7 as output in DIR register, the whole circuit turns OFF even though I set the OUTPUT as HIGH immediately. Is there any way to avoid the output going to low when the DIR (direction) register is set as output?

Here is the piece of code that I used:

P4DIR |= BIT7;  //Set KILL pin as OUTPUT
P4OUT |= BIT7;  //Set Kill pin high
\$\endgroup\$
3
  • \$\begingroup\$ Can you post a schematic? But it sounds like maybe you need a pull-up resistor to handle when the I/O pin is high-impedance when the system starts. But otherwise have you tried reversing the order of the above, that should work if that's the real problem. \$\endgroup\$
    – PeterJ
    Commented Jun 13, 2013 at 6:18
  • 3
    \$\begingroup\$ Call me crazy, but can't you simply first set the output to high, THEN the direction as output? \$\endgroup\$ Commented Jun 13, 2013 at 6:22
  • \$\begingroup\$ @apalopohapa: That worked. Silly me.. \$\endgroup\$
    – Akhil
    Commented Jun 13, 2013 at 6:42

1 Answer 1

1
\$\begingroup\$

P4OUT = | BIT7;
P4DIR = | BIT7;

PxOut can be set even if the Px.y is an input. Infact, that's how you decide whether the builtin pull up/down resistor is a up (1) or down (0). (You enable the resistor with PxRen)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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