2 (or 3) wire LCD module interface

westaust55

Moderator
The ideal interface between a PICAXE chip and an LCD display module is usually a 1-wire serial interface. This is done to:
- minimize the number of output pins required (essential on smaller PICAXE chips)
- utilize the inbuilt SEROUT command for ease of operation.
- achieve higher speeds in data transfer to the LCD module

Revolution Education (AXE033) and PH Anderson sell some very good examples of 1-wire based LCD displays

One downside of the 1-wire serial interface can be the cost associated with the serial interface board.

two frequent alternatives used by many are:
- the serial to 4-bit parallel FRM010 firmware chip sold by Revolution Education and presented in the PICAXE manual 3 on page 34
- the 6-wire interface as presented in PICAXE manual 3 on pages 35 to 39

This project offers a further alternative using either a 2 wire or 3-wire approach.
The 2-wire approach is generally best suited to the 08M and smaller PICAXE chips whereas the 3-wire approach which saves a few bytes of program code and is slightly faster is generally better suited to the mid to larger PIACXE chips.

The concept is based on an approach used by Myke Predko. Myke’s approach used a hex shift register and the 4-bit parallel to LCD data interface method.

The difference is that this project utilizes two 74HC4015 IC’s. These chips contain dual 4-bit shift registers giving a total of four 4-bit shift registers. Three such registers are linked in series as a 12 bit shift register which can handle:
- 8 parallel data bits to the LCD module
- the RS signal line
- the E signal line
- control bit for the backlight

The 12th bit is not used in this project.

The last 4-bit shift register is used to take the backlight control bit from the main shift register and latch that bit when the “E” signal is passed to the LCD module. This prevents the backlight flickering on and off when new data is being shifted into the 12-bit shift register.

The following posts provide:
1. The shift register interface board layout PEBBLE files
2. The shift register interface board schematic
3. The shift register interface board timing sequence
4. The PICAXE code with example text to control the LCD via the shift register interface board
5. A few photos of the interface board etc



Attached below are the PEBBLE layout files




EDIT: Some further recommendations:
1. Not all LCD modules have onboard current limiting resistors. For those using an LCD module without such an inbuilt current limiting backlight resistor, I recommend to add say a 5.6 or 8.2 Ohm resistor in place of the orange wire at the very left of my layout diagram in Post 1.
2. The aim is to operate the LCD backlight switching transistor in saturation to minimise the Vce voltage. In place of the 4.7kOHm resistor I have used, to accommodate operation from a 4.5V (3xAA cell) supply, a 3.3kOhm resistor would be a better option (still acceptable at 5V).
 

Attachments

Last edited:

westaust55

Moderator
2 (or 3) wire LCD module interface (Part 5)

And yes it DOES work :D


As a note: I found the 74HC4015 IC's to be available on E-Bay from Hong Kong and the UK.

Also here in Australia from Rockby Electronics - an electronics retailer in Victoria - but at far higher prices than thru E-Bay
http://rockby.com.au/myindex.cfm
 

Attachments

Last edited:

Dippy

Moderator
That's a comprehensive setup Westy and a handy alternative.

I couldn't quite follow...
Have I got this right?
The benefits are:-
1. Fewer pins used from PICAXE - if compared to parallel connection LCD.
2. Less cost (but more code) - if compared to firmware chip?

It's a great idea and well done for implementing.

I guess peple will have to judge for themselves whether the benefits outweigh the extra space and hassle for all this.
Some people prefer the firmware chip to save a lot of code on the 'host' and for some people code which they couldn't do.

What are the cost benefits by the way compared to firmware chip?
 

ValueAdd

Senior Member
Have to agree with Dippy that it does make for a great alternative.

Well documented so almost anyone should be able build the circuit, "grab" the code and get the idea working.

Being a great user of technology but less inventive, I wish there were a few more completed projects here well documented as this project.
 

westaust55

Moderator
That's a comprehensive setup Westy and a handy alternative.

I couldn't quite follow...
Have I got this right?
The benefits are:-
1. Fewer pins used from PICAXE - if compared to parallel connection LCD.
2. Less cost (but more code) - if compared to firmware chip?

It's a great idea and well done for implementing.

I guess peple will have to judge for themselves whether the benefits outweigh the extra space and hassle for all this.
Some people prefer the firmware chip to save a lot of code on the 'host' and for some people code which they couldn't do.

What are the cost benefits by the way compared to firmware chip?
That right Dippy.

Additionally, the program code is provided which makes life easy for others to implement -the core code is about 90 bytes.
 

nbw

Senior Member
Hi west, I wonder about the transistor on the backlight. If you're connecting the anode to the same V+ as the picaxe, the backlight will only see around 4.3V once the E-B drop is taken into account. I'm thinking it might work with some backlights but not others? Mine refuses to light up under 4.5V, I suspect there are some hidden resistors at work....

