Digital Signal Processing LAB 2 REPORT

17
Digital Signal Processing LAB 2 REPORT Programming to display a running text on the OLED Using TMS320C5515 eZDSP TM USB Stick March, 7 th 2014 Đại hc Duy Tân Khoa Điện Điện t

Transcript of Digital Signal Processing LAB 2 REPORT

Page 1: Digital Signal Processing LAB 2 REPORT

Digital Signal Processing

LAB 2 REPORT Programming to display a running text on the OLED

Using TMS320C5515 eZDSPTM USB Stick

March, 7th 2014

Đại học Duy Tân

Khoa Điện – Điện tử

Page 2: Digital Signal Processing LAB 2 REPORT

1 Lab 2 report

March, 7th 2014

Table of Contents

Table of Contents ........................................................... 1

Abstract .......................................................................... 2

Introduction .................................................................... 3

Display a character on the OLED .................................... 4

Display a running text on the OLED ............................... 5

Source codes..................... Error! Bookmark not defined.

Conclusion .................................................................... 15

References .................................................................... 16

Page 3: Digital Signal Processing LAB 2 REPORT

2 Lab 2 report

March, 7th 2014

Abstract

This report introduces the LCD module on the

TMS320C5515 eZDSPTM USB Stick Development

Tool. It also outlines basic steps to configure and

use the module to display a desired running text.

Page 4: Digital Signal Processing LAB 2 REPORT

3 Lab 2 report

March, 7th 2014

Introduction

The LCD module in the TMS320C5515 eZDSPTM USB Stick Development Tool is a 96×16 monochrome OLED display screen. LCD can be a very useful part in any microcontroller based project. It helps to monitor variables and program status with simple texts or numbers.

TMS320C5515 eZdsp™ USB Stick Development Tool’s LCD module

To learn how to use the OLED, we refer to the existing sample codes in the lcd-osd9616

project. The modifications are mainly done in the oled_test.c source code. Additional

information about how to configure the LCD module is got from the SSD1306.pdf acquired

from this link: www.adafruit.com/datasheets/SSD1306.pdf . This driver allows us to:

- Set contrast control.

- Turn on the display.

- Set normal/ inverse display.

- Using various scrolling modes.

- Set indexes for different addressing modes.

- Further hardware configurations ( display start line, segment re-map, etc).

- Set timing and driving scheme ( Clock, Pre-charge Period, etc).

Personal settings are shown in the Source codes section.

Page 5: Digital Signal Processing LAB 2 REPORT

4 Lab 2 report

March, 7th 2014

Display a character on the OLED Our OLED has 96x16 pixels (96 columns x 16 rows) which can demonstrate 2 rows of texts( 96x8

pixels for each row). Based on the existing oled_test.c file, we can design our own characters.

To show a character, the OLED need 5x8 pixels. However, since we need spaces between adjacent

characters and rows, only 4x7 pixels are available for designing. An 8-bit hexadecimal number is

used to expressed an 8-bit column. Due to former conventional programming (can be re-defined),

the hex codes are counted from the most left to most right column.

For example, if we want to display a “1” on the OLED ( as being shown below) , the required hex

codes is {0x40, 0x7F, 0x42, 0x00}

start from here

Bit 0

Bit 1

Bit 2

Bit 3

Bit 4

Bit 5

Bit 6

Bit 7 left blank

left blank

To print out a certain character, we use the subroutine printLetter in the oled_test.c file:

Int16 printLetter(Uint16 l1,Uint16 l2,Uint16 l3,Uint16 l4) {

OSD9616_send(0x40,l1); OSD9616_send(0x40,l2); OSD9616_send(0x40,l3);

OSD9616_send(0x40,l4); OSD9616_send(0x40,0x00); return 0;

}

As we can see, the subroutine automatically prints additional 1x8 pixels ( a blank column ), so we do

not need to care about the fifth blank column.

In this LAB, because the space available for each letter is limited, some characters are not properly

sketched. However, it is just an aesthetic matter. We can still recognize the desired letters.

Page 6: Digital Signal Processing LAB 2 REPORT

5 Lab 2 report

March, 7th 2014

Display a running text on the OLED Based on above technics, we designed various letters to make the required text:

- “ h n nh o o – p i n i n 11 – Group 2 – Thursday 27 Feb,

2014” on the 1st ow.

