Tải bản đầy đủ (.pdf) (24 trang)

Digital Signal Processing Lab No. 2 Vietnamese Text Display.pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.6 MB, 24 trang )

lOMoARcPSD|38590726

HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY
FACULTY OF ELECTRICAL AND ELECTRONIC ENGINEERING

---------------o0o---------------

DIGITAL SIGNAL PROCESSING
LAB No. 2: Vietnamese Text Display

Lecturer: Prof. Dr. LE TIEN THUONG 2051131
Course ID: EE2016 2051130
TT06
Class: 5
Group: Phan Van Nguyen Khanh
Member: Nguyen Dinh Khanh

HO CHI MINH CITY, NOVEMBER 30th, 2022

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

Table of Contents
I. ABSTRACT........................................................................................................................ 1
II. INTRODUCTION............................................................................................................. 1
III. PROBLEM......................................................................................................................... 1
IV. APPROACHES.................................................................................................................. 2
V. PROCEDURES.................................................................................................................. 3
VI. RESULTS & CODES......................................................................................................... 4
VII. CONCLUSION................................................................................................................ 16


VIII. REFERENCES................................................................................................................ 16

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

I. ABSTRACT
This report would like to introduce module of TMS320C5515/35 eZDSPTM USB
Stick Development Tool and briefly outline the process of implementing the display of
an desired Vietnamse texts on LCD.

II. INTRODUCTION
LCD of TMS320C5515/35 is a 96x16 OLED display screen which has 96
columns and 16 rows of pixels. The display screen is divided into two rows (in the
presented codes, pages or lines) , so actually we have two 96x8 pages to display a
text.
For this project, to illustrate each character, we need 5x8 pixels. To keep the
space between characters, we use only most right 4x7 pixels for deriving the sets of
desired characters. Each led in LCD is activated by setting to bit HIGH that passing
to sets of DATA rows. Therefore, an array of 4 HEX codes are recommended to
illustrate each proper character. The picture below will clearly show the rules of
writing on LCD.

III. PROBLEM
From example in lcd-osd9616, you will rewrite your required text: “Trường Đại
Học Bách Khoa TPHCM_Chương Trình Tiên Tiến_HK1_2022_23_ Thí nghiệm XỬ
LÝ SỐ TÍN HIỆU” - Make sure the clarity of your characters.

1


Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

Due to the limitation of memory, the screen only displays 128 columns for each

page. Find a solution for showing full text in one-time display.

Capture the result and write a report.

IV. APPROACHES

In this project, all deriving codes are based on sample source files in lcd-

osd9616, in oled_test.c. In order to satisfy the tasks:

Firstly, to print out a character, we mainly used the pre-defined function in C

files, Int16 printLetter ():

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;
}


Where l1 consider as A0, l2 as A1, l3 as A2, l4 as A3.

Noticably,writing the character backwardly is MUST due to its physically on-

chip memory operations.

printLetter(0x40,0x70,0x48,0x30); // a
printLetter(0x00,0x78,0x48,0x78); // o
printLetter(0x00,0x60,0x20,0x78); // h
printLetter(0x41,0x36,0x08,0x7f); // K

Another point is that the pointer to writing address in SDRAM are

automatically increased so no further action to cursor is needed.

Secondly, to make an on-screen running display, some following codes must be

called, with the efforts of sending commands to LCD hardware.

/* Set vertical and horizontal scrolling */
cmd[0] = 0x00;
cmd[1] = 0x29; // Vertical and Right Horizontal Scroll
cmd[2] = 0x00; // Dummy byte
cmd[3] = 0x00; // Define start page address
cmd[4] = 0x01; // Set time interval between each scroll step
cmd[5] = 0x01; // Define end page address
cmd[6] = 0x01; // Vertical scrolling offset
OSD9616_multiSend( cmd, 7 );
OSD9616_send(0x00,0x2f);

/* Keep first 8 rows from vertical scrolling */
cmd[0] = 0x00;
cmd[1] = 0xa3; // Set Vertical Scroll Area
cmd[2] = 0x08; // Set No. of rows in top fixed area
cmd[3] = 0x08; // Set No. of rows in scroll area
OSD9616_multiSend( cmd, 4 );

2

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

Eventually, to repair the limitation of SDRAM, our solutions are to seperate
desired texts into various pieces and display different parts gradually on screen as we
reset the pages. An USBSTK5515_waitusec( Uint32 usec ) system library functions
are necessary as the system-clock is so fast that our human’s eyes are able to
oberserve the LCD screen’s change.

USBSTK5515_waitusec( 7000000 );
/*Re-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);
}
for(i=0;i<128;i++)
{

OSD9616_send(0x40,0x00);}

V. PROCEDURES
Step 1: Use Charset Editor to simulate the letters display on OLED in order to
get the addresses of pixels of that letter. For example, the letter T will give the
address set of (0x01;0x7F;0x01;0x01).

Step 2: Modify the C program (oledtest.h) to display the required characters on
OLED, based on the address set of each character obtained in step 1. Here the
memory of the OLED is limited so we set the OLED to refresh some seconds (delete
old text and overwrite it with new text).

The main program is running in the function oled_test(). Descriptions
as belowed FlowChart:

3

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

Step 3: Capture the results.
4

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

VI. RESULTS & CODES


Results:

5

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

6

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

7

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

8

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

C-file Derived Codes:

/*
* Copyright 2010 by Spectrum Digital Incorporated.

* All rights reserved. Property of Spectrum Digital Incorporated.
*/

/*
* OSD9616 OLED Test
*
*/

#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];

9

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

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
{

cmd[x] = data[x];

}

return USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, len );

}

