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.

Error while running program for LCD

Other Parts Discussed in Thread: MSP430F2618

Hello Sir/Madam,

I am using MSP430F2618, and i tried to interface LCD to the device. The program built successfully( am using CCSv4 Core edition) but when i run it i get an error, I do not know why the error, here's the text in the console...

 MSP430: Program loaded. Code Size - Text: 290 bytes  Data: 2 bytes

MSP430: Trouble Reading Memory Block at 0x30f8 on Page 0 of Length 0x3: Could not determine device state

MSP430: Trouble Reading Memory Block at 0x3120 on Page 0 of Length 0xe: No error

my program is...
#include  <msp430x26x.h>
#include<string.h>
#include<stdio.h>
#define en (0x04)
#define rw (0x02)
#define rs (0x01)
void lcd_init(void);
void lcd_cmd(unsigned char val);
void lcd_data(unsigned char val, unsigned char line);
void lcd_delay(unsigned int i);
void lcd_string(unsigned char *p,unsigned char v);
void main(void)
{
  //unsigned char a[] = "Hello";
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  
  lcd_init();
  
  lcd_data(0x31,1);  
}
void lcd_delay(unsigned int i)
{
     unsigned int j,k;
     for(j  = 0; j<i ; j++)
       for(k = 0; k<2000; k++);
}
       
void lcd_cmd(unsigned char val)
{
    lcd_delay(1);
     P7DIR = 0xFF;
     P7OUT = val;
     P8OUT |= en;
     lcd_delay(1);
     P8OUT &= ~rs;
     lcd_delay(1);
    P8OUT &= ~en;
     return;
}
void lcd_data(unsigned char val, unsigned char line)
{
 
     if(line)
         lcd_cmd(0XC0);
     else
         lcd_cmd(0x80);
     P7OUT = val;
     P8OUT |= (rs | en);  //E = 1, RS = 1
 
     
    lcd_delay(1);   
     P8OUT &=(~en);  //E = 0, R/W = 0, RS = 1
     return;
}
void lcd_string(unsigned char *var, unsigned char v)
{
     while(*var)              //till string ends
       lcd_data(*var++,v);  //send characters one by one
}
void lcd_init()
{
     P7DIR = 0xFF;   // D0 to D7 connected to Port 7,output pins
     P8DIR |= (en | rw | rs);  // P8.0 = RS, P8.1 = R/W, P8.2 = E
     P8OUT &= (~en);
     P8OUT &= (~rw);
     lcd_cmd(0x38);  // Function set - 8bit, 5x7 dots, 2 line
     lcd_delay(250); 
     lcd_cmd(0x0E);  // Display on/off ctrl - disp on,cursor on,blink off
     lcd_delay(250); 
     lcd_cmd(0x01);  // Clear Display
     lcd_delay(250); 
     lcd_cmd(0x06);  // Entry mode set - increment cursor(shift right)
     lcd_delay(250); 
}
I got a similar error when i tried the code ADC12_09.c from the code examples...
MSP430: Program loaded. Code Size - Text: 118 bytes  Data: 4 bytes
MSP430: Trouble Reading Memory Block at 0x30fc on Page 0 of Length 0x3: Could not determine device state

**Attention** This is a public forum