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

Parallel port tests

Discussion about LCD's and other related hardware

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

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

Parallel port tests

Post by mattcro »

I was curious about the parallel port timing in Smartie due to the number of people having display corruption issues (and some not working at all on one PC but fine on another).

I wired up an old 2x16 LCD to a short ribbon cable and DB25 plug as per the 1st schematic on the Smartie circuits page and connected it to the PC via 2 cables each 1.8m (6ft) plus a port switch box, all draped around the back of the PC and across the workbench. The LCD is provided with +5V regulated from a bench PSU. And it all works wonderfully with Smartie 5.4rc2 and 5.4 release. I had it going for about an hour (lots of scrolling, custom chars etc) and didn't see any glitches.

I think the cables are shielded, but they're standard parallel extension cables. I don't have any spare ribbon cable, but would like to do some tests on long unshielded plain ribbon cable.

The signals at the LCD (driven from on-board LPT on older socket-A motherboard circa 2003 with AthlonXP/2000+) look nice on an oscilloscope. Slightly rounded edges of course, and the high-level voltage is only 4V, but completely glitch-free.

The timing appears to be consistent - Enable pulses are 20-25us wide, with about 100us between write cycles. Data line (and RS) setup time is about 20us. These timings appear to be as designed in the driver code. There is an occasional extra-long pulse or delay (like 200-500us) between pulses, possibly due to interrupts/task switching/threads etc, but all relative timings seem to be maintained so nothing to worry about. These timings are around 10x longer than the min spec for LCDs I have the datasheets for, so fairly conservative.

There's a possible problem in that the delay between instructions (either 40us, 100us or 1640us) is the minimum specified for most LCDs. That should be safe, but I guess some LCDs might run a bit slower and the timings would be violated. The probable result is occasional display corruption.

The timing multiplier does exactly what it's supposed to: everything is stretched out by the specified factor, so using 2 or higher should solve problems caused by smeared pulses or slow LCDs...

I haven't tried using the LPT port on a newer PC, but the timings should still be OK assuming the QueryPerformanceCounter()-based delay function does its job.

So I guess the causes for display corruption are: poor circuit construction, poor quality (or way too long) cable, or parallel port hardware problems. I don't know about the delay between instructions - that could be a problem for some LCDs.
caesar
Forum Supporter
Posts: 734
Joined: October 15th, 2005, 10:39 am
Location: Romania
Contact:

Post by caesar »

Great findings! Looking forward to see the long ribbon tests!

The 4V should't drive the LCD anymore, maybe you have a good lcd model (maybe a classic HD44780 chip).
The new KS chinese types that I tested are not working below 4.3V.
mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Post by mattcro »

The data sheets for my KS0066 and HD44780 LCDs give different input levels
KS0066 seems similar to TTL levels, but the original Hitachi HD44780 has a higher minimum voltage for a logical high, which could cause problems with some parallel ports. For my tests, the power supply was always 5V.

For the KS0066: Low is <0.6V. High is >2.2V

For HD44780: Low is <0.55V. High is >0.7Vcc (ie >3.5V at Vcc=5V)

A Microtip module I once saw had input levels more like CMOS, where logic-high was >0.8Vdd (ie >4V with a 5V supply). That would be very likely to cause problems with a parallel port that can't provide the full 5V for high outputs.

Perhaps we need to start using some kind of buffer logic chip to ensure the LPT-connected LCDs get proper signal levels...

PS I have heaps of ribbon cable somewhere, but I think it may be in storage as we've recently moved house :(
mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Post by mattcro »

I tried the same HD44780 2x16 LCD with 3 metres of 14-way ribbon cable, plus the 1.8m parallel cable and the switch box, and it still works fine (lots of custom chars and scrolling).

The LCD is powered from a regulated 5V PSU at one end of the ribbon cable using 1 wire of the ribbon, and I used 2 wires for the 0V (ground) connection.

The ribbon is draped around the PC and workbench as before (I bunched it up too), and the signals still look good on the scope.

Even a bit of VHF RF (handheld transceiver) next to the cable doesn't seem to cause any problems. I can also "pause" the display by switching the parallel connection using the switch box and it keeps going when I switch back.

I realise this isn't much help for those having parallel port problems, but it shows that it's possible for such a long cable to work.

For parallel port wiring, I suggest using 2 or more conductors in the ribbon cable for ground, and soldering a 100nF capacitor across the power supply pins on the LCD. This should help with any power supply and ground noise. If you use a backlight, you should probably use a couple of wires for the +5V and several for the 0V.
Post Reply