/* ------------------------------------------------------------------------ *

* *


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

* *

* Send 4 bytes representing a Character *

10

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

* *

* ------------------------------------------------------------------------ */

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;

}

/* ------------------------------------------------------------------------ *

* *

* 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

11

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

/* 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,0xa1); // Set segment re-map 95 to 0
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
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;

12

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

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,0x00);
}
/* Write to 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<5;i++){
for(i=0;i<5;i++)

{
OSD9616_send(0x40,0x00); // Spaces

}

13

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

printLetter(0x08,0x74,0x82,0x75); // ử
printLetter(0x84,0x84,0x7F,0x04); // t
for(i=0;i<5;i++)


{
OSD9616_send(0x40,0x00); // Spaces

}
printLetter(0xF0,0x08,0x08,0xF0); // n
printLetter(0x40,0x2A,0x95,0x2A); // ệ
printLetter(0x80,0x80,0xFA,0x80); // i
printLetter(0x7E,0x89,0xFF,0x08); // Đ
printLetter(0x80,0x80,0x80,0x80); // _
for(i=0;i<5;i++)

{
OSD9616_send(0x40,0x00); // Spaces

}
printLetter(0xF0,0x08,0x08,0xF0); // n
printLetter(0x40,0x2A,0x95,0x2A); // ệ
printLetter(0x80,0x80,0xFA,0x80); // i
printLetter(0x7E,0x89,0xFF,0x08); // Đ
for(i=0;i<5;i++)

{
OSD9616_send(0x40,0x00); // Spaces

}
printLetter(0xF0,0x90,0x90,0x60); // a
printLetter(0x60,0x90,0x90,0x60); // o
printLetter(0xE0,0x10,0x10,0xFF); // h
printLetter(0x81,0x42,0x3C,0xFF); // K

printLetter(0x80,0x80,0x80,0x80); // _

14

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}

printLetter(0x8E,0x91,0xA2,0xC4); // 2
printLetter(0x8E,0x91,0xA2,0xC4); // 2
printLetter(0x7E,0x81,0x81,0x7E); // 0
printLetter(0x8E,0x91,0xA2,0xC4); // 2
printLetter(0x80,0x80,0x80,0x80); // _
USBSTK5515_waitusec( 14000000 );

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,0x00);
}

// USBSTK5515_waitusec( 1000000 );
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<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}

15

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

printLetter(0x80,0xFF,0x82,0x84); // 1
printLetter(0x80,0xFF,0x82,0x84); // 1
for(i=0;i<5;i++)

{
OSD9616_send(0x40,0x00); // Spaces

}

printLetter(0x7E,0x89,0x89,0x86); // g
printLetter(0xF0,0x08,0x08,0xF0); // n
printLetter(0xF2,0x94,0x98,0x60); // á
printLetter(0xE0,0x10,0x10,0xFF); // h
printLetter(0x84,0x84,0x7F,0x04); // t

for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}

printLetter(0x04,0x0A,0x09,0xFF); // p
printLetter(0x40,0x2A,0x95,0x2A); // ệ
printLetter(0x00,0xFB,0xFB,0x00); // i
printLetter(0xE0,0x10,0x10,0xFF); // h
printLetter(0x7E,0x89,0x89,0x86); // g
printLetter(0xF0,0x08,0x08,0xF0); // n
for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}

printLetter(0x84,0x84,0x7F,0x04); // t
printLetter(0x69,0x94,0x94,0x68); // ố
printLetter(0x84,0x84,0x7F,0x04); // t

16

Downloaded by BINH NGUYEN ()


lOMoARcPSD|38590726

for(i=0;i<5;i++)
{

OSD9616_send(0x40,0x00); // Spaces
}

printLetter(0x01,0xAA,0xD5,0x6A); // Ễ
printLetter(0x80,0x80,0x80,0xFF); // L

for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}

USBSTK5515_waitusec( 14000000 );
}

/* Fill page 1*/
OSD9616_send(0x00,0x00); // Set low column address
OSD9616_send(0x00,0x10); // Set high column address
OSD9616_send(0x00,0xb0+1); // Set page for page 0 to page 5
for(i=0;i<128;i++)
{

OSD9616_send(0x40,0x00);
}

/* Write to page 1*/

OSD9616_send(0x00,0x00); // Set low column address
OSD9616_send(0x00,0x10); // Set high column address
OSD9616_send(0x00,0xb0+1); // Set page for page 0 to page 5
for(i=0;i<5;i++){
for(i=0;i<5;i++)

{
OSD9616_send(0x40,0x00); // Spaces

17

Downloaded by BINH NGUYEN ()

lOMoARcPSD|38590726

}
printLetter(0x7f,0x06,0x06,0x7f); // M
printLetter(0x00,0x41,0x41,0x7f); // C
printLetter(0x00,0x7f,0x08,0x7f); // H
printLetter(0x00,0x38,0x28,0x78); // p
printLetter(0x00,0x01,0x7f,0x01); // T
for(i=0;i<5;i++)
{

OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0xFE,0x11,0x11,0xFE); // A
printLetter(0x00,0xFD,0xFD,0x00); // I
printLetter(0x72,0x91,0x81,0x7E); // G


for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x00,0x41,0x41,0x7f); // C
printLetter(0xf4,0x92,0x92,0xf5); // Ố
printLetter(0x3F,0x40,0x40,0x3F); // U
printLetter(0xFE,0xC1,0x81,0x7E); // Q

for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x00,0x41,0x41,0x7f); // C
printLetter(0x1E,0xA1,0xA1,0x1E); // Ọ
printLetter(0x7f,0x08,0x08,0x7f); // H
18

Downloaded by BINH NGUYEN ()


×