[Lcdproc] Pertelian HD44780 USB

Matt Shaw matt@a1ontheweb.co.uk
Mon Sep 17 22:27:02 2007


 Hi guys

I know support for my Pertelian 20x4 HD44780 USB lcd display was built into
lcdproc 0.5.1,
as I previously had it working. lcdproc 0.5.2 has been built into Knoppmyth, the
system I am using
it on, and I copied in my previous LCDd.conf into the relevant place, but not
getting any output on it
whatsoever. The relevant part of my LCDd.conf is below. Please advise if it is
correct.......

[hd44780]
ConnectionType=winamp
Port=/dev/ttyUSB0
Device=/dev/ttyUSB0
Speed=0
Keypad=no
Contrast=0
Backlight=yes
OutputPort=no
Size=20x4
Charmap=hd44780_default
DelayBus=true
KeyMatrix_4_1=Enter
KeyMatrix_4_2=Up
KeyMatrix_4_3=Down
KeyMatrix_4_4=Escape

All the best,
 
Matt Shaw
matt@shagshaw.com
07734 059482 
 
Protected by www.Spamjab.com {kMZvfuqCVR6HFEO2AJ}

-----Original Message-----
From: lcdproc-admin@lists.omnipotent.net
[mailto:lcdproc-admin@lists.omnipotent.net] On Behalf Of
lcdproc-request@lists.omnipotent.net
Sent: 16 September 2007 13:02
To: lcdproc@lists.omnipotent.net
Subject: LCDproc digest, Vol 1 #1921 - 2 msgs

Send LCDproc mailing list submissions to
	lcdproc@lists.omnipotent.net

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.omnipotent.net/mailman/listinfo/lcdproc
or, via email, send a message with subject or body 'help' to
	lcdproc-request@lists.omnipotent.net

You can reach the person managing the list at
	lcdproc-admin@lists.omnipotent.net

When replying, please edit your Subject line so it is more specific than "Re:
Contents of LCDproc digest..."


Today's Topics:

   1. Patches for NoritakeVFD driver (Richard Muratti)
   2. Re: hd44780: Datavision 40x4 display - timing problem? (Dmitry E.
Mikhailov)

--__--__--

Message: 1
Date: Sun, 16 Sep 2007 03:06:36 +1000
From: Richard Muratti <rick@ccoz.com>
To: lcdproc@lists.omnipotent.net
Subject: [Lcdproc] Patches for NoritakeVFD driver

This is a multi-part message in MIME format.
--------------030601080303000502080808
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi all,

Made some fixes/changes to the NoritakeVFD driver.
I have attached a diff to lcdproc-0.5.2
Hope you can use the changes.

Cheers
Rick


--------------030601080303000502080808
Content-Type: text/plain;
 name="NoritakeVFD.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="NoritakeVFD.diff"

diff -u -r lcdproc-0.5.2/LCDd.conf lcdproc-0.5.2-rick/LCDd.conf
--- lcdproc-0.5.2/LCDd.conf	2007-04-26 05:56:43.000000000 +1000
+++ lcdproc-0.5.2-rick/LCDd.conf	2007-09-16 02:26:52.000000000 +1000
@@ -709,6 +709,9 @@
 # set the serial port speed [default: 9600, legal: 1200, 2400, 9600, 19200,
115200]  Speed=9600
 
+# Set serial data parity [default: 0 (None), legal: 0(None), 1(Odd), 
+2(Even)] Parity=0
+
 # re-initialize VFD ?
 #Reboot=yes
 