The other thing I wonder about is if someone wound too far on the backlight pot - would it zero out and allow a free-for-all current into the B/light.

I like the circuitry though - very clean - and as you say, great for where a project could benefit from an LCD but pin count is tight, a serial LCD is too $$, and you have space for a couple of support chips. Good show!
 

westaust55

Moderator
Hi nbw,
Thanks for the comments.

The LCD modules that I have are DSE type (bought about 6 when they were on sale for $7 instead of $29) have LED array type backlight with an onboard 8 Ohm resistor for current limiting. There are onboard links that permit bridging/bypass of the LED backlight. The backlight with no further resistance draws around 180mA.

NOTE; not all LCD modules have onboard current limiting resistors so, thinking further, I would recommend that for those using an LCD module without such a backlight resistor, to add say a 5.6 or 8.2 Ohm resistor in place of the orange wire at the very left of my layout diagram in Post 1.

The NPN low side switching transistor is intended to operate in saturation so that the Vce is minimal. By the datasheet Vce(sat) is 0.7V maximum at Ic=500mA so with 180mA or less, Vce(sat) will also be less.
I have a 4.7KOhm base resistor as I run from a 5V supply but thinking about those with 4.5V supplies (3xAA cells), a 3.3 kOhm resistor would possibly be a more versatile value. (I will go back and add a note to this effect at post 1)
I used a 25 turn 100 Ohm pot for the backlight and while I did not measure the external resistance in operation I did find that I could dim the backlight quite a bit.
 

westaust55

Moderator
2 (or 3) wire LCD module interface - more information

For completeness of information (and as discussed in a different thread), anyone constructing this LCD interface module needs to be aware that the timing of various signals relative to each other is not 100% in alignment with the typical LCD datasheets.

By most datasheets, the “RS” line should be set to the required level (high or low) around 40ns before the “E” line is raised to a high level.

This project actually sets the “RS” line at the same time that the data signals are made valid. Also “E” may be set high at the same time that the data signals are made valid or a short time after.

This project does work with the Dick Smith Electronics 2x16 char LCD modules (Ampire controller chip) and likely will also work with many other LCD modules. Many LCD modules are tolerant of the timing as used by this project but not doubt, there will be some that are not as tolerant and thus will not work.
 

westaust55

Moderator
The program code I initially wrote for the 2/3 wire LCD module driver using the 74HC4015 shift register method was relatively slow.

I did some tests using the SHIFTOUT (SPIOUT) command available for the X1 and X2 parts in place of the bit-bashed program coding.

Using a loop to display the same 2x16 (=32 characters of information plus a couple of control characters) 100 times through the loop and timing the duration for this showed that the X1/X2 inbuilt SHIFTOUT command is around 10 times faster that the bit-bashing method.

Effectively the test results gave:
-, the bit-bash method took 220 seconds to send 3400 characters which equates to 65ms per characters or 2.2sec to fill the 2x16 screen (at 4MHz clock speed)
- the SHIFTOUT commands took 26 seconds to send the same 3400 characters which equates to 7.6ms per characters or 0.26sec to fill the 2x16 screen (at 4MHz clock speed)

Obviously these tests include some overhead for the loop but do give an idea of the time improvement that can be achieved with the SHIFTOUT command on the X1 and X2 parts.

Obviously not as fast as directly driving the LCD using 4 bit mode and 6 PICAXE outputs or using a serial module such as the AXE033 which at 2400 baudrate takes the PICAXE about 4.2ms to send each character.
 

nick12ab

Senior Member
Sorry for very old thread bumping, but just to help those searching the forum for Myke Predko's work, the correct spelling is Myke Predko, not Myke Predo, and the correct spelling prior to this post never appeared in this thread so searching for his name would never find this thread.

 

westaust55

Moderator
Nothing wrong with bring an old thread forward occasionally if there is new information to add.
Myke's surname spelling dutifully noted.

As many may in fact not have Myke's book, here is the link to the Reynolds Electronics website where some of Myke's work is made readily available:
http://www.rentron.com/myke1.htm
 

wagp

New Member
Thanks for all the info.

The Serial display device I'm using is a Picaxe product AXE133 Serial OLED / Serial LCD.
(I actually have two, a 2 line and a 4 line)
I don't think it has a parallel interface capability.

At one point I tried commenting out all of the serout commands to the displays and I still had the problem of incoming background serial receives stopping before all of the data was received. However, the program is large (3536 bytes out of 4096) and I may have missed something.

Do you think it possible my problem may be a conflict between the background serial I/O and the I2C bus?

I did have a problem between I2C and the Readtemp command.
 

westaust55

Moderator
Wagp already has another thread in relation to his problem with conflict between background serial receive and serial (SEROUT) to a serial LCD.
It had been suggested to convert to a parallel interface and this thread was then given as an alternate for consideration to overcome the conflicts - not to expound upon the problems in a thread in the Finished Projects area.
 
Last edited:
Top