GBAmp3 Mod PCB Order Now
also available at retromodding.comand Deadpan Robot

Tuesday, June 26, 2012

TI LaunchPad with OLED

ti launchpad oled

Have not time til this week to play with my little OLED display which I won in Seeed Studio lottery last year.
Connected it to TI LaunchPad. Made a little library to control it. Pixels addressing is a bit confusing. Had to do a font converter to make big digits font suitable to send to display without much processing in micro.
Anyway, it is equipped with SSD1308 controller with i2c bus on connector. Used my oldy USI i2c driver library.
Code which outputs those digits:

 i2c_init();
 i2c_wait_for_device(oled_addr_w);
 P1OUT |= LED_RED;

 oled_command(OLED_DISPLAY_OFF); // off
 oled_command_arg(OLED_CONTRAST, 255);
 oled_command(OLED_DISPLAY_RAM);
 oled_command(OLED_NORMAL);
 oled_command_arg(OLED_CLOCK, (15 << 4)|0); // 0b1111 0000 fastest clock
 oled_command_arg(OLED_PRECHARGE, (3 << 4)|(3)); // 3 dclk for 1 and 2 phase precharge
 oled_command_arg(OLED_ADDRESSING_MODE, OLED_ADDRESSING_HORIZONTAL);
 oled_command_arg2(OLED_COLUMN_ADDRESS, 0, 127); // column address from 0 to 127
 oled_command_arg2(OLED_PAGE_ADDRESS, 0, 7); // page address from 0 to 7

 unsigned int i;
 // clear display
 oled_start_write_data();
 for (i = 0; i < 128*8; i++) {
  oled_data(0);
 }
 oled_stop_write();

 oled_command_arg2(OLED_COLUMN_ADDRESS, 0, 127); // column address from 0 to 127
 oled_command_arg2(OLED_PAGE_ADDRESS, 0, 7); // page address from 0 to 7

 oled_print_big_digit(0, 0, 0);
 oled_print_big_digit(1, 1, 0);
 oled_print_big_digit(2, 2, 0);
 oled_print_big_digit(3, 3, 0);
 oled_print_big_digit(4, 4, 0);
 oled_print_big_digit(5, 0, 1);
 oled_print_big_digit(6, 1, 1);
 oled_print_big_digit(7, 2, 1);
 oled_print_big_digit(8, 3, 1);
 oled_print_big_digit(9, 4, 1);

 oled_command(OLED_DISPLAY_ON);

Not much memory left in MSP430G2231, so I'm going to port this library to AVR for my projects.
Display is really great, easy to read. This should be low power, but in off state module eats about 4mA. I guess it is because of 3.3v to 12v converter on board.
Seeed Studio does not has this module anymore but has another one even smaller: OLED 128x64