hebben jullie hier nog wat aan??
http://www.jkmicro.com/c.html
LCD Driver and Streams
Here are is an example program and a few pointers when C programs write to the Flashlite LCD driver.
First, do not send end-of-line characters (\n) to the LCD. These characters will look like black boxes or strange characters and may prevent control sequences from working properly.
Second, C may buffer output to streams. This can cause erratic behavior or make the program seem not to work. The answer is to disable the buffering. In Borland C, the setbuf(*stream, *buffer) command can be used.
The following example prints the date and time in the center of the 4x20 LCD until a key is pressed.
Note: With some compilers, opening LPT1 as a file will fail. In this event, try using stdprn (the standard print device). It will still be necessary to disable buffering on the device.
#include <stdio.h>
#include <time.h>
#include <conio.h>
#define LCD_CMD 160 /* command for LCD driver */
#define LCD_CMD1 40 /* i/o format setup command */
#define LCD_CMD2 6 /* cursor setup command */
#define CLR_HOME 1 /* clear and home command */
void main()
{
time_t sec_now, sec_prev=0; /* time in seconds, 2 copies */
struct tm *tm_now; /* time/date structure */
FILE *lcd; /* stream for LCD data */
unsigned char lcd_pos=0xC6; /* demo position w/ variable */
/* **** when using Turbo C, use the following line: */
/* lcd=fopen("LPT1","w"); /* open LPT1 for output */
/* **** when using Borland 4.52, use the following line: */
lcd=stdprn;
setbuf(lcd, NULL); /* disable buffering */
/* send init commands to LCD */
fprintf(lcd,"%c%c",LCD_CMD,LCD_CMD1); /* with defined commands */
fprintf(lcd,"%c%c",LCD_CMD,40); /* with decimal commands */
fprintf(lcd,"%c%c",LCD_CMD,0xC); /* with hex commands */
fprintf(lcd,"%c%c",LCD_CMD,LCD_CMD2);
fprintf(lcd,"%c%c",LCD_CMD,CLR_HOME);
while ( !kbhit() ) { /* repeat until key hit */
time(&sec_now); /* get the time (sec from whenever) */
if (sec_now != sec_prev) { /* see if new time */
sec_prev=sec_now;
tm_now=localtime(&sec_now); /* convert seconds into something usefull */
fprintf(lcd,"%c%c",LCD_CMD,lcd_pos); /* set position to output on LCD */
fprintf(lcd,"%02d-%02d-%02d", /* output date */
tm_now->tm_mon,tm_now->tm_mday,tm_now->tm_year);
fprintf(lcd,"%c%c",LCD_CMD,0x9A); /* reposition cursor */
fprintf(lcd,"%02d:%02d:%02d", /* output time */
tm_now->tm_hour,tm_now->tm_min,tm_now->tm_sec);
}
}
fclose(lcd); /* close the stream */
return 0; /* done */
}
en er staat nog meer op die site