- “Depa tment of Ele t i al – Electronics Engineering – Ho Chi Minh City University of

Technology – En inee in Ed ation” on the 2nd ow.

Using the same method as being shown in the sample codes, we can make the text scroll

vertically or horizontally. The vertical scroll is fine, the full texts could be shown. However,

due to the limitation of memory, we only have 128 columns each page ( we have 8 pages in

total), and we cannot display the full text with horizontal scroll.

Therefore, we tried a different method to display the full text. We only used 1 pages ( page

0) with no scrolling effect. We displayed a short piece of text( which fits 96 columns),

delayed 1 second, then displayed the next piece of text and repeat the sequence until the

full texts are shown. Here are the steps:

1. Initialize page 0.

2. Print a short text on the OLED.

3. Print additional 30 blanks to ensure the remaining screen space is filled.

4. Delay 1 second.

5. Reinitalize page 0.

6. Repeat steps 2 to 4 until the required texts are finished.

Using this method, the texts a e not eally “ nnin ”. hey j st apea in t n. We t ied a

different method to to this task ( which is presented later in the Conclusion section).

However, due to the lack of time, we did not manage to complete the idea. Therefore, only

the complete codes are shown in this report.

Page 7: Digital Signal Processing LAB 2 REPORT

6 Lab 2 report

March, 7th 2014

Source codes In this source code, for convenience, we print each letter from left to right. Compare to the

sample code, there are 2 difference:

1. The printLetter subroutine is modified so that it prints from left to right.

2. Segment re-map is set from 0 to 95: OSD9616_send(0x00,0xa0); 3. Scrolling settings are neglected.

Note: actually, the modification of printLetter is not necessary. Instead, we can reverse all the hex codes we have made. However, this step requires much more efforts to do. Also, we keep the old hex codes to easily compare the work with our friends. The the oled_test.c is modified as follows: #include"usbstk5515.h" #include"usbstk5515_i2c.h" #include"usbstk5515_gpio.h" #include"lcd.h" #define OSD9616_I2C_ADDR 0x3C // OSD9616 I2C address /* ------------------------------------------------------------------------ * * * * Int16 OSD9616_send( Uint16 comdat, Uint16 data ) * * * * Sends 2 bytes of data to the OSD9616 * * * * ------------------------------------------------------------------------ */ Int16 OSD9616_send( Uint16 comdat, Uint16 data ) { Uint8 cmd[2]; cmd[0] = comdat & 0x00FF; // Specifies whether data is Command or Data cmd[1] = data; // Command / Data return USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 2 ); } /* ------------------------------------------------------------------------ * * * * Int16 OSD9616_multiSend( Uint16 comdat, Uint16 data ) * * * * Sends multiple bytes of data to the OSD9616 * * * * ------------------------------------------------------------------------ */ Int16 OSD9616_multiSend( Uint8* data, Uint16 len ) { Uint16 x; Uint8 cmd[10]; for(x=0;x<len;x++) // Command / Data { cmd[x] = data[x]; } return USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, len );

Page 8: Digital Signal Processing LAB 2 REPORT

7 Lab 2 report