diff -u -r lcdproc-0.5.2/server/drivers/NoritakeVFD.c
lcdproc-0.5.2-rick/server/drivers/NoritakeVFD.c
--- lcdproc-0.5.2/server/drivers/NoritakeVFD.c	2007-04-15 00:38:14.000000000
+1000
+++ lcdproc-0.5.2-rick/server/drivers/NoritakeVFD.c	2007-09-16
02:29:34.000000000 +1000
@@ -4,6 +4,28 @@
     This source Code is based on CFontz Driver of this package.
 
     2005-08-01 Version 0.1: mostly everything should work (vbar, hbar never
tested)
+    
+    Copyright (C) 2007 Richard Muratti ricacho@gmail.com
+    2007-09-16 Version 0.2: 
+	Fixed vbar & hbar - Allowed for displays with 2 custom characters
+	Fixed cursor off  - 16H - Data sheet for CU20045SCPB has error -> Cursor
Off 14,16,17H
+	Tested with CU40026SCPB-T20A - 40x2 - Hardware Defaults to 19200 8E1
+	Added new config parameter [Parity] to set serial data parity 
+0(None),1(Odd),2(Even)
+	
+	
+	CU40026SCPB-T20A  SOFTWARE COMMANDS
+	Back Space 		08H 	International Font 		18H
+	Horizontal Tab 		09H 	Katakana Font 			19H
+	Line Feed 		0AH 	Escape 				1BH
+	Form Feed 		0CH  		Send User Font 		+43H
+	Carriage Return 	0DH  		Position cursor 	+48H
+	Clear Display 		0EH  		Software Reset 		+49H
+	Increment Write Mode 	11H  		Luminance 		+4CH
+	Vertical Scroll Mode 	12H  		Flickerless Write 	+53H
+	Underline Cursor On 	14H  		Cursor Blink Speed 	+54H
+	5x7 Block Cursor On 	15H 	Character Data 			20H+
+	Cursor Off 		16H 	User Character Data 		00H+	
+	
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by @@
-53,6 +75,7 @@
 	char device[200];
 	int fd;
 	int speed;
+	int parity;
 	/* dimensions */
 	int width, height;
 	int cellwidth, cellheight;
@@ -74,8 +97,8 @@
 static void NoritakeVFD_autoscroll (Driver *drvthis, int on);  static void
NoritakeVFD_hidecursor (Driver *drvthis);  static void NoritakeVFD_reboot
(Driver *drvthis); -static void NoritakeVFD_init_vbar (Driver *drvthis); -static
void NoritakeVFD_init_hbar (Driver *drvthis);
+static void NoritakeVFD_init_vbar (Driver *drvthis,int len); static 
+void NoritakeVFD_init_hbar (Driver *drvthis,int len);
 static void NoritakeVFD_draw_frame (Driver *drvthis, unsigned char *dat);
//static void NoritakeVFD_heartbeat (Driver *drvthis, int type);
 
@@ -150,6 +173,18 @@
 	else if (tmp == 115200) p->speed = B115200;
 
 
+	/* Which protocol */
+	tmp = drvthis->config_get_int(drvthis->name, "Parity", 0,
DEFAULT_PARITY);
+	if ((tmp != 0) && (tmp != 1) && (tmp != 2) ) {
+		report(RPT_WARNING, "%s: Parity must be 0 (None), 1(Odd),
2(Even); using default %d",
+			drvthis->name, DEFAULT_PARITY);
+		tmp = DEFAULT_PARITY;
+	}
+	if (tmp == 0) p->parity = 0;
+	else if (tmp == 1) p->parity = PARENB | PARODD;
+	else if (tmp == 2) p->parity = PARENB;
+
+
 	/* Reboot display? */
 	reboot = drvthis->config_get_bool(drvthis->name, "Reboot", 0, 0);
 
@@ -165,18 +200,18 @@
 	tcgetattr(p->fd, &portset);
 
 	// We use RAW mode
-#ifdef HAVE_CFMAKERAW
+//#ifdef HAVE_CFMAKERAW
 	// The easy way
 	cfmakeraw(&portset);
-#else
+//#else
 	// The hard way
 	portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
    	                   | INLCR | IGNCR | ICRNL | IXON );
 	portset.c_oflag &= ~OPOST;
 	portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
 	portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
