Sending Data to Serial LCD
How to send simple text data to the sparkfun LCD backpack
Concept
For embedded projects, it is often helpful to use an LCD screen for data output. This section is written based on experience using this LCD screen from Sparkfun Electronics:
http://www.sparkfun.com/commerce/product_info.php?products_id=461
This device should be powered using 5V and the RX line (receive) should be connected to the TX (transfer) line on the Make Controller. This means that the RX line on the Make Controller may still be available for other use.
Overview
Example code for displaying text on the Sparkfun LCD screen. These may be analogin values or any other variable contained in the code.
void LCDTask( void* p )
{
// Activate the serial port
Serial_SetActive(1);
Serial_SetBaud(9600);
Serial_SetHardwareHandshake(0);
Serial_SetBits(8);
Serial_SetStopBits(0);
Serial_SetParity(0);
int A;//will be an analog input
int H = 5;//hours
int M = 10;//minutes
int S = 25;//seconds
char MESSAGE[16]; //this LCD has 16 characters per line, but this can be increased for longer strings that will use text wrapping
//Fill in your variables with information where necessary
A = AnalogIn_GetValue(7);
//convert quantities to string
strncpy (MESSAGE, "", 16);//clear out the array when necessary
sprintf(MESSAGE ,"%2d:%2d:%2d.%2d\n", H, M, S, A);//pull in any variables you might have into your message string and format them, also goes to next line at the end using\n
Serial_Write((uchar*)MESSAGE, strlen(MESSAGE), 0);//this is the command that actually sends the data to the LCD
}
The output on the LCD screen should look like this:
5:10:25.XXX (where XXX is the value on analogin pin 7)
This LCD screen has some other functions as well that are convenient for changing display properties such as brightness. The Serial_Write() command should be used to send these commands.
Functioning Example
This firmware uses the fasttimer subsystem to keep time. The timer is initiated when analogin 6 goes higher than analogin 7. The time is displayed in (semi)real-time, and the timer is stopped when analogin 6 goes lower than analogin 7.
Display is in spanish!!
http://makingthings.com/Members/tunell/firmwares-of-all-colors/timer-make.c/view

