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.

ADC_value unknown Error: Could not read 0x0200: Execution state prevented access

Other Parts Discussed in Thread: MSP430G2553

Hi there,

I have been using the following code in order to read the current sensor data. Which was working fine till last night. Suddenly today is stopped working when I was trying to read the ADC_value data in the expressions section, and it gave me the following error message, 

ADC_value unknown Error: Could not read 0x0200: Execution state prevented access

I havent changed anything in the code or in the hardware, Could anyone please tell me if there is any obvious way to solve the problem?

#include <msp430g2553.h>
// the code posted below will perform a single read from GPIO P1.3 and then assigns the value to ADC10MEM to a variable calledd ADC_Value
// Global Variable


// Global variables
unsigned int ADC_value=0;

// Function prototypes
void ConfigureAdc(void);

void main(void)
{
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
BCSCTL1 = CALBC1_1MHZ; // Set range DCOCTL = CALDCO_1MHZ;
BCSCTL2 &= ~(DIVS_3); // SMCLK = DCO = 1MHz
P1SEL |= BIT3; // ADC input pin P1.3
ConfigureAdc(); // ADC set-up function call
__enable_interrupt(); // Enable interrupts.

while(1)
{
__delay_cycles(1000); // Wait for ADC Ref to settle
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // Low Power Mode 0 with interrupts enabled
ADC_value = ADC10MEM; // Assigns the value held in ADC10MEM to the integer called ADC_value // change the variable name // take another code // try another analog input

}

}
}

// ADC10 interrupt service routine
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR (void)
{
__bic_SR_register_on_exit(CPUOFF); // Return to active mode }
}

// Function containing ADC set-up
void ConfigureAdc(void)
{

ADC10CTL1 = INCH_3 + ADC10DIV_3 ; // Channel 3, ADC10CLK/3
ADC10CTL0 = SREF_0 + ADC10SHT_3 + ADC10ON + ADC10IE; // Vcc & Vss as reference, Sample and hold for 64 Clock cycles, ADC on, ADC interrupt enable
ADC10AE0 |= BIT3; // ADC input enable P1.3
}

I am using msp430g2553 and I have been coding with it for a while but never faced such problem.

Bests,

Tahsina

  • Tahsina,

    Due to the internal architecture of the MSP430, access to memory, registers, etc are only possible when the processor is halted. Therefore the "Execution state prevented access" message indicates the processor is running free and therefore cannot access the element chosen. Something also referenced on the post below:

    e2e.ti.com/.../382114

    There is a way to access registers and memory at the expense of breaking the real-time behaviour, which is by enabling a specific option. The post below mentions this:

    e2e.ti.com/.../407884

    Hope this helps,
    Rafael
  • Hi there,

    Thanks a lot for your reply. As soon as I got rid of the delay(1000), the program seems to run smooth;y without any problem. I am not sure how the delay program was causing problem but getting rid of it seems to solve it.

    Bests,

    Tahsina