-	portset.c_cflag |= CS8 | CREAD | CLOCAL;
-#endif
+	portset.c_cflag |= CS8 | CREAD | CLOCAL | p->parity;
+//#endif                                           
 
 	// Set port speed
 	cfsetospeed(&portset, p->speed);
@@ -356,7 +391,7 @@
 }
 
 /////////////////////////////////////////////////////////////////
-// Get rid of the blinking curson
+// Get rid of the blinking cursor
 //
 static void
 NoritakeVFD_hidecursor (Driver *drvthis) @@ -364,7 +399,7 @@
 	PrivateData *p = drvthis->private_data;
 	char out[4];
 
-	snprintf(out, sizeof(out), "%c", 0x14);
+	snprintf(out, sizeof(out), "%c", 0x16);
 	write(p->fd, out, 1);
 }
 
@@ -379,16 +414,31 @@
 
 	snprintf(out, sizeof(out), "%c%c", 0x1B, 'I');
 	write(p->fd, out, 2);
+	
+	//Switch on Flickerless Write
+	snprintf(out, sizeof(out), "%c%c", 0x1B, 0x53);
+	write(p->fd, out, 2);
 }
 
 /////////////////////////////////////////////////////////////////
 // Sets up for vertical bars.  Call before NoritakeVFD->vbar()
+// Some Displays have only 2 custom characters so we only create the 
+custom char we need based in the len needed
 //
 static void
-NoritakeVFD_init_vbar (Driver *drvthis)
+NoritakeVFD_init_vbar (Driver *drvthis,int len)
 {
 	PrivateData *p = drvthis->private_data;
-	char a[] = {
+	char vert[8][35] = {
+	{
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0,
+	},
+	{
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
@@ -396,8 +446,8 @@
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
 		1, 1, 1, 1, 1,
-	};
-	char b[] = {
+	},
+	{
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
@@ -405,8 +455,8 @@
 		0, 0, 0, 0, 0,
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
-	};
-	char c[] = {
+	},
+	{
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
@@ -414,8 +464,8 @@
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
-	};
-	char d[] = {
+	},
+	{
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
@@ -423,8 +473,8 @@
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
-	};
-	char e[] = {
+	},
+	{
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0,
 		1, 1, 1, 1, 1,
@@ -432,8 +482,8 @@
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
-	};
-	char f[] = {
+	},
+	{
 		0, 0, 0, 0, 0,
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
@@ -441,27 +491,42 @@
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
 		1, 1, 1, 1, 1,
-	};
+	},
+	{
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+	}};
 
 	if (p->ccmode != hbar) {
 		p->ccmode = hbar;
-		NoritakeVFD_set_char(drvthis, 2, a);
-		NoritakeVFD_set_char(drvthis, 3, b);
-		NoritakeVFD_set_char(drvthis, 4, c);
-		NoritakeVFD_set_char(drvthis, 5, d);
-		NoritakeVFD_set_char(drvthis, 6, e);
-		NoritakeVFD_set_char(drvthis, 7, f);
+		NoritakeVFD_set_char(drvthis, 2, vert[len]);
 	}
 }
 
 /////////////////////////////////////////////////////////////////
 // Inits horizontal bars...
+// Some Displays have only 2 custom characters so we only create the 
+custom char we need based in the len needed
 //
 static void
