Tải bản đầy đủ (.docx) (13 trang)

DIGITAL SIGNAL PROCESSING REPORT LAB 2 VIETNAMESE TEXT DISPLAY

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 (922.61 KB, 13 trang )

HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF ELECTRICAL & ELECTRONICS ENGINEERING
DEPARTMENT OF CONTROL ENGINEERING & AUTOMATION

DIGITAL SIGNAL PROCESSING

REPORT LAB 2
VIETNAMESE TEXT DISPLAY
PROFESSOR: LÊ TIÊẾN THƯỜ NG
CLASS: TT01---GROUP 3---SEMESTER 221
Student’s name
Ph mạ Nguyễễn Trung Tín
Trầần Quốốc Bảo

HO CHI MINH-2022

1


CONTENTS
I. Abstract

II. Introduction

BI.

Code ( program) and comments

IV. Result

V. Conclusion




I. Abstract
The aim of this experiment is learning about how to communicate with the
TMS320C5515 kit, how to use Charset editor software to get the code of each character.
Study the sample code to learn how to program the code for the kit's screen to display
the required requirements. After this experiment, we better understand and how to
program the kit to explore more advanced features of the kit.
AI. Introduction
- Introducing oled LCD of TMS320C5515/35 and implementing the display on oled LCD.
- LCD of TMS320C5515/35 is a 96x16 OLED display screen which has 96 columns and 16

rows. The display screen is divided into two regions, so actually we have two 96x8 to
display a text.

- For this project, to illustrate each character, we need 5x8 pixels. To keep the space

between characters, we use only 4x7 pixels for designing. Each led in LCD is activated by
setting to bit 1. The picture below will clearly show the rules of writing on LCD.

Fig 1. How to define a character in LCD.
- In project sample lcd-osd9616, to print out a character, they implement a function

called 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.

