Hello. I need a little help. I try to run an application from MSP430 LaunchPad Portal, namely lcd with msp430. Here is the lcd library:
#ifndef __msp430g2211_h__
#include <msp430g2211.h>
#define __msp430g2211_h__
#endif
//Variabilele globale
char disp[32];
int o,i;
char x;
// Functiile globale
void init_lcm(void); // Function to initialize the LCD_module (LCM)
void putchar(char what); // Function to print a char at current cursor location
void putstr(char *what); // Function to print string from current cursor location
void clr_lcm(void); // Function to clear the LCM display
void lcm_line2(void); // Function to move cursor to start of line 2
void delay(char); // Function to provide delay necessary for certain LCM operations
void strobe(void); // Function to toggle the enable signal after suitable delay
void update_lcm(char *str);// Function to write disp[32] buffer onto the LCM display
// str is a 32 character array
void clr_disp_buffer(void);// Function to flush disp[32] to blank spaces
void tostr(int i,char *str); //Converts Integers to String, useful routine
void tostr(int i,char *s) // Convert Interger to String
{
char *p;
p=s;
if(i >= 200)
p[0]= 2;
else if(i >= 100)
p[0]= 1;
else
p[0]= 0;
p[2]=i%10;
i-=p[2];
i/=10;
p[1]=i%10;
p[3] = 0; // mark end of string
p[2]+=0x30;
p[1]+=0x30;
p[0]+=0x30;
}
void clr_disp_buffer(void)
{
for(char x = 0; x <32; x++)
disp[x] = ' ';
}
void strobe(void)
{ // This is a small function which pulls the Enable pin of the LCM low for some time
P1OUT=P1OUT & 0xF7; //Enable Low
delay(105);
P1OUT=P1OUT | 0x08; //Enable High
delay(85);
}
void init_lcm(void)
{
P1DIR = 0xFF;
P1OUT = 0xFF;
// Set Interface length for the LCM
P1OUT=P1OUT | 0x08; //Pull Enable pin of the LCM High
P1OUT=P1OUT & 0xFB; //Set Command Mode
P1OUT=0x2F;
P1OUT=P1OUT & 0xFB; //Set Command Mode
strobe();
//Since we are now in the 4 bit mode
//Byte wide transmission will now be broken down into 2 parts
//We thus have to transmit the Higher Nibble (HN) first followed by the
//Lower Nibble (LN)
//Enable 2 line mode
//HN
P1OUT=0x2F;
P1OUT=P1OUT & 0xFB; //Set Command Mode
strobe();
//LN
P1OUT=0x8F;
P1OUT=P1OUT & 0xFB; //Set Command Mode
strobe();
//Set Cursor parameters
//HN
P1OUT=0x0F;
P1OUT=P1OUT & 0xFB;
strobe();
//LN
P1OUT=0xFF;
P1OUT=P1OUT & 0xFB;
delay(65);
strobe();
//Bring Cursor to Home Position
//HN
P1OUT=0x0F;
P1OUT=P1OUT & 0xFB;
strobe();
//LN
P1OUT=0x3F;
P1OUT=P1OUT & 0xFB;
strobe();
}
void lcm_line2(void)
{
// Jump to line 2 of LCM
//HN
P1OUT=0xCF;
P1OUT=P1OUT & 0xFB;
strobe();
//LN
P1OUT=0x0F;
P1OUT=P1OUT & 0xFB;
strobe();
}
void update_lcm(char *str)
{ // write whatever is in the disp[32] message buffer onto the LCM
char pos;
// write the first 16 characters
clr_lcm();
for(pos = 0; pos <16; pos++ )
{
putchar(str[pos]);
}
// write the next 16 characters
lcm_line2();// newline ;)
for(pos = 16; pos<32;pos++)
{
putchar(str[pos]);
}
}
void clr_lcm(void)
{
// Clear LCM, Blank Display
//HN
P1OUT=0x0F;
P1OUT=P1OUT & 0xFB;
strobe();
//LN
P1OUT=0x1F;
P1OUT=P1OUT & 0xFB;
strobe();
}
void putchar(char ascii)
{ // function to print the character passed, on the LCM at the current cursor position
// HN
P1OUT=0x0F | ascii ;
P1OUT=P1OUT | 0x01; //Character Mode
delay(115);
strobe();
// LN
P1OUT=0x0F | (ascii<<4); // Remember that now we want to make available
// the lower bits on our 4 bit data bus.
strobe();
}
void putstr(char *str)
{
while (*str)
{
putchar(*str++);
}
}
void delay(char d)
{ // The Hallowed delay function
for(int i = 0; i <2*d;i++);
}
I get this errors: #29 expected an expression
#29 expected an expression, at the lines with red
Everything seems to be correct in this lines, I can'f figure out what is wrong. Any suggestions?
Thanks