Page 1 of 1

Custom Characters

Posted: Fri Nov 03, 2006 10:27 am
by Jon
Custom Characters

Custom characters can be used on all of our Alphanumeric displays. The following is intended to introduce people to custom characters, and their many applications.

The Code following was written in C, however the principals will remain constant in any language. The function "USART_Transmit(byte)" can be replaced with the function that you use to send data to the display.

Custom characters are a combination of 8 bytes. Each byte represents a row of pixels in binary from top to bottom. Custom characters are assigned a reference ID from 0-7, and then may be referenced by simply sending the display the reference number.

The values of the rows are calculated as follows:

The Letter I
|16 | 8 | 4 | 2 | 1 |
------------------
| 0 | * | * | * | 0 | = 14
| 0 | 0 | * | 0 | 0 | = 4
| 0 | 0 | * | 0 | 0 | = 4
| 0 | 0 | * | 0 | 0 | = 4
| 0 | 0 | * | 0 | 0 | = 4
| 0 | 0 | * | 0 | 0 | = 4
| 0 | 0 | * | 0 | 0 | = 4
| 0 | * | * | * | 0 | = 14


This would mean you would send:

customChar(0,14,4,4,4,4,4,4,14); //This will create the custom character (please see the code for "customChar" below).
USART_Transmit(0); //This will display the custom character 'I' at the current cursor position.




//****************************************************************************
//* Custom Character Code *
//****************************************************************************

void customChar(byte x, byte a,byte b,byte c,byte d,byte e,byte f,byte g,byte h)
{

USART_Transmit(254);
USART_Transmit(78);
USART_Transmit(x);
USART_Transmit(a);
USART_Transmit(b);
USART_Transmit(c);
USART_Transmit(d);
USART_Transmit(e);
USART_Transmit(f);
USART_Transmit(g);
USART_Transmit(h);


}


void NvidiaLogo(int x, int y)
{
customChar(0,0,0,0,0,3,6,12,25);
customChar(1,0,0,7,28,16,3,14,24);
customChar(2,31,31,7,25,30,3,17,27);
customChar(3,31,31,31,31,31,15,7,15);
customChar(4,29,14,7,3,0,0,0,0);
customChar(5,28,15,3,16,28,15,0,0);
customChar(6,27,23,15,30,24,7,31,31);
customChar(7,27,17,3,7,31,31,31,31);


GoTo(x,y);
USART_Transmit(0);
USART_Transmit(1);
USART_Transmit(2);
USART_Transmit(3);
GoTo(x,y+1);
USART_Transmit(4);
USART_Transmit(5);
USART_Transmit(6);
USART_Transmit(7);
}

void DolbyLogo(int x, int y)
{
customChar(0,31,19,17,17,17,17,19,31);
customChar(1,31,25,17,17,17,17,25,31);

customChar(2,31,16,17,17,17,17,16,31);
customChar(3,31,0,19,10,10,19,0,31);
customChar(4,31,0,20,20,20,23,0,31);
customChar(5,31,0,8,14,10,14,0,31);
customChar(6,31,1,21,9,9,9,1,31);
//customChar(7,);


GoTo(x,y);
USART_Transmit(0);
USART_Transmit(1);
USART_Transmit(2);
USART_Transmit(3);
USART_Transmit(4);
USART_Transmit(5);
USART_Transmit(6);

}

void THXLogo(int x, int y)
{
customChar(0,31,31,3,3,3,3,3,3);
customChar(1,31,31,0,8,8,8,8,15);
customChar(2,31,31,0,22,19,17,16,16);
customChar(3,31,31,0,3,6,12,24,24);

customChar(4,3,3,3,3,0,0,31,31);
customChar(5,8,8,8,8,0,0,31,31);
customChar(6,16,17,19,22,0,0,31,31);
customChar(7,24,28,6,3,0,0,31,31);


GoTo(x,y);
USART_Transmit(0);
USART_Transmit(1);
USART_Transmit(2);
USART_Transmit(3);
GoTo(x,y+1);
USART_Transmit(4);
USART_Transmit(5);
USART_Transmit(6);
USART_Transmit(7);
}

void MXLogo(int x, int y)
{
customChar(0,0,0,0,0,0,0,0,1);
customChar(1,0,0,31,7,1,0,16,25);
customChar(2,0,0,0,24,30,15,23,27);
customChar(3,0,0,0,0,3,7,14,28);

customChar(4,3,3,7,6,0,0,0,0);
customChar(5,27,31,14,4,0,0,0,0);
customChar(6,29,13,15,6,0,0,0,0);
customChar(7,24,24,24,28,12,12,4,4);

GoTo(x,y);
USART_Transmit(0);
USART_Transmit(1);
USART_Transmit(2);
USART_Transmit(3);
GoTo(x,y+1);
USART_Transmit(4);
USART_Transmit(5);
USART_Transmit(6);
USART_Transmit(7);


}