/*
* Linux tester for Siemens A60 LCD (A65, M55, C60, MC60, S55, etc)
*
* Connect signals to parallel port via ~10K resistors thus: -
*
* Parallel Port A60-LCD
* 2 D0 <--10K-> 1 CS
* 3 D1 <--10K-> 2 Reset
* 4 D2 <--10K-> 3 RS
* 5 D3 <--10K-> 4 SCL
* 6 D4 <--10K-> 5 SDA
* 7 D5 <-620R-> 6 +2.9V *and* 8 A1
* 8 D6 <-620R-> 10 A2
* 25 GND <------> 7 GND *and* 9 K
*
* LCD pad 1 is nearest the edge of the frame, pad 10 is nearest the
* middle of the assembly.
*
* By coincidence, Vf of the backlight LEDs is approx 2.9V, thus
* one can be used as a simple shunt regulator for the LCD supply.
*
* Remember, the series resistor limits the current in the shunt.
* The series resistors in the signal lines limit the current in
* the LCD's clamp diodes. Adjust values as necessary to suit the
* specific parallel port.
*
* Make sure you have your distro's ppdev package installed.
*/
void Send (X)
{
int mask;
/* clock a byte out serially to the LCD */
for (mask = 0x80; mask; mask >>= 1)
//for (mask = 0x01; mask & 0x100; mask <<= 1)
{
if (mask & X)
data |= 0x10;
else
data &= ~0x10;
data &= ~0x08;
ioctl (fd, PPWDATA, &data);
//ioctl (fd, PPWDATA, &data);
void SetWindow (int x, int y, int sx, int sy)
{
/* bounds checking */
sx += x;
if (x < 0) x = 0;
if (x > 100) x = 100;
if (sx <= x) sx = x + 1;
if (sx > 101) sx = 101;
sy += y;
if (y < 0) y = 0;
if (y > 79) y = 79;
if (sy <= y) sy = y + 1;
if (sy > 80) sy = 80;
/* send command */
x = 2 * (3 + x);
sx = 2 * (3 + sx) + 1;
data |= 0x04;
data &= ~0x01;
ioctl (fd, PPWDATA, &data);