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.

CCS/MSP430G2553: MSP430G2553, CCS

Part Number: MSP430G2553

Tool/software: Code Composer Studio

Respected Sir/Madam,

How to check & verify the register values in CCS in debug mode?

As I am getting Error:unable to read for below code for IR Sensor interface

int main(void) {

WDTCTL = WDTPW + WDTHOLD; //Stop WDT

BCSCTL1 = CALBC1_8MHZ; //Set DCO to 8Mhz

DCOCTL = CALDCO_8MHZ;

P2DIR |=~0x01; // IR SENSOR IS CONNECTED TO PORT2 OF BIT0

//InitializeLcm(); //INITIALIZE LCD

//__delay_cycles(1000000);

//ClearLcmScreen(); //CLEAR LCD

//__delay_cycles(1000000);
P2DIR |= BIT1;

while(1)

{

if(P2IN == 0x01) // IF IR IS HIGH

{
P2OUT=0x02;

__delay_cycles(1000000);//GIVE SOME DELAY

}

else

{

P2OUT=~0x02;
__delay_cycles(1000000); // GIVE SOME DELAY

}

}
}

  • Hello,

    when debug is active, check this window:

    <<< As I am getting Error:unable to read
    but what to read?

  • Hello,

    P2IN connected has IR Sensor input & P2OUT connected has LED output. P2OUT has to fetch the value 0x01 & blink LED ,when P2IN found obstacle near to it. But When I execute the program in debug mode, the values in P2IN & P2OUT loading with  Error:unable to read.

    Regards,

    Darshan A Bhyratae

  • /*----------------------------------------------------------------------------*/
    /* PERIPHERAL FILE MAP */
    /*----------------------------------------------------------------------------*/

    /* External references resolved by a device-specific linker command file */
    #define SFR_8BIT(address) extern volatile unsigned char address
    #define SFR_16BIT(address) extern volatile unsigned int address
    #define SFR_32BIT(address) extern volatile unsigned long address

    According to my understanding P2DIR, P2IN, P2OUR, etc. are specially treated addresses.
    They are not MCU registers.
    Debugger allows you to check register values on the Registers tab.

    You can use:
    uint8_t p2dir = P2DIR;
    to check PORT values.
  • Darshan A Bhyratae said:
    But When I execute the program in debug mode, the values in P2IN & P2OUT loading with  Error:unable to read.

    Note that MSP430 does not have real-time debug access to the target. This means that the target must be halted for the debugger to read registers and memory.

    Thanks

    ki

  • uint8_t" is undefined, am getting this error in CCS while I built the project
  • Q: but how to send value to PORT2.1
    A: set PORT2.1 bit to 1 without changing other PORT2 bits.

    If your original question got answered, please mark this post as solved.