-NoritakeVFD_init_hbar (Driver *drvthis)
+NoritakeVFD_init_hbar (Driver *drvthis,int len)
 {
 	PrivateData *p = drvthis->private_data;
-	char a[] = {
+	char horiz[6][35] = {
+	{
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0, 
+		0, 0, 0, 0, 0, 
+		0, 0, 0, 0, 0, 
+	},
+	{
 		1, 0, 0, 0, 0,
 		1, 0, 0, 0, 0,
 		1, 0, 0, 0, 0,
@@ -469,8 +534,8 @@
 		1, 0, 0, 0, 0, 
 		1, 0, 0, 0, 0, 
 		1, 0, 0, 0, 0, 
-	};
-	char b[] = {
+	},
+	{
 		1, 1, 0, 0, 0, 
 		1, 1, 0, 0, 0, 
 		1, 1, 0, 0, 0,
@@ -478,8 +543,8 @@
 		1, 1, 0, 0, 0, 
 		1, 1, 0, 0, 0, 
 		1, 1, 0, 0, 0, 
-	};
-	char c[] = {
+	},
+	{
 		1, 1, 1, 0, 0, 
 		1, 1, 1, 0, 0, 
 		1, 1, 1, 0, 0,
@@ -487,8 +552,8 @@
 		1, 1, 1, 0, 0, 
 		1, 1, 1, 0, 0, 
 		1, 1, 1, 0, 0, 
-	};
-	char d[] = {
+	},
+	{
 		1, 1, 1, 1, 0, 
 		1, 1, 1, 1, 0, 
 		1, 1, 1, 1, 0,
@@ -496,14 +561,20 @@
 		1, 1, 1, 1, 0, 
 		1, 1, 1, 1, 0, 
 		1, 1, 1, 1, 0, 
-	};
+	},
+	{
+		1, 1, 1, 1, 1, 
+		1, 1, 1, 1, 1, 
+		1, 1, 1, 1, 1, 
+		1, 1, 1, 1, 1, 
+		1, 1, 1, 1, 1, 
+		1, 1, 1, 1, 1, 
+		1, 1, 1, 1, 1, 
+	}};
 
 	if (p->ccmode != hbar) {
 		p->ccmode = hbar;
-		NoritakeVFD_set_char(drvthis, 2, a);
-		NoritakeVFD_set_char(drvthis, 3, b);
-		NoritakeVFD_set_char(drvthis, 4, c);
-		NoritakeVFD_set_char(drvthis, 5, d);
+		NoritakeVFD_set_char(drvthis, 2, horiz[len]);
 	}
 }
 
@@ -513,21 +584,18 @@
 MODULE_EXPORT void
 NoritakeVFD_vbar (Driver *drvthis, int x, int y, int len, int promille, int
options)  {
-/*	PrivateData *p = drvthis->private_data;
-	char map[8] = { 32, 1, 2, 3, 4, 5, 6, 255 };
+	PrivateData *p = drvthis->private_data;
 
-	int y;
 	for (y = p->height; y > 0 && len > 0; y--) {
 		if (len >= p->cellheight)
-			NoritakeVFD_chr (drvthis, x, y, 255);
-		else
-			NoritakeVFD_chr (drvthis, x, y, map[len]);
-
+			NoritakeVFD_chr (drvthis, x, y, 0xbe);
+			
+		else {  
+		        NoritakeVFD_init_vbar (drvthis,len);
+			NoritakeVFD_chr (drvthis, x, y,2);
+		}
 		len -= p->cellheight;
-	}*/
-
-	NoritakeVFD_init_vbar(drvthis);
-	//lib_vbar_static(drvthis, x, y, len, promille, options, p->cellwidth,
0);
+	}
 }
 
 /////////////////////////////////////////////////////////////////
@@ -536,21 +604,17 @@
 MODULE_EXPORT void
 NoritakeVFD_hbar (Driver *drvthis, int x, int y, int len, int promille, int
options)  {
-/*	PrivateData *p = drvthis->private_data;
-	char map[5] = { 32, 1, 2, 3, 4 };
+	PrivateData *p = drvthis->private_data;
 
 	for (; x <= p->width && len > 0; x++) {
 		if (len >= p->cellwidth)
-			NoritakeVFD_chr (drvthis, x, y, map[4]);
-		else
-			NoritakeVFD_chr (drvthis, x, y, map[len]);
-
+			NoritakeVFD_chr (drvthis, x, y, 0xbe);
+		else {  
+		        NoritakeVFD_init_vbar (drvthis,len);
+			NoritakeVFD_chr (drvthis, x, y, 2);
+		}
 		len -= p->cellwidth;
-
-	}*/
-
-	NoritakeVFD_init_hbar(drvthis);
-	//lib_hbar_static(drvthis, x, y, len, promille, options, p->cellheight,
0);
+	}
 }
 
 
