74HC595 LCD Adapter Question

Hacking multi-tool. Get one for $30, including worldwide shipping.

74HC595 LCD Adapter Question

Postby McLaren » Thu Jul 19, 2012 6:21 pm

If the LCD E pin is connected to an output on the 74HC595, does that imply that the BP firmware must load the 74HC595 shift register six times in order to write a single byte to the LCD? If so, would there be any advantage using a 74HC164 or similar IC with a single shift register load operation to write the LCD in 8-bit interface mode (using the same three pin interface from the BP)?

Food for thought.

Cheerful regards, Mike
Attachments
74HC164 8-bit Interface.png
McLaren
Newbie
Newbie
 
Posts: 17
Joined: Sat Mar 10, 2012 4:53 pm
Location: Michigan, USA

Re: 74HC595 LCD Adapter Question

Postby matseng » Thu Jul 19, 2012 9:44 pm

That's an interesting alternative to the common '595 three-wire interface to LCD's - I don't remember that I've seen it before.

Another version that not all might be aware of is a 1-wire interface using RC timing and a '595. Very slow but only uses one pin on the microcontroller so it might come in handy sometimes.

http://www.romanblack.com/shift1.htm
RomanBlack-shift1c.gif
1-wire LCD interface by Roman Black
User avatar
matseng
Hero Member
Hero Member
 
Posts: 876
Joined: Sat Oct 15, 2011 12:29 pm
Location: Kuala Lumpur, Malaysia

Re: 74HC595 LCD Adapter Question

Postby McLaren » Fri Jul 20, 2012 8:44 am

That's a nice design but, as you mentioned, it's very slow. If it requires six shift register load operations, it could take several milliseconds to write a single byte to the LCD.

Here's a reasonably economical 1-pin Serial interface solution. It would cost a bit more compared to a 74HC595 or 74HC164 based solution but it's smaller and it reduces host software overhead by performing the LCD initialization. For the benefit of PICBASICPRO users, you precede any command character (RS=0) with a 0xFE character. For example, send 0xFE followed by 0xC0 to set the LCD DDRAM address to line 2 tab 1.

Food for thought.

Cheerful regards, Mike
Attachments
Proto LCD.jpg
10K Counter Concept.jpg
Last edited by McLaren on Fri Jul 20, 2012 9:34 am, edited 1 time in total.
McLaren
Newbie
Newbie
 
Posts: 17
Joined: Sat Mar 10, 2012 4:53 pm
Location: Michigan, USA

Re: 74HC595 LCD Adapter Question

Postby matseng » Fri Jul 20, 2012 9:21 am

Not bad.... Not too expensive and can be made really small - sometimes an extra microcontroller makes sense.

I just routed a small PCB for the Roman Black version with the addition of being able to read a button as well from the same single port. It works like a charm on the breadboard and I can fit three of them on a 5x5cm Seeed PCB, so I think I'll make a batch of them just for fun.

1LCD.png
Single wire LCD & button controller
User avatar
matseng
Hero Member
Hero Member
 
Posts: 876
Joined: Sat Oct 15, 2011 12:29 pm
Location: Kuala Lumpur, Malaysia

Re: 74HC595 LCD Adapter Question

Postby McLaren » Fri Jul 20, 2012 9:36 am

oh... very nice!!!

I wonder how small the 8-pin PIC based interface PCB could be? I suspect you could leave out the middle four pins (D0..D3) on the LCD connector and that would free up a little bit of PCB real estate. I'm going to have to play with this.
McLaren
Newbie
Newbie
 
Posts: 17
Joined: Sat Mar 10, 2012 4:53 pm
Location: Michigan, USA

Re: 74HC595 LCD Adapter Question

Postby ian » Wed Jul 25, 2012 10:44 am

I guess in 4 bit it does use 6 instructions. After everything is setup properly we just load, raise, lower for each instruction, twice for 4 bits. The SPI interface is very fast though, so I've never noticed delay (like on the old I2C LCD backpack).
User avatar
ian
Crew
Crew
 
Posts: 10803
Joined: Mon Jul 06, 2009 6:14 am

Re: 74HC595 LCD Adapter Question

Postby Sleepwalker3 » Thu Jul 26, 2012 1:43 am

Is there code for the 12F635 version?
User avatar
Sleepwalker3
Hero Member
Hero Member
 
Posts: 556
Joined: Mon Jan 16, 2012 4:12 am
Location: Down Under

Re: 74HC595 LCD Adapter Question

Postby McLaren » Thu Jul 26, 2012 3:44 pm

Sleepwalker3 wrote:Is there code for the 12F635 version?


Assembly language source file and hex file (for 12F683) attached... Allow approximately 60 msecs after power-up for LCD initialization before sending commands and/or data to the LCD. Default 57600 baud (can be changed in the firmware).

Have fun... Regards, Mike
Attachments
K8LH ezLCD v3 (12F683).zip
(4.24 KiB) Downloaded 1226 times
Last edited by McLaren on Thu Jul 26, 2012 6:48 pm, edited 1 time in total.
McLaren
Newbie
Newbie
 
