Sending Text
Sending text to a display from a Javelin Stamp.
Before you start...
You need to either set your LCD for TTL levels or add a RS232 chip to you circuit. For setting the LCD to TTL levels, please consult the manual for your display.
Connecting the LCD to the Javelin Stamp (Hardware)...
We used bread board cable and connect the pins to pin #2, #3 and #5.
Pin #2 is connected to P0
Pin #3 is connected to P1
Pin #5 is connectod to Vss, which is ground
Code Examples
Connecting the LCD to the Javelin Stamp (Software)...
Before you can communicate with the LCD you need to create a Virtual UART Peripheral to communicate with the LCD.
// Uart.dirTransmit -> Uart will be used to transmit data only.
// CPU.pin0 -> Pin used to transmit data
// Uart.dontInvert -> data is not inverted
// Uart.speed19200 -> serial data transfer speed (baud rate)
// Uart.stop1 -> Number of stop bits used is 1
static Uart txUart = new Uart(Uart.dirTransmit, CPU.pin0, Uart.dontInvert, Uart.speed19200, Uart.stop1 );
Sending text to the screen:
Now that you have a connection to the LCD sending text is very easy. Just send each byte (character) at a time like this...
txUart.sendByte(0x43); // letter 'C' ASCII code
txUart.sendByte(0x6F); // letter 'o' ASCII code
txUart.sendByte(0x6F); // letter 'o' ASCII code
txUart.sendByte(0x6C); // letter 'l' ASCII code
OR even better send the whole string at once...
txUart.sendString("Cool"); // Send string "Cool"
Your display should display the word "Cool" after running this code.
For technical discussions and questions, please visit our forums
You need to either set your LCD for TTL levels or add a RS232 chip to you circuit. For setting the LCD to TTL levels, please consult the manual for your display.
Connecting the LCD to the Javelin Stamp (Hardware)...
We used bread board cable and connect the pins to pin #2, #3 and #5.
Pin #2 is connected to P0
Pin #3 is connected to P1
Pin #5 is connectod to Vss, which is ground
Code Examples
Connecting the LCD to the Javelin Stamp (Software)...
Before you can communicate with the LCD you need to create a Virtual UART Peripheral to communicate with the LCD.
// Uart.dirTransmit -> Uart will be used to transmit data only.
// CPU.pin0 -> Pin used to transmit data
// Uart.dontInvert -> data is not inverted
// Uart.speed19200 -> serial data transfer speed (baud rate)
// Uart.stop1 -> Number of stop bits used is 1
static Uart txUart = new Uart(Uart.dirTransmit, CPU.pin0, Uart.dontInvert, Uart.speed19200, Uart.stop1 );
Sending text to the screen:
Now that you have a connection to the LCD sending text is very easy. Just send each byte (character) at a time like this...
txUart.sendByte(0x43); // letter 'C' ASCII code
txUart.sendByte(0x6F); // letter 'o' ASCII code
txUart.sendByte(0x6F); // letter 'o' ASCII code
txUart.sendByte(0x6C); // letter 'l' ASCII code
OR even better send the whole string at once...
txUart.sendString("Cool"); // Send string "Cool"
Your display should display the word "Cool" after running this code.
For technical discussions and questions, please visit our forums
