Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

convert old 8 bit lcd's to use usb

Discussion about LCD's and other related hardware

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo, Fast351, hydrolisk1792

Post Reply
lalalandrus
Posts: 4
Joined: July 27th, 2006, 11:27 pm

convert old 8 bit lcd's to use usb

Post by lalalandrus »

some new computers dont come with parallel ports and adding one via pci cards is annoying. with an arduino, one can drive a lcd via usb.

note: this work has been done before with only 4 bit lcds, but this effort was made to accommodate 8bit lcds

my lcd is of this pinout:

Image

i soldered a pin header on my lcd and bent required pins to get it to fit into the arduino duemilanove, see picture, one of the pins doesnt fit in the gap so a bridge wire was soldered to it

Image

after hookup, create a new arduino sketch with the following code and burn. (tested on arduino-0017, atmega168)

Code: Select all

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins (rs, rw, e, d0-7)
LiquidCrystal lcd( 11, 10, 9, 8, 12, 7, 6, 5, 4, 3, 2);

void setup() { 
  Serial.begin(19200);
  
  // init a 4x20 LCD and clear it, change if required
  lcd.begin(4,20);
  lcd.clear();
}


byte serial_getch(){
  int incoming;  
  while (Serial.available()==0){}
	// read the incoming byte:
  incoming = Serial.read();
  return (byte) (incoming &0xff);
}
        


void loop(){
  
  byte rxbyte;
  byte temp;
  
  rxbyte = serial_getch();

  if (rxbyte == 254) //Matrix Orbital uses 254 prefix for commands
	{
		switch (serial_getch())
		{
			case 66: //backlight on (at previously set brightness)
                                // not implemented				

				break;
			case 70: //backlight off
				// not implemented				
                                break;
			case 71:  //set cursor position
				temp = (serial_getch() - 1);  //get column byte
				switch (serial_getch())  //get row byte
				{
					//line 1 is already set up
					case 2:
						temp += 0x40;
						break;
					case 3:
						temp += 0x14;
						break;
					case 4:
						temp += 0x54;
						break;
					default:
						break;
				}
				lcd.command(0b10000000 + temp);
				break;
			case 72:  //cursor home (reset display position)
				lcd.command(2);
				break;
			case 74:  //show underline cursor
				lcd.command(0b00001110);
				break;
			case 75:  //underline cursor off
			case 84:  //block cursor off
				lcd.command(0b00001100);
				break;
			case 76:  //move cursor left
				lcd.command(16);
				break;
			case 77:  //move cursor right
				lcd.command(20);
				break;
			case 78:  //define custom char
				lcd.command(64 + (serial_getch() * 8));  //get+set char address
				for (temp = 7; temp != 0; temp--)
				{
					lcd.print(serial_getch()); //get each pattern byte
				}
				break;
			case 83:  //show blinking block cursor
				lcd.command(0b00001111);
				break;
			case 86:  //GPO OFF
				//implement later
				break;
			case 87:  //GPO ON
				/*temp = serial_getch();
				if (temp == 1)
				{
					GPO1 = GPO_ON;
				}*/
				break;
			case 88:  //clear display, cursor home
				lcd.command(1);
				break;
			case 152: //set and remember (doesn't save value, though)
			case 153: //set backlight brightness
				//not implemented
				break;

			//these commands ignored (no parameters)
			case 35: //read serial number
			case 36: //read version number
			case 55: //read module type
			case 59: //exit flow-control mode
			case 65: //auto transmit keypresses
			case 96: //auto-repeat mode off (keypad)
			case 67: //auto line-wrap on
			case 68: //auto line-wrap off
			case 81: //auto scroll on
			case 82: //auto scroll off
			case 104: //init horiz bar graph
			case 109: //init med size digits
			case 115: //init narrow vert bar graph
			case 118: //init wide vert bar graph
				break;
			default:
				//all other commands ignored and parameter byte discarded
				temp = serial_getch();  //dump the command code
				break;
		}
		return;
	} //END OF COMMAND HANDLER

	//change accented char to plain, detect and change descenders
	//NB descenders only work on 5x10 displays. This lookup table works
	//  with my DEM-20845 (Display Elektronik GmbH) LCD using KS0066 chip.
	switch (rxbyte)
	{
		//chars that have direct equivalent in LCD charmap
/*		case 0x67: //g
			rxbyte = 0xE7;
			break;
		case 0x6A: //j
			rxbyte = 0xEA;
			break;
		case 0x70: //p
			rxbyte = 0xF0;
			break;
		case 0x71: //q
			rxbyte = 0xF1;
			break;
		case 0x79: //y
			rxbyte = 0xF9;
			break;
*/		case 0xE4: //ASCII "a" umlaut
			rxbyte = 0xE1;
			break;
		case 0xF1: //ASCII "n" tilde
			rxbyte = 0xEE;
			break;
		case 0xF6: //ASCII "o" umlaut
			rxbyte = 0xEF; //was wrong in v0.86
			break;
		case 0xFC: //ASCII "u" umlaut
			rxbyte = 0xF5;
			break;

		//accented -> plain equivalent
		//and misc symbol translation
		case 0xA3: //sterling (pounds)
			rxbyte = 0xED;
			break;
/*		case 0xB0: //degrees symbol
			rxbyte = 0xDF;
			break;
*/		case 0xB5: //mu
			rxbyte = 0xE4;
			break;
		case 0xC0: //"A" variants
		case 0xC1:
		case 0xC2:
		case 0xC3:
		case 0xC4:
		case 0xC5:
			rxbyte = 0x41;
			break;
		case 0xC8: //"E" variants
		case 0xC9:
		case 0xCA:
		case 0xCB:
			rxbyte = 0x45;
			break;
		case 0xCC: //"I" variants
		case 0xCD:
		case 0xCE:
		case 0xCF:
			rxbyte = 0x49;
			break;
		case 0xD1: //"N" tilde -> plain "N"
			rxbyte = 0x43;
			break;
		case 0xD2: //"O" variants
		case 0xD3:
		case 0xD4:
		case 0xD5:
		case 0xD6:
		case 0xD8:
			rxbyte = 0x4F;
			break;
		case 0xD9: //"U" variants
		case 0xDA:
		case 0xDB:
		case 0xDC:
			rxbyte = 0x55;
			break;
		case 0xDD: //"Y" acute -> "Y"
			rxbyte = 0x59;
			break;
/*		case 0xDF: //beta  //mucks up LCDSmartie's degree symbol??
			rxbyte = 0xE2;
			break;
*/		case 0xE0: //"a" variants except umlaut
		case 0xE1:
		case 0xE2:
		case 0xE3:
		case 0xE5:
			rxbyte = 0x61;
			break;
		case 0xE7: //"c" cedilla -> "c"
			rxbyte = 0x63;
			break;
		case 0xE8: //"e" variants
		case 0xE9:
		case 0xEA:
		case 0xEB:
			rxbyte = 0x65;
			break;
		case 0xEC: //"i" variants
		case 0xED:
		case 0xEE:
		case 0xEF:
			rxbyte = 0x69;
			break;
		case 0xF2: //"o" variants except umlaut
		case 0xF3:
		case 0xF4:
		case 0xF5:
		case 0xF8:
			rxbyte = 0x6F;
			break;
		case 0xF7: //division symbol
			rxbyte = 0xFD;
			break;
		case 0xF9: //"u" variants except umlaut
		case 0xFA:
		case 0xFB:
			rxbyte = 0x75;
			break;
		default:
			break;
	}

	lcd.print(rxbyte);  //otherwise a plain char so we print it to lcd
	return;


}


