Connected one of those
http://www.newhavendisplay.com/lcd-chiponglass-128-x-32-c-3_113.html
to the launchpad. These are really tiny chip-on-glass LCD displays. The visible area is 8 x 32mm.
More tricky than the software is the hardware: in order to work, I had to connect nine 1uF ceramic caps
to the display (I guess that with the chip-on-glass display it is not possible to integrate the caps into he display).
Made a small,hand etched, one sided PCB, to accomodate the caps and to change from the weird 1.5mm connector
pitch to a 2.54 one.
6502 for size comparison only ;-)
RobG's Nokia software helped me to get the hardware SPI right. Software-SPI, works as well, advantage is the free choice
of the pins, but more processor time is wasted for the display.
I measured 85uA, with the example clock program (Display + MSP in LPM3), without backlight. So power-wise this
fits perfectly with the MSP.
Official working voltage is 2.7-3.3V. The 3.6V of the LP are the maximum rating for the display.
The backlight is already bright enough for me with 2mA. So switching the backlight on/offwith an extra pin would be easy.
#include "msp430g2553.h"
const unsigned char font5x8[][5] ={
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, // sp
{ 0x00, 0x00, 0x2f, 0x00, 0x00 }, // !
{ 0x00, 0x07, 0x00, 0x07, 0x00 }, // "
{ 0x14, 0x7f, 0x14, 0x7f, 0x14 }, // #
{ 0x24, 0x2a, 0x7f, 0x2a, 0x12 }, // $
{ 0x62, 0x64, 0x08, 0x13, 0x23 }, // %
{ 0x36, 0x49, 0x55, 0x22, 0x50 }, // &
{ 0x00, 0x05, 0x03, 0x00, 0x00 }, // '
{ 0x00, 0x1c, 0x22, 0x41, 0x00 }, // (
{ 0x00, 0x41, 0x22, 0x1c, 0x00 }, // )
{ 0x14, 0x08, 0x3E, 0x08, 0x14 }, // *
{ 0x08, 0x08, 0x3E, 0x08, 0x08 }, // +
{ 0x00, 0x00, 0x50, 0x30, 0x00 }, // ,
{ 0x08, 0x08, 0x08, 0x08, 0x08 }, // -
{ 0x00, 0x60, 0x60, 0x00, 0x00 }, // .
{ 0x20, 0x10, 0x08, 0x04, 0x02 }, // /
{ 0x3E, 0x51, 0x49, 0x45, 0x3E }, // 0
{ 0x00, 0x42, 0x7F, 0x40, 0x00 }, // 1
{ 0x42, 0x61, 0x51, 0x49, 0x46 }, // 2
{ 0x21, 0x41, 0x45, 0x4B, 0x31 }, // 3
{ 0x18, 0x14, 0x12, 0x7F, 0x10 }, // 4
{ 0x27, 0x45, 0x45, 0x45, 0x39 }, // 5
{ 0x3C, 0x4A, 0x49, 0x49, 0x30 }, // 6
{ 0x01, 0x71, 0x09, 0x05, 0x03 }, // 7
{ 0x36, 0x49, 0x49, 0x49, 0x36 }, // 8
{ 0x06, 0x49, 0x49, 0x29, 0x1E }, // 9
{ 0x00, 0x36, 0x36, 0x00, 0x00 }, // :
{ 0x00, 0x56, 0x36, 0x00, 0x00 }, // ;
{ 0x08, 0x14, 0x22, 0x41, 0x00 }, // <
{ 0x14, 0x14, 0x14, 0x14, 0x14 }, // =
{ 0x00, 0x41, 0x22, 0x14, 0x08 }, // >
{ 0x02, 0x01, 0x51, 0x09, 0x06 }, // ?
{ 0x32, 0x49, 0x59, 0x51, 0x3E }, // @
{ 0x7C, 0x12, 0x11, 0x12, 0x7C }, // A
{ 0x7F, 0x49, 0x49, 0x49, 0x36 }, // B
{ 0x3E, 0x41, 0x41, 0x41, 0x22 }, // C
{ 0x7F, 0x41, 0x41, 0x22, 0x1C }, // D
{ 0x7F, 0x49, 0x49, 0x49, 0x41 }, // E
{ 0x7F, 0x09, 0x09, 0x09, 0x01 }, // F
{ 0x3E, 0x41, 0x49, 0x49, 0x7A }, // G
{ 0x7F, 0x08, 0x08, 0x08, 0x7F }, // H
{ 0x00, 0x41, 0x7F, 0x41, 0x00 }, // I
{ 0x20, 0x40, 0x41, 0x3F, 0x01 }, // J
{ 0x7F, 0x08, 0x14, 0x22, 0x41 }, // K
{ 0x7F, 0x40, 0x40, 0x40, 0x40 }, // L
{ 0x7F, 0x02, 0x0C, 0x02, 0x7F }, // M
{ 0x7F, 0x04, 0x08, 0x10, 0x7F }, // N
{ 0x3E, 0x41, 0x41, 0x41, 0x3E }, // O
{ 0x7F, 0x09, 0x09, 0x09, 0x06 }, // P
{ 0x3E, 0x41, 0x51, 0x21, 0x5E }, // Q
{ 0x7F, 0x09, 0x19, 0x29, 0x46 }, // R
{ 0x46, 0x49, 0x49, 0x49, 0x31 }, // S
{ 0x01, 0x01, 0x7F, 0x01, 0x01 }, // T
{ 0x3F, 0x40, 0x40, 0x40, 0x3F }, // U
{ 0x1F, 0x20, 0x40, 0x20, 0x1F }, // V
{ 0x3F, 0x40, 0x38, 0x40, 0x3F }, // W
{ 0x63, 0x14, 0x08, 0x14, 0x63 }, // X
{ 0x07, 0x08, 0x70, 0x08, 0x07 }, // Y
{ 0x61, 0x51, 0x49, 0x45, 0x43 }, // Z
{ 0x00, 0x7F, 0x41, 0x41, 0x00 }, // [
{ 0x04, 0x08, 0x10, 0x20, 0x40 }, // /
{ 0x00, 0x41, 0x41, 0x7F, 0x00 }, // ]
{ 0x04, 0x02, 0x01, 0x02, 0x04 }, // ^
{ 0x40, 0x40, 0x40, 0x40, 0x40 }, // _
{ 0x00, 0x01, 0x02, 0x04, 0x00 }, // '
{ 0x20, 0x54, 0x54, 0x54, 0x78 }, // a
{ 0x7F, 0x48, 0x44, 0x44, 0x38 }, // b
{ 0x38, 0x44, 0x44, 0x44, 0x20 }, // c
{ 0x38, 0x44, 0x44, 0x48, 0x7F }, // d
{ 0x38, 0x54, 0x54, 0x54, 0x18 }, // e
{ 0x08, 0x7E, 0x09, 0x01, 0x02 }, // f
{ 0x18, 0xA4, 0xA4, 0xA4, 0x7C }, // g
{ 0x7F, 0x08, 0x04, 0x04, 0x78 }, // h
{ 0x00, 0x44, 0x7D, 0x40, 0x00 }, // i
{ 0x40, 0x80, 0x84, 0x7D, 0x00 }, // j
{ 0x7F, 0x10, 0x28, 0x44, 0x00 }, // k
{ 0x00, 0x41, 0x7F, 0x40, 0x00 }, // l
{ 0x7C, 0x04, 0x18, 0x04, 0x78 }, // m
{ 0x7C, 0x08, 0x04, 0x04, 0x78 }, // n
{ 0x38, 0x44, 0x44, 0x44, 0x38 }, // o
{ 0xFC, 0x24, 0x24, 0x24, 0x18 }, // p
{ 0x18, 0x24, 0x24, 0x18, 0xFC }, // q
{ 0x7C, 0x08, 0x04, 0x04, 0x08 }, // r
{ 0x48, 0x54, 0x54, 0x54, 0x20 }, // s
{ 0x04, 0x3F, 0x44, 0x40, 0x20 }, // t
{ 0x3C, 0x40, 0x40, 0x20, 0x7C }, // u
{ 0x1C, 0x20, 0x40, 0x20, 0x1C }, // v
{ 0x3C, 0x40, 0x30, 0x40, 0x3C }, // w
{ 0x44, 0x28, 0x10, 0x28, 0x44 }, // x
{ 0x1C, 0xA0, 0xA0, 0xA0, 0x7C }, // y
{ 0x44, 0x64, 0x54, 0x4C, 0x44 }, // z
{ 0x08, 0x36, 0x41, 0x41, 0x00 }, // {
{ 0x00, 0x00, 0x7F, 0x00, 0x00 }, // |
{ 0x41, 0x41, 0x36, 0x08, 0x00 }, // }
{ 0x02, 0x04, 0x02, 0x01, 0x02 } // ~
};
unsigned char hour=12, min, sec,j;
void clearline(unsigned char);
void clearall(void);
void print( char* s);
void gotoXy(unsigned char , unsigned char);
void printc(unsigned char r);
void sendData(unsigned char data);
void sendCmd(unsigned char cmd);
//lcd connected to port 0
#define A0 BIT2
#define CS BIT3
#define SCK BIT5
#define SDA BIT7
#define RST BIT6
void main(void) {
WDTCTL = WDT_ADLY_1000; // WDT 1sec, ACLK, interval timer
IE1 |= WDTIE; // Enable WDT interrupt
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
P1DIR = 0b11101100;
P1REN = 0b00010011;
P2REN = 0b00111111;
P1SEL |=SCK + SDA;
P1SEL2|=SCK + SDA;
UCB0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
UCB0CTL1 |= UCSSEL_2; // SMCLK
UCB0BR0 |= 0x01; // 1:1
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST; // clear SW
P1OUT &= ~RST;
__delay_cycles(1000);
P1OUT |= RST;
P1OUT &=~A0;
P1OUT &=~CS;
//Initialize LCD display
//see http://www.newhavendisplay.com/specs/NHD-C12832A1Z-FSRGB-FBW-3V.pdf for command set
sendCmd(0xA1); //ADC select reverse mode
sendCmd(0xA2); // 1/7 bias
sendCmd(0x2F); //VC on, VR on, VF on
sendCmd(0x21); //resistor ratio 3.5
sendCmd(0x81); //set contrast
sendCmd(0x27); //adjust this number to get the best contrast
sendCmd(0xAF); //now turn it on!
clearall();
gotoXy(0,20);
print("MSP430G2553 LCD");
gotoXy(1,35);
print("2015-05-22");
while (1){
sec++;
if (sec==60){
sec=0;
clearline(2);
min++;
if (min==60){
min=0;
hour++;
if (hour==24) hour=0;
}
}
gotoXy(3,40);
printc((hour/10%10)+48);
printc((hour%10)+48);
printc(':');
printc((min/10%10)+48);
printc((min%10)+48);
printc(':');
printc((sec/10%10)+48);
printc((sec%10)+48);
gotoXy(2,sec);
print("Hello World!");
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3 w/interrupt
}
}
// Watchdog Timer interrupt service routine
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void){
__bic_SR_register_on_exit(CPUOFF); // wake up
}
void clearall(void){
unsigned char i;
for(i = 0; i<4 ; i++) clearline(i);
}
void clearline(unsigned char line){
unsigned char j;
sendCmd(0xB0 | line); //sets page(row)
sendCmd(0x10); //sets column address(MSB) to 0 for each page(row)
sendCmd(0x04); //sets Column address(LSB) start, for this display 4
for(j=0;j<128;j++) {sendData(0x00);}
}
void sendData(unsigned char data){
P1OUT |=A0;
UCB0TXBUF = data;
while(!(IFG2 & UCB0TXIFG));
}
void sendCmd(unsigned char cmd){
P1OUT &=~A0;
UCB0TXBUF = cmd;
while(!(IFG2 & UCB0TXIFG));
}
void gotoXy(unsigned char x,unsigned char y){
y+=4; //this display does not show first four lines
sendCmd(0xB0|(x & 0x03));
sendCmd(0x10|((y>>4)));
sendCmd(0x00|(y & 0x0F));
}
void print(char* s){
while(*s) printc(*s++);
}
void printc(unsigned char r){
unsigned char i;
sendData(0);
for (i=0;i<5;i++) sendData(font5x8[r-32][i] );
}