RobG 1,892 Posted September 28, 2012 Author Share Posted September 28, 2012 Here is the code (still needs some work like handling of new line, home, row/col tracking, etc.) 5510_2xx3_UART.c #include "msp430.h" #include "PCD8544.h" typedef unsigned char u_char; typedef unsigned int u_int; #define LCD5110_SCLK_PIN BIT5 #define LCD5110_DN_PIN BIT7 #define LCD5110_SCE_PIN BIT2 #define LCD5110_DC_PIN BIT0 #define LCD5110_SELECT P2OUT &= ~LCD5110_SCE_PIN #define LCD5110_DESELECT P2OUT |= LCD5110_SCE_PIN #define LCD5110_SET_COMMAND P2OUT &= ~LCD5110_DC_PIN #define LCD5110_SET_DATA P2OUT |= LCD5110_DC_PIN #define LCD5110_COMMAND 0 #define LCD5110_DATA 1 #define RX_PIN BIT1 void writeStringToLCD(const char *string); void writeCharToLCD(char c); void writeToLCD(char dataCommand, char data); void clearLCD(); void setAddr(char xAddr, char yAddr); void initLCD(); void main(void) { WDTCTL = WDTPW + WDTHOLD; // disable WDT BCSCTL1 = CALBC1_1MHZ; // 1MHz clock DCOCTL = CALDCO_1MHZ; P2OUT |= LCD5110_SCE_PIN; P2DIR |= LCD5110_SCE_PIN; P2OUT |= LCD5110_DC_PIN; P2DIR |= LCD5110_DC_PIN; // setup UCA0 P1SEL |= RX_PIN; P1SEL2 |= RX_PIN; UCA0CTL1 |= UCSSEL_2; UCA0BR0 = 0x68; // 9600@1MHz UCA0BR1 = 0x00; UCA0MCTL = UCBRS_1; UCA0CTL1 &= ~UCSWRST; IE2 |= UCA0RXIE; // setup UCB0 P1SEL |= LCD5110_SCLK_PIN + LCD5110_DN_PIN; P1SEL2 |= LCD5110_SCLK_PIN + LCD5110_DN_PIN; 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 _delay_cycles(500000); initLCD(); clearLCD(); // LCD test writeStringToLCD(" UART to "); writeStringToLCD(" Nokia 5110 "); _delay_cycles(2000000); clearLCD(); _bis_SR_register(GIE); } #pragma vector=USCIAB0RX_VECTOR __interrupt void USCI0RX_ISR(void) { u_char byte = UCA0RXBUF; // copy RX buffer if (byte < 0x20) { if (byte == 0x0C) { clearLCD(); } else if (byte == 0x0A) { //TODO new line } else if (byte == 0x0D) { //TODO carriage return } } else writeCharToLCD(byte); } void writeStringToLCD(const char *string) { while (*string) { writeCharToLCD(*string++); } } void writeCharToLCD(char c) { char i; for (i = 0; i < 5; i++) { writeToLCD(LCD5110_DATA, font[c - 0x20][i]); } writeToLCD(LCD5110_DATA, 0); } void writeToLCD(char dataCommand, char data) { LCD5110_SELECT; if (dataCommand) { LCD5110_SET_DATA; } else { LCD5110_SET_COMMAND; } UCB0TXBUF = data; while (!(IFG2 & UCB0TXIFG)) ; LCD5110_DESELECT; } void clearLCD() { setAddr(0, 0); int c = 0; while (c < PCD8544_MAXBYTES) { writeToLCD(LCD5110_DATA, 0); c++; } setAddr(0, 0); } void setAddr(char xAddr, char yAddr) { writeToLCD(LCD5110_COMMAND, PCD8544_SETXADDR | xAddr); writeToLCD(LCD5110_COMMAND, PCD8544_SETYADDR | yAddr); } void initLCD() { writeToLCD(LCD5110_COMMAND, PCD8544_FUNCTIONSET | PCD8544_EXTENDEDINSTRUCTION); writeToLCD(LCD5110_COMMAND, PCD8544_SETVOP | 0x3F); writeToLCD(LCD5110_COMMAND, PCD8544_SETTEMP | 0x02); writeToLCD(LCD5110_COMMAND, PCD8544_SETBIAS | 0x03); writeToLCD(LCD5110_COMMAND, PCD8544_FUNCTIONSET); writeToLCD(LCD5110_COMMAND, PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL); } PCD8544.h #ifndef PCD8544_H_#define PCD8544_H_ #define PCD8544_POWERDOWN 0x04#define PCD8544_ENTRYMODE 0x02#define PCD8544_EXTENDEDINSTRUCTION 0x01 #define PCD8544_DISPLAYBLANK 0x0#define PCD8544_DISPLAYNORMAL 0x4#define PCD8544_DISPLAYALLON 0x1#define PCD8544_DISPLAYINVERTED 0x5 // H = 0#define PCD8544_FUNCTIONSET 0x20#define PCD8544_DISPLAYCONTROL 0x08#define PCD8544_SETYADDR 0x40#define PCD8544_SETXADDR 0x80#define PCD8544_HPIXELS 84#define PCD8544_VBANKS 6#define PCD8544_MAXBYTES 504 // PCD8544_HPIXELS * PCD8544_VBANKS // H = 1#define PCD8544_SETTEMP 0x04#define PCD8544_SETBIAS 0x10#define PCD8544_SETVOP 0x80 //transform#define NONE 0x00#define FLIP_H 0x01#define FLIP_V 0x02#define ROTATE 0x04 // 90 deg CW#define ROTATE_90_CW ROTATE#define ROTATE_90_CCW (FLIP_H | FLIP_V | ROTATE)#define ROTATE_180 (FLIP_H | FLIP_V) static const char font[][5] = { // basic font {0x00, 0x00, 0x00, 0x00, 0x00} // 20 ,{0x00, 0x00, 0x5f, 0x00, 0x00} // 21 ! ,{0x00, 0x07, 0x00, 0x07, 0x00} // 22 " ,{0x14, 0x7f, 0x14, 0x7f, 0x14} // 23 # ,{0x24, 0x2a, 0x7f, 0x2a, 0x12} // 24 $ ,{0x23, 0x13, 0x08, 0x64, 0x62} // 25 % ,{0x36, 0x49, 0x55, 0x22, 0x50} // 26 & ,{0x00, 0x05, 0x03, 0x00, 0x00} // 27 ' ,{0x00, 0x1c, 0x22, 0x41, 0x00} // 28 ( ,{0x00, 0x41, 0x22, 0x1c, 0x00} // 29 ) ,{0x14, 0x08, 0x3e, 0x08, 0x14} // 2a * ,{0x08, 0x08, 0x3e, 0x08, 0x08} // 2b + ,{0x00, 0x50, 0x30, 0x00, 0x00} // 2c , ,{0x08, 0x08, 0x08, 0x08, 0x08} // 2d - ,{0x00, 0x60, 0x60, 0x00, 0x00} // 2e . ,{0x20, 0x10, 0x08, 0x04, 0x02} // 2f / ,{0x3e, 0x51, 0x49, 0x45, 0x3e} // 30 0 ,{0x00, 0x42, 0x7f, 0x40, 0x00} // 31 1 ,{0x42, 0x61, 0x51, 0x49, 0x46} // 32 2 ,{0x21, 0x41, 0x45, 0x4b, 0x31} // 33 3 ,{0x18, 0x14, 0x12, 0x7f, 0x10} // 34 4 ,{0x27, 0x45, 0x45, 0x45, 0x39} // 35 5 ,{0x3c, 0x4a, 0x49, 0x49, 0x30} // 36 6 ,{0x01, 0x71, 0x09, 0x05, 0x03} // 37 7 ,{0x36, 0x49, 0x49, 0x49, 0x36} // 38 8 ,{0x06, 0x49, 0x49, 0x29, 0x1e} // 39 9 ,{0x00, 0x36, 0x36, 0x00, 0x00} // 3a : ,{0x00, 0x56, 0x36, 0x00, 0x00} // 3b ; ,{0x08, 0x14, 0x22, 0x41, 0x00} // 3c < ,{0x14, 0x14, 0x14, 0x14, 0x14} // 3d = ,{0x00, 0x41, 0x22, 0x14, 0x08} // 3e > ,{0x02, 0x01, 0x51, 0x09, 0x06} // 3f ? ,{0x32, 0x49, 0x79, 0x41, 0x3e} // 40 @ ,{0x7e, 0x11, 0x11, 0x11, 0x7e} // 41 A ,{0x7f, 0x49, 0x49, 0x49, 0x36} // 42 B ,{0x3e, 0x41, 0x41, 0x41, 0x22} // 43 C ,{0x7f, 0x41, 0x41, 0x22, 0x1c} // 44 D ,{0x7f, 0x49, 0x49, 0x49, 0x41} // 45 E ,{0x7f, 0x09, 0x09, 0x09, 0x01} // 46 F ,{0x3e, 0x41, 0x49, 0x49, 0x7a} // 47 G ,{0x7f, 0x08, 0x08, 0x08, 0x7f} // 48 H ,{0x00, 0x41, 0x7f, 0x41, 0x00} // 49 I ,{0x20, 0x40, 0x41, 0x3f, 0x01} // 4a J ,{0x7f, 0x08, 0x14, 0x22, 0x41} // 4b K ,{0x7f, 0x40, 0x40, 0x40, 0x40} // 4c L ,{0x7f, 0x02, 0x0c, 0x02, 0x7f} // 4d M ,{0x7f, 0x04, 0x08, 0x10, 0x7f} // 4e N ,{0x3e, 0x41, 0x41, 0x41, 0x3e} // 4f O ,{0x7f, 0x09, 0x09, 0x09, 0x06} // 50 P ,{0x3e, 0x41, 0x51, 0x21, 0x5e} // 51 Q ,{0x7f, 0x09, 0x19, 0x29, 0x46} // 52 R ,{0x46, 0x49, 0x49, 0x49, 0x31} // 53 S ,{0x01, 0x01, 0x7f, 0x01, 0x01} // 54 T ,{0x3f, 0x40, 0x40, 0x40, 0x3f} // 55 U ,{0x1f, 0x20, 0x40, 0x20, 0x1f} // 56 V ,{0x3f, 0x40, 0x38, 0x40, 0x3f} // 57 W ,{0x63, 0x14, 0x08, 0x14, 0x63} // 58 X ,{0x07, 0x08, 0x70, 0x08, 0x07} // 59 Y ,{0x61, 0x51, 0x49, 0x45, 0x43} // 5a Z ,{0x00, 0x7f, 0x41, 0x41, 0x00} // 5b [ ,{0x02, 0x04, 0x08, 0x10, 0x20} // 5c varvar and bluehash 2 Quote Link to post Share on other sites
varvar 0 Posted October 5, 2012 Share Posted October 5, 2012 I received the bare 5110 board (new blue version) but am at a loss as to how to connect it to the actual Nokia 5110 display and the MSP430 Launchpad (piggybacked). Maybe I am missing something again (I apologize in advance) but while this link does have photos of the new blue board and a schematic, none of the component values are marked and I am not sure what the header banks J1 through J5 are since the bare board does not have any J markings. All I am looking to do is connect the display to the LaunchPad and I understand your board reroutes pins so that it works...Any help that you can provide is much appreciated thanks Quote Link to post Share on other sites
RobG 1,892 Posted October 5, 2012 Author Share Posted October 5, 2012 Hope this picture will help. The only components you need are R1 and C1 (47k and 100nF.) varvar 1 Quote Link to post Share on other sites
bluehash 1,581 Posted November 7, 2012 Share Posted November 7, 2012 Ok i bought 2 of them mine are white and match the blue ones above. Now first off your documation is HORRABLE i realise your not making bank on these things but it would be nice to see links to schematics on the store page and assembly pics and parts locations with a BOM I hate to buy things and feel the need to reverse engineer them to make them work Hey! all you need to do is ask. You do know that the Store is a service for members that know what they are buying. Rob's pretty immediate and prompt at answering questions about schematics because of the the improvements he's made. Quote Link to post Share on other sites
RobG 1,892 Posted November 7, 2012 Author Share Posted November 7, 2012 Here the schematic.The BOM depends on what you want to use it for. If you want to use it as 5110 BP, than the only components you need are R1 and C1 (47k and 100nF.) Other parts are optional and are either jumpers or standard things like 0.1uF bypass caps, or MSP's reset RC (47k/1nF.) Quote Link to post Share on other sites
RobG 1,892 Posted November 7, 2012 Author Share Posted November 7, 2012 Here's the BOM Required for 5110 Booster Pack & stand alone: R8 - backlight resistor 0805 or jumper (either blob of solder or 0ohm 0805) R1* - 47k 0805 (used to reset LCD on power up) C1 - 0.1 0805 R2* - 47k 0805 (used to reset LCD via DC line) *only one is required, R1 or R2 Required for stand alone: IC2 - MSP430G2xxxIPW20 C3 - 0.1 0805 R9 - 47k 0805 C4 - 1nF 0805 optional memory (BP & SA): IC1 - 23Kxxx or 25AAxxx SN package, 23K256-E/SN or 25AA640-I/SN for example C2 - 0.1uF 0805 R6* - when using HOLD, 0ohm 0805 or solder, connects memory's HOLD signal with P2.4 pin R7* - when not using HOLD, 0ohm 0805 or solder *only one is required, R6 or R7 optional, alternate LCD control: R3*, R4*, R5* - when P1.0, P1.4, or P2.3 cannot be used to control LCD, P2.0, P2.1, and P2.2 can be used. 0ohm 0805 or solder. *do not use jumpers on J4 and/or J5 for signals which have R3, R4, or R5 populated GeekDoc 1 Quote Link to post Share on other sites
bluehash 1,581 Posted November 9, 2012 Share Posted November 9, 2012 Documentation topic moved to Suggestions. Quote Link to post Share on other sites
wulfman 17 Posted November 30, 2012 Share Posted November 30, 2012 Be careful about the BLUE backlight versions on ebay they will not work with this board. pinout as follows 1- rst 2-ce 3-dc 4-din 5-clk 6-vcc 7-light 8-gnd bluehash 1 Quote Link to post Share on other sites
bluehash 1,581 Posted March 26, 2013 Share Posted March 26, 2013 Here's the BOM Required for 5110 Booster Pack & stand alone: R8 - backlight resistor 0805 or jumper (either blob of solder or 0ohm 0805) R1* - 47k 0805 (used to reset LCD on power up) C1 - 0.1 0805 R2* - 47k 0805 (used to reset LCD via DC line) *only one is required, R1 or R2 Required for stand alone: IC2 - MSP430G2xxxIPW20 C3 - 0.1 0805 R9 - 47k 0805 C4 - 1nF 0805 optional memory (BP & SA): IC1 - 23Kxxx or 25AAxxx SN package, 23K256-E/SN or 25AA640-I/SN for example C2 - 0.1uF 0805 R6* - when using HOLD, 0ohm 0805 or solder, connects memory's HOLD signal with P2.4 pin R7* - when not using HOLD, 0ohm 0805 or solder *only one is required, R6 or R7 optional, alternate LCD control: R3*, R4*, R5* - when P1.0, P1.4, or P2.3 cannot be used to control LCD, P2.0, P2.1, and P2.2 can be used. 0ohm 0805 or solder. *do not use jumpers on J4 and/or J5 for signals which have R3, R4, or R5 populated Rob, do you have an example to run the above config. I have R1, C1 soldered up. What about R3 and R5. I was going to put up a wiki page for this. Thanks! Quote Link to post Share on other sites
DickB 14 Posted July 1, 2013 Share Posted July 1, 2013 I'm using the Nokia display and breakout board and the LCD code from the MTK3339 GPS project. I'm getting a few random dots on my display but no characters. Bad display maybe? More likely I am doing something wrong. Any suggestions? Quote Link to post Share on other sites
cubeberg 540 Posted July 1, 2013 Share Posted July 1, 2013 I'm using the Nokia display and breakout board and the LCD code from the MTK3339 GPS project. I'm getting a few random dots on my display but no characters. Bad display maybe? More likely I am doing something wrong. Any suggestions? Hm - did you check your pinout? I've seen a couple of different pinouts - they typically differ by color (blue for instance doesn't seem to be the same as Red) Quote Link to post Share on other sites
timb 15 Posted July 13, 2013 Share Posted July 13, 2013 I just picked one of these up to go along with my new LP, but I couldn't seem to find any documentation on the wiki. I realize I need to solder up an RC for the reset (at the very least) but I'm at a bit of a loss as to what all the jumpers do since nothing is labeled. Apparently there should have been some schematics here but all of the images are broken. :-( Quote Link to post Share on other sites
bluehash 1,581 Posted July 13, 2013 Share Posted July 13, 2013 I just picked one of these up to go along with my new LP, but I couldn't seem to find any documentation on the wiki. I realize I need to solder up an RC for the reset (at the very least) but I'm at a bit of a loss as to what all the jumpers do since nothing is labeled. Apparently there should have been some schematics here but all of the images are broken. :-( See here. Could you let me know which images were broken. Quote Link to post Share on other sites
timb 15 Posted July 14, 2013 Share Posted July 14, 2013 Never mind, it's working now! None of the images in this thread were showing up at all. So I still have a couple of questions, I noticed on the first page it's mentioned there's a way to use the board without the RC circuit, but I'm unclear which pads need to be solder bridged and which jumpers need to be set to use the display with no other components. Quote Link to post Share on other sites
RobG 1,892 Posted July 14, 2013 Author Share Posted July 14, 2013 See this post for explanation and this one for the schematic. In addition to P2.1, you can also use P1.0 to reset your LCD, but then you have to use P1.4 for SCE. This reminds me that I should redo this board and use P1.0 for SCE and P1.4 for D/C. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.