I wrote a C program that sends a character to the lcd then jumps the cursor to the 2nd line. I changed my program to send a string and I'm finding these two functions are not doing the job. I'm using bitwise operators to assign the MSB of a char to D7, the next MSB to D6, etc. Can anyone see what's wrong?
Code:
void sendString(char *str)
{
int index = 0;
while (str[index] != 0)
{
sendChar(str[index]);
index++;
}
}
void sendChar(char c)
{
RS = 1;
D7 = (c >> 7) & 1;
D6 = (c >> 6) & 1;
D5 = (c >> 5) & 1;
D4 = (c >> 4) & 1;
enable();
D7 = (c >> 3) & 1;
D6 = (c >> 2) & 1;
D5 = (c >> 1) & 1;
D4 = (c >> 0) & 1;
enable();
delay_ms(200);
}