![]() |
DM&P LCM DOS Library Reference |
| 2003/01/06 Version 0.25 |
If you have any problem, mail to soc@dmp.com.tw please.
#include <stdio.h>
#include "grlcm.h"
void main()
{
char cType;
int nLcmType, nLcmSize;
int nMaxX, nMaxY;
/*
Bitmap buffer to display. One bit to one pixel.
for this 8x8 buffer:
10000001
01000010
00100100
00011000
00011000
00100100
01000010
10000001
Note: The width of bitmap must be byte boundary.
If you want to define a 20x15 image. You should define a
((20+8)/8)*15 = 3*15 bytes buffer.
*/
char pcImage[] = { 0x81,0x42,0x24,0x18,0x18,0x24,0x42,0x81 };
printf("\nDM&P Graphic LCM Library Demo Program, %s %s.\n\n",__DATE__,__TIME__);
printf("GrLCM Library Version %s\n\n",GrLcm_Version());
/* Select LCM type */
printf("1. 122X32 \n");
printf("2. 128X64 \n");
printf("3. 320X240\n");
printf("4. 128X128\n");
printf("5. 240X128\n");
printf("6. 240X64 \n");
printf("Your LCM type: ");
cType = getch();
printf("%c\n",cType);
switch(cType)
{
case '1': nLcmSize = LCM_122X32; break;
case '2': nLcmSize = LCM_128X64; break;
case '3': nLcmSize = LCM_320X240; break;
case '4': nLcmSize = LCM_128X128; break;
case '5': nLcmSize = LCM_240X128; break;
case '6': nLcmSize = LCM_240X64; break;
}
/* Select LCM interface */
printf("\n");
printf("1. GPIO\n");
printf("2. Printer port\n");
printf("3. VGA emulator\n");
printf("Your interface type: ");
cType = getch();
printf("%c\n",cType);
switch(cType)
{
case '1': nLcmType = LCM_GPIO; break;
case '2': nLcmType = LCM_PRN; break;
case '3': nLcmType = LCM_VGA; break;
}
/* Initialize graphic LCM library */
if(GrLcm_Init(nLcmType,nLcmSize)==0)
{
printf("Unable to initialize LCM library.\n");
return;
}
/* Select font size */
GrLcm_SetFontType(LCM_FONT_5X7);
/* Clear LCM. Show DM&P logo and text "Hello" */
GrLcm_ClearScreen();
GrLcm_DisplayBitmapFile(0,0,"dmp.bmp");
GrLcm_printf(70,0,"Hello");
/* Display bitmap buffer */
GrLcm_DisplayBitmap(70,10,8,8,pcImage);
/* Line function test */
nMaxX = GrLcm_GetMaxX() - 1;
nMaxY = GrLcm_GetMaxY() - 1;
GrLcm_DrawLine( 0, 0,nMaxX, 0);
GrLcm_DrawLine(nMaxX, 0,nMaxX,nMaxY);
GrLcm_DrawLine(nMaxX,nMaxY, 0,nMaxY);
GrLcm_DrawLine( 0,nMaxY, 0, 0);
GrLcm_DrawLine( 0, 0,nMaxX,nMaxY);
GrLcm_DrawLine(nMaxX, 0, 0,nMaxY);
getch();
/* Close GrLCM library */
GrLcm_Close();
printf("Program terminated.\n");
} |
| Description: | Get library version string. | ||
| Arguments: |
|
||
| Example: |
/* Show GrLCM version. */
printf("DM&P GrLCM Library Version %s\n",GrLcm_Version());
|
| Description: | Close graphics LCM. | |
| Arguments: |
|
|
| Example: |
GrLcm_Close(); |
| Description: | Initialize graphics LCM and set I/O connection mode. | ||||||
| Arguments: |
|
||||||
| Example: |
if(GrLcm_Init(LCM_GPIO,LCM_128X64))
printf("Unable to initialize LCM library\n");
|
| Description: | Select font size will be used by GrLcm_printf(). | ||
| Arguments: |
|
||
| Example: |
GrLcm_SetFontType(FONT_5X7); |
| Description: | Get font size used by GrLcm_printf(). | ||
| Arguments: |
|
||
| Example: |
if(GrLcm_GetFontType()==FONT_5X7)
printf("Font size is 5X7.\n");
|
| Description: | Select language will be used by GrLcm_printf(). | ||||
| Arguments: |
|
||||
| Example: |
GrLcm_SetLanguage(LCM_CHINESE_BIG5); GrLcm_SetFontType(FONT_8X16); |
| Description: | Get language used by GrLcm_printf(). | ||
| Arguments: |
|
||
| Example: |
if(GrLcm_GetLanguage()==LCM_CHINESE_BIG)
printf("Trad. Chinses is used.\n");
|
| Description: | Print format string on LCM. | ||||||
| Arguments: |
|
||||||
| Example: |
GrLcm_printf(0,0,"<Mity-Mite Module>\nIP:192.168.0.100"); |
| Description: | Print formated string on LCM and you can select font type. | ||||||||
| Arguments: |
|
||||||||
| Example: |
GrLcm_printf2(0,0,LCM_FONT_5X7,"<Mity-Mite Module>\nIP:192.168.0.100"); |
| Description: | Print formated string on LCM and you can select language. | ||||||||||
| Arguments: |
|
||||||||||
| Example: |
GrLcm_SetFontType(FONT_8X16); GrLcm_printf3(0,0,LCM_ENGLISH,"<Mity-Mite Module>\nIP:192.168.0.100"); |
| Description: | Clear LCM. |
| Arguments: | N/A |
| Example: |
GrLcm_ClearScreen(); GrLcm_printf(0,0," |
| Description: | Clear a rectangle range on LCM. | ||||||||
| Arguments: |
|
||||||||
| Example: |
GrLcm_ClearRect(0,0,100,20); |
| Description: | Show a bitmap on LCM. | ||||||
| Arguments: |
|
||||||
| Example: |
GrLcm_DisplayBitmapFile(0,0,"dmp.bmp"); |
| Description: | Show a bitmap buffer on LCM. | ||||||||||||
| Arguments: |
|
||||||||||||
| Example: |
char pcImage[] = { 0x81,0x42,0x24,0x18,0x08,0x04,0x02,0x01 };
/* Display bitmap buffer */
GrLcm_DisplayBitmap(70,10,8,8,pcImage);
|
| Description: | Draw a line on LCM. | ||||||||
| Arguments: |
|
||||||||
| Example: |
GrLcm_DrawLine(0,0,100,50); |
| Description: | Draw a dot on LCM. | ||||
| Arguments: |
|
||||
| Example: |
GrLcm_DrawDot(10,10); |
| Description: | Get LCM width. | ||
| Arguments: |
|
||
| Example: |
int nMaxX = GrLcm_GetMaxX(); |
| Description: | Get LCM height. | ||
| Arguments: |
|
||
| Example: |
int nMaxX = GrLcm_GetMaxX(); |
| DMP Electronics Inc. All rights reserved. | Email us: info@dmp.com.tw |