March, 7th 2014

} /* ------------------------------------------------------------------------ * * * * Int16 printLetter(Uint16 l1,Uint16 l2,Uint16 l3,Uint16 l4) * * * * Send 4 bytes representing a Character * * * * ------------------------------------------------------------------------ */ Int16 printLetter(Uint16 l1,Uint16 l2,Uint16 l3,Uint16 l4) { OSD9616_send(0x40,l4); OSD9616_send(0x40,l3); OSD9616_send(0x40,l2); OSD9616_send(0x40,l1); OSD9616_send(0x40,0x00); return 0; } /* ------------------------------------------------------------------------ * * * * Int16 oled_test() * * * * Testing function for the OSD9616 display * * * * ------------------------------------------------------------------------ */ Int16 oled_test() { Int16 i; Uint8 cmd[10]; // For multibyte commands /* Initialize I2C */ USBSTK5515_I2C_init( ); /* Initialize LCD power */ USBSTK5515_GPIO_setDirection( 12, 1 ); // Output USBSTK5515_GPIO_setOutput( 12, 1 ); // Enable 13V /* Initialize OSD9616 display */ OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0x40); // Set start line address cmd[0] = 0x00 & 0x00FF; // Set contrast control register cmd[1] = 0x81; cmd[2] = 0x7f; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 ); OSD9616_send(0x00,0xa0); // Set segment re-map 0 to 95 OSD9616_send(0x00,0xa6); // Set normal display cmd[0] = 0x00 & 0x00FF; // Set multiplex ratio(1 to 16) cmd[1] = 0xa8; cmd[2] = 0x0f; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 ); OSD9616_send(0x00,0xd3); // Set display offset

Page 9: Digital Signal Processing LAB 2 REPORT

8 Lab 2 report

March, 7th 2014

OSD9616_send(0x00,0x00); // Not offset OSD9616_send(0x00,0xd5); // Set display clock divide ratio/oscillator frequency OSD9616_send(0x00,0xf0); // Set divide ratio cmd[0] = 0x00 & 0x00FF; // Set pre-charge period cmd[1] = 0xd9; cmd[2] = 0x22; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 ); cmd[0] = 0x00 & 0x00FF; // Set com pins hardware configuration cmd[1] = 0xda; cmd[2] = 0x02; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 ); OSD9616_send(0x00,0xdb); // Set vcomh OSD9616_send(0x00,0x49); // 0.83*vref cmd[0] = 0x00 & 0x00FF; //--set DC-DC enable cmd[1] = 0x8d; cmd[2] = 0x14; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 ); OSD9616_send(0x00,0xaf); // Turn on oled panel /* Fill page 0*/ OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 for(i=0;i<128;i++) { OSD9616_send(0x40,0xff); } /* Write to page 0( Vietnamese) */ OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x22,0x41,0x41,0x3e); // C printLetter(0x70,0x08,0x10,0x7F); // h printLetter(0x3f,0x40,0x40,0x38); // ư printLetter(0x36,0x48,0x48,0x30); // ơ printLetter(0x70,0x08,0x08,0x70); // n printLetter(0x3f,0x49,0x49,0x06); // g printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x01,0x7F,0x01,0x01); // T printLetter(0x04,0x04,0x08,0x7c); // r printLetter(0x00,0x00,0x7A,0x01); // i` printLetter(0x70,0x08,0x08,0x70); // n printLetter(0x70,0x08,0x10,0x7F); // h for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks

Page 10: Digital Signal Processing LAB 2 REPORT

9 Lab 2 report

March, 7th 2014

OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x3e,0x41,0x49,0x7f); // Ð printLetter(0x40,0x7a,0x49,0x30); // a` printLetter(0x30,0x48,0x48,0x30); // o printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x01,0x7F,0x01,0x01); // T printLetter(0x10,0x1e,0x52,0x0c); // printLetter(0x30,0x48,0x48,0x30); // o for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x7f,0x61,0x41,0x3e); // Q printLetter(0x38,0x40,0x40,0x38); // u printLetter(0x35,0x4a,0x4a,0x34); // ô´ printLetter(0x48,0x48,0x48,0x30); // c printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x01,0x7F,0x01,0x01); // T printLetter(0x15,0x5a,0x5a,0x34); // ê´ printLetter(0x08,0x08,0x08,0x08); // - for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x40,0x40,0x40,0x7f); // L printLetter(0x36,0x48,0x49,0x32); // printLetter(0x06,0x09,0x09,0x7f); // p printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x01,0x7F,0x01,0x01); // T printLetter(0x00,0x00,0x7a,0x00); // i printLetter(0x14,0x5a,0x5a,0x34); // ê printLetter(0x70,0x08,0x08,0x70); // n printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x01,0x7F,0x01,0x01); // T printLetter(0x00,0x00,0x7a,0x00); // i printLetter(0x15,0x5a,0x5a,0x34); // ê´ printLetter(0x70,0x08,0x08,0x70); // n printLetter(0x00,0x00,0x00,0x00); // SPACE

Page 11: Digital Signal Processing LAB 2 REPORT

10 Lab 2 report

March, 7th 2014