diff -u -r lcdproc-0.5.2/server/drivers/NoritakeVFD.h
lcdproc-0.5.2-rick/server/drivers/NoritakeVFD.h
--- lcdproc-0.5.2/server/drivers/NoritakeVFD.h	2007-04-15 00:38:14.000000000
+1000
+++ lcdproc-0.5.2-rick/server/drivers/NoritakeVFD.h	2007-09-16
02:26:23.000000000 +1000
@@ -5,6 +5,28 @@
 
     2005-08-01 Version 0.1: mostly everything should work (vbar, hbar never
tested)
 
+    Copyright (C) 2007 Richard Muratti ricacho@gmail.com
+    2007-09-16 Version 0.2: 
+	Fixed vbar & hbar
+	Fixed cursor off  - 16H - Data sheet for CU20045SCPB has error -> Cursor
Off 14,16,17H
+	Tested with CU40026SCPB-T20A - Hardware Defaults to 19200 8E1
+	Added new config parameter [Parity] to set serial data parity 
+0(None),1(Odd),2(Even)
+	
+	
+	CU40026SCPB-T20A  SOFTWARE COMMANDS
+	Back Space 		08H 	International Font 		18H
+	Horizontal Tab 		09H 	Katakana Font 			19H
+	Line Feed 		0AH 	Escape 				1BH
+	Form Feed 		0CH  		Send User Font 		+43H
+	Carriage Return 	0DH  		Position cursor 	+48H
+	Clear Display 		0EH  		Software Reset 		+49H
+	Increment Write Mode 	11H  		Luminance 		+4CH
+	Vertical Scroll Mode 	12H  		Flickerless Write 	+53H
+	Underline Cursor On 	14H  		Cursor Blink Speed 	+54H
+	5x7 Block Cursor On 	15H 	Character Data 			20H+
+	Cursor Off 		16H 	User Character Data 		00H+	
+
+
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or @@ -29,6
+51,7 @@
 #define DEFAULT_SPEED		9600
 #define DEFAULT_BRIGHTNESS	140
 #define DEFAULT_SIZE		"20x4"
+#define DEFAULT_PARITY		0
 
 MODULE_EXPORT int  NoritakeVFD_init (Driver *drvthis);  MODULE_EXPORT void
NoritakeVFD_close (Driver *drvthis);

--------------030601080303000502080808--

--__--__--

Message: 2
From: "Dmitry E. Mikhailov" <sexandvodka@gmail.com>
To: Joris Robijn <joris@robijn.net>
Subject: Re: [Lcdproc] hd44780: Datavision 40x4 display - timing problem?
Date: Sat, 15 Sep 2007 23:29:40 +0600
Cc: lcdproc@lists.omnipotent.net

> > I'm a happy owner of Datavision DV40400 40x4 display, 
> > HD44780-compatible, ?
> > chipset is AFAIK "Samsung KS0066".
>
> Have you tried the "ExtendedMode=Yes" switch by removing the "#" sign 
> for this option in the [hd44780] section ?
>
> Regards,
> Joris

Yes, I did try. The scrolling problem is the same and the top two lines are
shown incorrectly. So 'ext. mode' looks like a wrong option.

I think I tried every combination of options available. The problem is somewhere
else. It could be the new timing system (dynticks) of 2.6.21+ kernels or my
current display with out-of-spec (too large) delay when changing the active
screen (EN1 -> EN2). Wiring is Ok. The LCDd's welcome screen is displayed
correctly. But fast moving info (heartbeat?) makes *bottom part of* display
SCROLL. How's that? I don't have an idea :)

May be try really SHORT (4 inch) wires to check if wiring is the problem...


--__--__--

_______________________________________________
LCDproc mailing list
LCDproc@lists.omnipotent.net
http://lists.omnipotent.net/mailman/listinfo/lcdproc


End of LCDproc Digest