void PutMessage(const char *Message)
{
char i=0;
while(Message[i]!=0)
PutMessage(Message[i++]); <<------ LOOK AT THIS BIT!!!!
}
LCD_Data(Message[i++]; //send it to the LCD!!!
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
void PutMessage(const char *Message)
{
char i=0;
while(Message[i]!=0)
PutMessage(Message[i++]); <<------ LOOK AT THIS BIT!!!!
}
Yes... I have sim'd it... The const qualifier is correct... He is just calling the wrong function... The compiler is now whinging about a recursive call...He still has his strings in RAM so it won't work.
Mike.
He still has his strings in RAM so it won't work.
Mike.
Yes... I have sim'd it... The const qualifier is correct... He is just calling .
#include<reg51.h>
#define port P1 /* Data pins connected to port P1 */
sbit RS = P2^0; /* RS pin connected to pin 0 of port P2 */
sbit RW = P2^1; /* RW pin connected to pin 1 of port P2 */
sbit EN = P2^2; /* EN pin connected to pin 2 of port P2 */
void DelayUs(unsigned int wait);
void DelayMs(unsigned int wait);
void LCD_Command(unsigned char cmd);
void LCD_Data(unsigned char Data);
void LCD_init();
/* functions for delay */
void DelayUs(unsigned int wait)
{
wait >>= 3;
while(wait--);
}
void DelayMs(unsigned int wait)
{
while(wait--)
DelayUs(1000);
}
/* Function to send command instruction to LCD */
void LCD_Command(unsigned char cmd)
{
port = cmd;
RS=0;
RW=0;
EN=1;
DelayMs(5);
EN=0;
}
/*Function to send display dato LCD */
void LCD_Data(unsigned char Data)
{
port = Data;
RS=1;
RW=0;
EN=1;
DelayMs(5);
EN=0;
}
/* Function to prepare the LCD */
void LCD_init()
{
LCD_Command(0x38);
DelayMs(15);
LCD_Command(0x0c);
DelayMs(15);
LCD_Command(0x01);
DelayMs(15);
LCD_Command(0x81);
DelayMs(15);
}
//Function to send string to LCD
void Putch(const char *Message)
{
while(*Message != 0)
LCD_Data(*Message++);
}
void PutMessage(const char *Message)
{
Putch((const char *) Message);
}
void LcdGoto(unsigned char x, unsigned char y)
{
x += 0x80;
if(y==1) x+=0x40;
LCD_Command(x);
}
void main(void)
{
LCD_init();
while(1)
{
LcdGoto(1,1);
PutMessage("Hello");
LcdGoto(1,2);
PutMessage("Forum");
}
}
You are printing both string on first line while I was printing first stringe in first line and second string in second lineLike this
You just set which line you want it's that easy.You are printing both string on first line while I was printing first string in first line and second string in second line
void PutMessage(const char *Message)
{
while(*message)
Putch(*Message++);
}
void PutMessage(const char *Message)
{
while(*Message!=0)
{
Putch(*Message);
message++;
}
}
Mike ThanksMike.