references:

original source code:
http://www.nuelectronics.com/estore/ind ... lcdsmartie

arduino liquidcrystal library
http://arduino.cc/en/Reference/LiquidCr ... LCDLibrary

disclaimer: this mod was done in less than 5 min with the replace all button, may be bugs, please let me know

mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Re: convert old 8 bit lcd's to use usb

Post by mattcro »

Hmmm, I recognise that code from somewhere... nuelectronics don't seem to have any source credits!!

see http://forums.lcdsmartie.org/viewtopic.php?f=11&t=501 for the original project that this code is "borrowed" from.

lalalandrus
Posts: 4
Joined: July 27th, 2006, 11:27 pm

Re: convert old 8 bit lcd's to use usb

Post by lalalandrus »

interesting, couldnt see the source code since it is on geocities :?

if nuelectronics lifted the code from you, it is a pity they didnt give cred.

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Re: convert old 8 bit lcd's to use usb

Post by limbo »

mattcro wrote:Hmmm, I recognise that code from somewhere... nuelectronics don't seem to have any source credits!!

see http://forums.lcdsmartie.org/viewtopic.php?f=11&t=501 for the original project that this code is "borrowed" from.
Try to contact nuelectronics and ask them to add source credits! If nothing happens I will ask it as well... and maybe more members can send emails about it if they try to ignore us.

BTW the link contanaed on this thread is not working. Any alternative?

mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Re: convert old 8 bit lcd's to use usb

Post by mattcro »

I'll get in touch with nuelectronics...

I've attached a zip with project files to the first post here: http://forums.lcdsmartie.org/viewtopic. ... 501&p=2463
I haven't done anything on this project since v0.87 in 2006. My LCD does all I need and is still in daily use.

Knock201
Posts: 2
Joined: October 30th, 2012, 6:20 am

Re: convert old 8 bit lcd's to use usb

Post by Knock201 »

I did the same thing but all i get for output is seemingly random numbers. any ideas?

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Re: convert old 8 bit lcd's to use usb

Post by limbo »

Knock201 wrote:I did the same thing but all i get for output is seemingly random numbers. any ideas?
Probably you have different pin out on your display. Check its specs and the connections.

Post Reply