Page 1 of 1

Dropped Character on GLK12232-25-SM

Posted: Mon Oct 27, 2008 1:59 pm
by kbaum
I am using a PIC18F4550 to communicate via RS232 to the LCD. I am using a software UART library that came with the Microchip C18 compiler. In response to an encoder I update the text on the LCD. Here is the function I have written to write text to the display:

void DisplayWriteRAMText(char *Text, unsigned char x, unsigned char y,
unsigned char font){
//Set Font
WriteUART(DISP_START_CMD);
WriteUART(DISP_SET_FONT);
WriteUART(font);

//Set Cursor position
WriteUART(DISP_START_CMD);
WriteUART(DISP_SET_CURSOR);
WriteUART(x);
WriteUART(y);

//Send Text
while (!(*Text == \0)){
WriteUART(*Text);
Text++;
}
}

The display is seemingly randomly dropping the leading character. I have single stepped through the code and have found that the pointer is being passed correctly and the text is correct. Any suggestions would be appreciated.

Posted: Tue Oct 28, 2008 2:43 pm
by Paradigm
By the looks of it everything is correct. Nothing is glaringly wrong about your code. The first thing I might be able to suggest is putting some delay between the commands. it's a long shot, and it *shouldn't* be the case since there is a 192 byte buffer, but maybe some bytes are getting dropped because the commands are coming in too quickly. At first, try something obscenely long like 100ms or so.

Failing that, try feeding your PIC18F4550 conversation into a PC and using serial port logging software to see what the conversation looks like. Make sure the PC gets everything consistently.