printLetter(0x22,0x41,0x41,0x3e); // C printLetter(0x01,0x7F,0x01,0x01); // T printLetter(0x40,0x7F,0x42,0x44); // 1 printLetter(0x40,0x7F,0x42,0x44); // 1 printLetter(0x08,0x08,0x08,0x08); // - for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x7A,0x49,0x41,0x3e); // G printLetter(0x04,0x04,0x08,0x7c); // r printLetter(0x30,0x48,0x48,0x30); // o printLetter(0x38,0x40,0x40,0x38); // u printLetter(0x06,0x09,0x09,0x7f); // p printLetter(0x47,0x49,0x51,0x61); // 2 printLetter(0x08,0x08,0x08,0x08); // - for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x01,0x7F,0x01,0x01); // T printLetter(0x70,0x08,0x10,0x7F); // h printLetter(0x38,0x40,0x40,0x38); // u printLetter(0x04,0x04,0x08,0x7C); // r printLetter(0x24,0x54,0x54,0x48); // s printLetter(0x7F,0x48,0x48,0x30); // d printLetter(0x40,0x78,0x48,0x30); // a printLetter(0x3F,0x48,0x48,0x07); // y for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x47,0x49,0x51,0x61); // 2 printLetter(0x07,0x09,0x11,0x61); // 7 printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x01,0x09,0x09,0x7F); // F printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x30,0x48,0x48,0x7F); // b printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x47,0x49,0x51,0x61); // 2

Page 12: Digital Signal Processing LAB 2 REPORT

11 Lab 2 report

March, 7th 2014

printLetter(0x00,0x78,0x48,0x78); // 0 printLetter(0x40,0x7F,0x42,0x44); // 1 printLetter(0x7f,0x08,0x08,0x0F); // 4 for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks /* Write to page 0( English) */ OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x3E,0x41,0x41,0x7F); // D printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x08,0x14,0x14,0x7c); // p printLetter(0x7c,0x4a,0x4a,0x30); // a printLetter(0x08,0x08,0x10,0x78); // r printLetter(0x08,0x7c,0x08,0x00); // t printLetter(0x78,0x10,0x78,0x78); // m printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x08,0x7c,0x08,0x00); // t printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x30,0x48,0x48,0x30); // o printLetter(0x09,0x09,0x7e,0x08); // f for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x41,0x49,0x49,0x7f); // E printLetter(0x00,0x7f,0x00,0x00); // l printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x48,0x48,0x48,0x30); // c printLetter(0x08,0x7c,0x08,0x00); // t printLetter(0x08,0x08,0x10,0x78); // r printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x48,0x48,0x48,0x30); // c printLetter(0x7c,0x4a,0x4a,0x30); // a printLetter(0x00,0x7f,0x00,0x00); // l printLetter(0x08,0x08,0x08,0x08); // - for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x41,0x49,0x49,0x7f); // E printLetter(0x00,0x7f,0x00,0x00); // l printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x48,0x48,0x48,0x30); // c printLetter(0x08,0x7c,0x08,0x00); // t

Page 13: Digital Signal Processing LAB 2 REPORT

12 Lab 2 report

March, 7th 2014

printLetter(0x08,0x08,0x10,0x78); // r printLetter(0x30,0x48,0x48,0x30); // o printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x48,0x48,0x48,0x30); // c printLetter(0x24,0x54,0x54,0x44); // s for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x41,0x49,0x49,0x7f); // E printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x26,0x59,0x49,0x26); // g printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x08,0x08,0x10,0x78); // r printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x26,0x59,0x49,0x26); // g printLetter(0x08,0x08,0x08,0x08); // - for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x7f,0x08,0x08,0x7f); // H printLetter(0x30,0x48,0x48,0x30); // o printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x22,0x41,0x41,0x3E); // C printLetter(0x70,0x08,0x08,0x7f); // h printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x7F,0x06,0x06,0x7F); // M printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x70,0x08,0x08,0x7f); // h printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x22,0x41,0x41,0x3E); // C printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x08,0x7c,0x08,0x00); // t printLetter(0x3f,0x48,0x48,0x0f); // y printLetter(0x08,0x08,0x08,0x08); // -

Page 14: Digital Signal Processing LAB 2 REPORT

13 Lab 2 report

March, 7th 2014

