This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Quick IDE/IAR question (5xx)

So I'm testing an output in which my output pin triggers a couple of transistors to send 12v to a valve. I'm just testing simple code based off of the code examples, modified a bit:

#include <msp430.h>

int main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop WDT
P8DIR |= BIT0; // P8.0 output
P8DIR |= BIT1; // P8.1 output
P8OUT = 0x00;
while(1)
{
P8OUT ^= BIT0; // Toggle P8.0
P8OUT ^= BIT1; // Toggle P8.1
__delay_cycles(750000); // Delay
P8OUT = 0x00;
__delay_cycles(5000000);
}
}

Since i only want to send a 750ms pulse to the solenoid i turn the bits high, then off, followed by a 5s delay.

That's fine and dandy; but when i download the program i get:

Thu Dec 13, 2012 16:44:57: Download complete.
Thu Dec 13, 2012 16:44:57: Loaded debugee: C:\Users\xx\Debug\Exe\Alann IO+.d43
Thu Dec 13, 2012 16:44:58: Target reset

Thu Dec 13, 2012 16:44:58: Failed to read one or more register values (busy).

Now when i run the program i have no breakpoints but it stops at

__delay_cycles(750000); // Delay

with the message 

Thu Dec 13, 2012 16:49:11: Target execution stopped

Any clue why the IDE is not liking this code?

  • Ok well i sort of answered my first question; which was why am i getting the "failed to read one or more register values"

    This is because i had the register viewer window open. Upon closing it and reflashing program i didn't get that message.

    Now my 2nd question is why is target exectution error happening at the delay cycles command?

  • no suggestions on why my code would get hung up on this 750ms~ delay?

  • Brock said:
    Any clue why the IDE is not liking this code?

    I can say wh I don't like this code, but not why the IDE is choking on it.

    While __delay_cycles is there, it is neither the most efficient nor the most effective way to do a delay. However, the WDT is stopped and I don't see why the debugger should complain about stopped execution.

    I rather think that for some reason the MSP doesn't respond properly (this would also explain the other failure with the attached "(busy)") and the debugger gets a timeout. No idea why.

**Attention** This is a public forum