C Language Development Kit/Functions/DefineCharacter
From OptiWiki
< C Language Development Kit | Functions(Redirected from C Language Development Kit/Functions/Definecharacter)
| Description | With this function you can define the shape of the symbols with ASCII
values 0 through 7. For details see the example below. |
| Syntax | void definecharacter(unsigned int number, unsigned char * bitmap); |
| Arguments | The ASCII value of the symbol to be defined; valid values are 0 up to and including 7.
unsigned int number Points to an array of 8 bytes.
unsigned char * bitmap The 8 bytes define the bitmap of the symbol. The symbol is 5 bits wide and 8 bits high. Each byte defines one horizontal line, the first byte defines the highest line. The lower 5 bits of each byte define the 5 pixels on the line. Note that the lowest line of bits is also the line where the cursor is placed, when the cursor is located at the symbol. The example shows how the 8 byte array defines the bitmap. |
| Returns | None |
| Remarks | This function is only available on the DWT7133. The symbols are stored in internally. The DWT7133 operating system will remember the last values stored.
When definecharacter() was not called before on a DWT7133, the shapes of the 8 symbols are not defined. The example explains how the 8 byte array defines the bitmap. |
| Example | // This example will print an up-arrow symbol and a down-arrow symbol on the third // and fourth position of the second line of the display. // The up- and down-arrow symbol are defined by the definecharacter() function #include "lib.h" #include <stdio.h> const unsigned char uparrow[8] = {0x04, 0x0E, 0x1F, 0x15, 0x04, 0x04, 0x04, 0x00}; const unsigned char dwarrow[8] = {0x04, 0x04, 0x04, 0x15, 0x1F, 0x0E, 0x04, 0x00}; // The bitmaps of uparrow[] and downarrow[] are explained below. Only the // lower 5 bits of each unsigned char byte are used. // A symbol consists of 8 lines. Each line is 5 pixels wide. // A '.' denotes the pixel is off. A 'X' denotes that the pixel is on. // // Explanation for bitmap of // uparrow[8] = {0x04, 0x0E, 0x1F, 0x15, 0x04, 0x04, 0x04, 0x00}: // // 5 4 3 2 1 // // 0x04 . . X . . // 0x0E . X X X . // 0x1F X X X X X // 0x15 X . X . X // 0x04 . . X . . // 0x04 . . X . . // 0x04 . . X . . // 0x00 . . . . . // // Explanation for bitmap of // dwarrow[8] = {0x04, 0x04, 0x04, 0x15, 0x1F, 0x0E, 0x04, 0x00}: // // 5 4 3 2 1 // // 0x04 . . X . . // 0x04 . . X . . // 0x04 . . X . . // 0x15 X . X . X // 0x1F X X X X X // 0x0E . X X X . // 0x04 . . X . . // 0x00 . . . . . void main( void ) { gotoxy(3,1); definecharacter(0, (unsigned char*)uparrow); definecharacter(1, (unsigned char*)dwarrow); putchar(0); putchar(1); while( 1 ) idle(); } |
