2: Vietnamese Text Display Lecturer: Prof... ABSTRACTStick Development Tool and briefly outline the process of implementing the display of an desired Vietnamse texts on LCD.. The displ
Trang 1HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY
FACULTY OF ELECTRICAL AND ELECTRONIC ENGINEERING
DIGITAL SIGNAL PROCESSING
LAB No 2: Vietnamese Text Display
Lecturer: Prof Dr LE TIEN THUONG
Course ID: EE2016
Class: TT06 Group: 5
Trang 2Table 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
lOMoARcPSD|38590726
Trang 3I ABSTRACT
Stick Development Tool and briefly outline the process of implementing the display of
an desired Vietnamse texts on LCD
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
Trang 4Due 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
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)
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 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
lOMoARcPSD|38590726
Trang 5Eventually, to repair the limitation of SDRAM, our solutions are to seperate
desired texts into various pieces and display different parts gradually on screen as wereset 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
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:
Trang 6Step 3: Capture the results.
lOMoARcPSD|38590726
Trang 7VI RESULTS & CODES Results:
Trang 8lOMoARcPSD|38590726
Trang 10lOMoARcPSD|38590726
Trang 11C-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];
Trang 12cmd[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 ); }
lOMoARcPSD|38590726
Trang 13* *
* - */
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
Trang 14/* 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;
lOMoARcPSD|38590726
Trang 15OSD9616_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 5for(i=0;i<5;i++){
for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}
Trang 17for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
}
Trang 19OSD9616_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(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 5for(i=0;i<5;i++){
for(i=0;i<5;i++)
{
OSD9616_send(0x40,0x00); // Spaces
Trang 23cmd[3] = 0x00; // Define start page address
cmd[4] = 0x03; // Set time interval between each scroll step cmd[5] = 0x01; // Define end page address
cmd[6] = 0x00; // Vertical scrolling offset
OSD9616_multiSend( cmd, 7 );
OSD9616_send(0x00,0x2f);
/* Keep first 8 rows from vertical scrolling */
cmd[0] = 0x00;
cmd[1] = 0x00; // Set Vertical Scroll Area
cmd[2] = 0x10; // Set No of rows in top fixed area
cmd[3] = 0x00; // Set No of rows in scroll area
OSD9616_multiSend( cmd, 4 );
return 0;
}
Trang 24VII CONCLUSION
In this lab, we have successfully designed the required
Vietnamese text on charset editor and wrote a program to display
them on the OLED screen of the ezDSP8535 development kit
However, there are some minor imperfections in our text, which we
can improve in the next labs
Digi-Key Electronics (digikey.com)
- TMS320C5515 eZdsp USB Stick Development Tool, access from:
C5515 eZdsp (ti.com)
Evaluation board | TI.com
lOMoARcPSD|38590726