User`s manual

Table Of Contents
UC-7400-CE User’s Manual Programming Examples
5-8
Example #4LCM Display
Every UC-7420-CE and UC-7410-CE computer is equipped with LCM hardware with a display
area of 8x16. This device offers a simple eye-catching interface for your applications. An internal
service is pre-installed to manage a set of English text fonts for your applications. As an example,
the following program transmits text to the service.
#include <windows.h>
#include <moxa/devices.h>
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
HANDLE hndl;
char *buf="Hi, hello World!!\nabcdefg\n\n1234567890";
unsigned int w, h, x, y;
hndl = mxlcm_open(&w, &h);
if (!hndl)
return 1;
x = 2; y=1;
mxlcm_clear(hndl);
mxlcm_write(hndl, buf, strlen(buf), &x, &y);
mxlcm_close(hndl);
return 0;
}
Upon detecting the character ‘\n’ or ‘\r’ in the received text, the internal service forces a down
shift of a line on the display screen. In addition, the service scrolls up a lengthy portion of text by
dropping its leading part in order to fit the area of the LCM display.
/* open a handle to the LCM devie
<lcm_w> the function outputs the width of the LCM display to this pointer
<lcm_h> the function outputs the height of the LCM display to this pointer
Return nonzero value in success.
*/
HANDLE mxlcm_open(unsigned int *lcm_w, unsigned int *lcm_h);