Posts: 17
Joined: Sat Mar 10, 2012 4:53 pm
Location: Michigan, USA

Re: 74HC595 LCD Adapter Question

Postby McLaren » Thu Jul 26, 2012 4:43 pm

ian wrote:I guess in 4 bit it does use 6 instructions. After everything is setup properly we just load, raise, lower for each instruction, twice for 4 bits. The SPI interface is very fast though, so I've never noticed delay (like on the old I2C LCD backpack).


Thank you for the info and please forgive me if it seemed I was implying that the current method would be slow.
McLaren
Newbie
Newbie
 
Posts: 17
Joined: Sat Mar 10, 2012 4:53 pm
Location: Michigan, USA

Re: 74HC595 LCD Adapter Question

Postby ian » Fri Jul 27, 2012 2:57 am

I didnt think you were :) the v1 adaper using an i2c chip was painfully slow (never sold just posted).
User avatar
ian
Crew
Crew
 
Posts: 10803
Joined: Mon Jul 06, 2009 6:14 am

Re: 74HC595 LCD Adapter Question

Postby Sleepwalker3 » Fri Jul 27, 2012 3:00 pm

McLaren wrote:
Sleepwalker3 wrote:Is there code for the 12F635 version?


Assembly language source file and hex file (for 12F683) attached... Allow approximately 60 msecs after power-up for LCD initialization before sending commands and/or data to the LCD. Default 57600 baud (can be changed in the firmware).

Have fun... Regards, Mike


Thanks Mike :)
User avatar
Sleepwalker3
Hero Member
Hero Member
 
Posts: 556
Joined: Mon Jan 16, 2012 4:12 am
Location: Down Under

Re: 74HC595 LCD Adapter Question

Postby McLaren » Fri Jan 11, 2013 1:08 pm

Posted by mistake...
McLaren
Newbie
Newbie
 
Posts: 17
Joined: Sat Mar 10, 2012 4:53 pm
Location: Michigan, USA

Re: 74HC595 LCD Adapter Question

Postby matseng » Thu Aug 08, 2013 12:49 pm

I recently did a version of Mikes PIC-based 1-wire LCD backpack using a PIC12F1501 with a switch/button added to the same 1-wire interface.

After hacking the code a bit for the new model of PIC I couldn't get it to work at all. So now when I went on a business trip to Bangkok I put the backpack, a lcd, a pickit and the very nice Digilent Analog Discovery Logic Analyzer/Oscilloscope into a box and took it with me in case I'd get bored at the hotel some evening.

Well, this evening I was kinda bored...

After spending an hour or two of checking and debugging the software without any joy I connected the Analog Discovery in logic analyzer mode and had a go at it. The RS-line (that is being connected via a RC network from D4) was not acting as it should. Hacking some different test cases in the code didn't reveal the source of the problem.

I reconnected the Discovery as an oscilloscope and had a look at the D4 signal plus the output after the RC filter I saw that the output of the filter was very sluggish. It took about a millisecond to rise up to 3 volts from zero. Not at all what a RC network using a 10K resistor and a 330pF cap should act as.

Then I remembered that when I soldered the board I had taken both the 330pf RC cap and the 100nF decoupling cap from my storage boxes at the same time and got mixed them up. One of the caps was physically bigger than the other so I had just assumed that the biggest was the 100nF and soldered them without a second thought.

But.... I was wrong. So the board now have the 330pF as decoupling and a 100nF as the integrator. The RC constant is 300 (EDIT: not 30) times too slow. No wonder it didn't work. :-(

After adding a 1 mS delay in the PutNyb subroutine to compensate for the too large cap the LCD initialized just fine and I can print on it. :-)
Last edited by matseng on Fri Aug 09, 2013 6:47 am, edited 1 time in total.
User avatar
matseng
Hero Member
Hero Member
 
Posts: 876
Joined: Sat Oct 15, 2011 12:29 pm
Location: Kuala Lumpur, Malaysia

Re: 74HC595 LCD Adapter Question

Postby Sleepwalker3 » Fri Aug 09, 2013 6:28 am

LOL - Good story Mats, and I bet that 330pF is doing a wonderful job as a decoupling cap too!
;)
Why the new PIC, something you had on hand, more features, availability?
Isn't that 300 times too slow?
User avatar
Sleepwalker3
Hero Member
Hero Member
 
Posts: 556
Joined: Mon Jan 16, 2012 4:12 am
Location: Down Under

Re: 74HC595 LCD Adapter Question

Postby matseng » Fri Aug 09, 2013 6:46 am

I had them on stock at home already, and they're newer and is only half the price... And of course a bunch of new features that I have no use for :)

And yes - 300 is quite right, I must have missed a zero there.
User avatar
matseng
Hero Member
Hero Member
 
Posts: 876
Joined: Sat Oct 15, 2011 12:29 pm
Location: Kuala Lumpur, Malaysia

Next

Return to Bus Pirate Support