Dropped Character on GLK12232-25-SM

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
kbaum
LCD?
Posts: 1
Joined: Mon Oct 27, 2008 1:39 pm
Location: Utah, U.S.A.

Dropped Character on GLK12232-25-SM

Post 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.

Paradigm
Matrix Orbital
Matrix Orbital
Posts: 255
Joined: Thu Sep 13, 2001 6:00 pm
Location: Calgary, Alberta, Canada

Post 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.
James McTavish, P.Eng
Director of Engineering
Matrix Orbital

Post Reply