Recent Changes - Search:

Home

edit SideBar

LK162-12

Gumstix of Flickr 
LCD on Flickr 

The LK162-12  is a small, inexpensive 16x2 character LCD screen we use for debugging on the robot. We communicate with it over the I2C bus, although it can also be used over a serial line.

The datasheet  was essential in figuring out all the special options for this display.

Notes

The I2C bus and the display require that all the data be send in hexadecimal, so we had to write a bit of code to convert a string to the correct format for display. The C++ code is as follows:

char *text = "Hello World!";
char temp[32];
char toput[128] = "0x";
int i = 0;
while(text[i] != '\0' && i < 32) {
    if (text[i] == '\n' ) { // handles newlines by printing CR and LF
        sprintf(temp, "%s", "0D0A");
    } else {
        sprintf(temp, "%2x", text[i]);
    }
    strcat(toput, temp);
    i++;
}

The string toput that this code produces can be sent to the i2c-api.h function I2cWriteBytes to be printed to the screen. It uses the strcat function from string.h.

Edit - History - Print - Recent Changes - Search
Page last modified on May 15, 2008, at 10:38 PM EST