III. Code (program) and comments
/*

* 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"

// OSD9616 I2C address
#define OSD9616_I2C_ADDR

0x3C
/* ------------------------------------------------------------------------ *

*
* 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 // Command / Data
cmd[1] = 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

*

*

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

{
Uint16 x;
Uint8 cmd[10];

// Command / Data

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
*

*
*

*
*

*

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

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

USBSTK5515_GPIO_setOutput( 12,
1 );

// Output

// 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,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
OSD9616_send(0x00,0x00); // Not
OSD9616_send(0x00,0xd5);
OSD9616_send(0x00,0xf0);

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
{
OSD9616_send(0x40,0xff);
}
/* 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<500;i++)
{
OSD9616_send(0x40,0x00);
// Spaces

}


printLetter(0x7E,0x4A,0x4A,0x4A);
printLetter(0x4E,0x4A,0x4A,0x7A);
printLetter(0x7C,0x44,0x7C,0x00);
printLetter(0x4E,0x4A,0x4A,0x7A);
printLetter(0x00,0x08,0x08,0x08);
printLetter(0x4E,0x4A,0x4A,0x7A);
printLetter(0x4E,0x4A,0x4A,0x7A);
printLetter(0x7C,0x44,0x7C,0x00);
printLetter(0x4E,0x4A,0x4A,0x7A);
{
OSD9616_send(0x40,0x00);
}
printLetter(0x7C,0x48,0x48,0x78);
printLetter(0x78,0x49,0x4A,0x78);
printLetter(0x70,0x10,0x10,0x7E);
printLetter(0x44,0x28,0x10,0x7C);
{
OSD9616_send(0x40,0x00);
}
printLetter(0x78,0x08,0x08,0x78);
printLetter(0x00,0x5D,0x55,0x7D);
printLetter(0x00,0x00,0x7A,0x00);
printLetter(0x78,0x08,0x08,0x78);
{
OSD9616_send(0x40,0x00);
}
printLetter(0x40,0x7E,0x44,0x00);

{
OSD9616_send(0x40,0x00);
}
printLetter(0x02,0x09,0x70,0x08);
printLetter(0x44,0x28,0x10,0x7C);
{
}
printLetter(0x00,0x44,0x44,0x7C);
printLetter(0x3C,0x64,0x24,0x3C);
printLetter(0x7E,0x08,0x08,0x7E);
printLetter(0x40,0x40,0x40,0x40);
printLetter(0x7C,0x48,0x48,0x78);
printLetter(0x78,0x48,0x48,0x7E);

//
//
//
//
//
//
//
//
//

3
2
0
2
2
2

0
2
// Spaces

//
//
//
//

a
o
h
k
// Spaces

//
//
//
//

n
e
i
n
// Spaces

// 1
// Spaces

// y

// k
OSD9616_send(0x40,0x00);
//
//
//
//
//
//

c
o
H
_
a
b

{

{

OSD9616_send(0x40,0x00);
}
printLetter(0x7C,0x41,0x42,0x70);
printLetter(0x70,0x10,0x10,0x7E);
printLetter(0x08,0x7C,0x08,0x00);

// Spaces

// u
// h

// t

OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x78,0x40,0x40,0x78);
// u
printLetter(0x00,0x5D,0x55,0x7D); // ê
printLetter(0x00,0x00,0x7A,0x00);
// i
printLetter(0x70,0x10,0x10,0x7E);
// h
printLetter(0x00,0x44,0x44,0x7C);
// c

// Spaces


{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x78,0x10,0x10,0x78);
// m
printLetter(0x00,0x5D,0x55,0x7D); // e
printLetter(0x00,0x00,0x7A,0x00);
// i
printLetter(0x70,0x10,0x10,0x7E);
// h
printLetter(0x7C,0x54,0x54,0x5C); // g
printLetter(0x78,0x08,0x08,0x78);
// n

{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x00,0x74,0x01,0x02);
// i
printLetter(0x70,0x10,0x10,0x7E);
// h
printLetter(0x08,0x7C,0x08,0x00);
// t
{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x40,0x7E,0x44,0x00);
// 1
printLetter(0x7C,0x44,0x7C,0x00); // 0
printLetter(0x02,0x7E,0x02,0x02);
// T
printLetter(0x02,0x7E,0x02,0x02);
// T
printLetter(0x40,0x40,0x40,0x40);
// _
printLetter(0x7C,0x40,0x40,0x7C); // U
printLetter(0x45,0x55,0xD5,0x7D); // E
printLetter(0x00,0x00,0x7D,0x00); // I
printLetter(0x7E,0x08,0x08,0x7E);
// H
{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x7E,0x10,0x08,0x7E);

// N
printLetter(0x01,0x02,0x00,0x7D); // I
printLetter(0x02,0x7E,0x02,0x02);
// T
{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x7A,0x4B,0x4A,0x7A); // O
printLetter(0x7A,0x4A,0x4A,0x4E); // S
{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x0E,0x09,0x78,0x0E);
// Y
printLetter(0x40,0x40,0x40,0x7E);
// L
{
OSD9616_send(0x40,0x00); //
Spaces
printLetter(0x7E,0x40,0x43,0x79);
printLetter(0x66,0x18,0x18,0x66);
{
OSD9616_send(0x40,0x00);

// U
// X

}

// Spaces


printLetter(0x0E,0x0A,0x0A,0x7E);
printLetter(0x7E,0x48,0x49,0x7A);

// P
// O

}


printLetter(0x40,0x40,0x40,0x7E);

// L

/* 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,0xff);
}
/* 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<20;i++)
{

OSD9616_send(0x40,0x00);
}
printLetter(0x41,0x22,0x14,0x7F);
// K
printLetter(0x22,0x41,0x41,0x3E);
// C
printLetter(0x00,0x7F,0x00,0x00);
// I
printLetter(0x01,0x7F,0x01,0x01);
// T
printLetter(0x32,0x49,0x49,0x26);
// S
for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x36,0x49,0x49,0x7F);
// B
printLetter(0x32,0x49,0x49,0x26);
// S
printLetter(0x3F,0x40,0x40,0x3F);
// U
for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x06,0x09,0x09,0x7F);
// P
printLetter(0x32,0x49,0x49,0x26);
// S

printLetter(0x3E,0x41,0x41,0x7F);
// D
printLetter(0x43,0x4D,0x51,0x61); // Z
printLetter(0x10,0x58,0x58,0x30);
// e
for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}
printLetter(0x31,0x49,0x49,0x2F);
// 5
printLetter(0x00,0x7F,0x00,0x00);
// 1
printLetter(0x31,0x49,0x49,0x2F);
// 5
printLetter(0x31,0x49,0x49,0x2F);
// 5
printLetter(0x22,0x41,0x41,0x3E);
// C
for(i=0;i<23;i++)
{
OSD9616_send(0x40,0x00);
}
/* Set vertical
cmd[0] = 0x00;
cmd[1] = 0x29;
cmd[2] = 0x00;
cmd[3] = 0x00;
cmd[4] = 0x03;
cmd[5] = 0x01;

cmd[6] = 0x01;

// Spaces


OSD9616_send(0x00,0x2f);
/* Keep first 8
cmd[0] = 0x00;
cmd[1] = 0xa3;
cmd[2] = 0x08;
cmd[3] = 0x08;
return 0;
}

IV. Results



V. Conclusion
- After doing the experiment, we understand how the TMS320C5515 kit working. We also

know how to write each character by using the Charset editor on the LCD led and the
requirements that we have to follow are how the characters are built and also its aesthetic
when we display on the LCD led.
-On the other hand, this laboratory requires us the patience when building the character
for a better displaying on the LCD led so our group spend most of the time figuring out the
mistakes on the sample code which is provided by the instructors and we can not be able
to finish the whole task on time and we still missing some characters in the task.
- We have to manage our time more logical in order to finish the provided task on time


and the results we gain is the best and the most optimal one.

References
CharSet Builder | Alphabet (alphabet-type.com)
TMS320C5515: Electrocardiogram (ECG) MDK Development Solution | Wonder
(plastics-moulding.com)


HTML Charset (w3schools.com)
TMS320C5515 data sheet, product information and support | TI.com



×