for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x3F,0x40,0x40,0x3F); // U printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x18,0x20,0x40,0x38); // v printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x08,0x08,0x10,0x78); // r printLetter(0x24,0x54,0x54,0x44); // s printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x08,0x7c,0x08,0x00); // t printLetter(0x3f,0x48,0x48,0x0f); // y printLetter(0x00,0x00,0x00,0x00); // SPACE printLetter(0x30,0x48,0x48,0x30); // o printLetter(0x09,0x09,0x7e,0x08); // f for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x01,0x7F,0x01,0x01); // T printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x48,0x48,0x48,0x30); // c printLetter(0x70,0x08,0x08,0x7f); // h printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x30,0x48,0x48,0x30); // o printLetter(0x00,0x7f,0x00,0x00); // l printLetter(0x30,0x48,0x48,0x30); // o printLetter(0x26,0x59,0x49,0x26); // g printLetter(0x3f,0x48,0x48,0x0f); // y printLetter(0x08,0x08,0x08,0x08); // - for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x41,0x49,0x49,0x7f); // E printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x26,0x59,0x49,0x26); // g printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x10,0x58,0x58,0x30); // e printLetter(0x08,0x08,0x10,0x78); // r printLetter(0x00,0x7a,0x00,0x00); // i

Page 15: Digital Signal Processing LAB 2 REPORT

14 Lab 2 report

March, 7th 2014

printLetter(0x70,0x08,0x08,0x71); // n printLetter(0x26,0x59,0x49,0x26); // g for(i=0;i<30;i++) OSD9616_send(0x40,0xff); //add 30 blanks OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0xb0+0); // Set page for page 0 to page 5 printLetter(0x41,0x49,0x49,0x7f); // E printLetter(0x7f,0x48,0x48,0x30); // d printLetter(0x38,0x40,0x40,0x38); // u printLetter(0x48,0x48,0x48,0x30); // c printLetter(0x7c,0x4a,0x4a,0x30); // a printLetter(0x08,0x7c,0x08,0x00); // t printLetter(0x00,0x7a,0x00,0x00); // i printLetter(0x30,0x48,0x48,0x30); // o printLetter(0x70,0x08,0x08,0x71); // n return 0; }

Page 16: Digital Signal Processing LAB 2 REPORT

15 Lab 2 report

March, 7th 2014

Conclusion

In this lab experiment session, we succeeded to get the sample codes run on the OLED. We

also succeeded to design and display the required texts on the OLED.

Howeve , we o ld not let the f ll texts have the pe fe t “ nnin ” effe t. Instead, they

only appea ed in t n( we an make the “ nnin ” effe t this way by letting the texts

change one letter each time. However, this seems inefficicent since the codes would be too

long and hard to be kept up with).

Based on the above idea, we tried another method which theoretically can display any

length of text with ease. We notice the use of the code line [ OSD9616_send(0x40,L1);] in

the printLetter subroutine and use it show the whole text. We know that L1 is the hex

code of a column. Therefore, we set up an array of our whole text whose each letter is

p esented by 5 onse tive hex odes. Fo example, if we want to display the text “Data”

on the OLED, our array is defined as:

Uint16 myText[] = { 0x3E,0x41,0x41,0x7F,0x00, //D 0x7c,0x4a,0x4a,0x30,0x00, //a 0x08,0x7c,0x08,0x00,0x00, //t 0x7c,0x4a,0x4a,0x30,0x00, //a };

The array has 4 elements. In the oled_text subroutine, we run the text by using the

followin “fo ” loop:

int string_length = 4; int i,j; for (j=0;;j++) { if (j == string_length) j=0; for(i = j;i <= j + string_length - 1 ; i++) { OSD9616_send(0x40, myText[i%string_length]); } }

Finally, we can make the text run( no delay is required since we saw that the OLED already

needed an enough-to-be-seen period to display the whole text on the screen). Athough we

did not finish this experiment, this method seems better because the the codes are easier

to use and modify for future purposes.

Page 17: Digital Signal Processing LAB 2 REPORT

16 Lab 2 report

March, 7th 2014

References

[1] Texas Instruments, C5515 eZDSP USB Stick Development Tool description and features,

http://www.ti.com/tool/tmdx5515ezdsp, retrieved on February, 27th 2014.

[2] sensorasia, TMS320C5515_eZdip_USB stick.MP4,

http://www.youtube.com/watch?v=ZFnvH1iZoY8, retrieved on February, 27th 2014.

Detailed instructions are taken from the SSD1306.pdf acquired from

www.adafruit.com/datasheets/SSD1306.pdf .

Illustrating images of C5515 eZDSP USB Stick Development Tool are taken from

http://www.ti.com.

All source codes in this report are taken from the usbstk5515_v1 library associated with

C5515 eZDSP USB Stick Development Tool, provided by Spectrum Digital Inc..