Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Driving an LCD using ShiftRegister

Status
Not open for further replies.

Xenobius

Member level 5
Joined
Feb 25, 2019
Messages
84
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
850
Hi, I am trying to control an LCD using a shift register. I am using the very successful arduino LiquidCrystal library which is tried and tested but am trying to modify the only function which differs. Instead of writing bytes directly to pins (like in the original function below) I am trying to output using a shift register (also as below). Its good to point out that I do not have d0 to d7 pins but instead a shift register connected to the LCD where d0 = bit 1, d1 = bit 2, .... d7 = bit 8

As for rs, en and rw they are connected directly to the microcontroller so this is straight forward. LCD datasheet here

so technically, if I want to write the value binary 00001011 to d0-d7, using the shift register I should be able to shift out the value decimal 11 however this is not working. Can anyone assist please?

The original code as per github (the very last function scroll all the way down)
Code:
void LiquidCrystal::write8bits(uint8_t value) {
	for (int i = 0; i < 8; i++) {
		digitalWrite(_data_pins[i], (value >> i) & 0x01);
	}

	pulseEnable();
}

and my modified code
Code:
void LiquidCrystal::write8bits(uint8_t value) {
	digitalWrite(_latch, LOW);
	shiftOut(_data, _clock, LSBFIRST, value);
	digitalWrite(_latch, HIGH);

	pulseEnable();
}


Thanks
 

Attachments

  • Capture.PNG
    Capture.PNG
    20.1 KB · Views: 133

is the 'fourbitmode ' is set as true or false?
 

it is false yes just like the original source. it should technically be running as 8bit mode
however the screen refuses to show anything
 

For the LCd make sure that it is connected properly.
are you able to see black boxes in one line upon reset?
 

using the shift register I should be able to shift out the value decimal 11 however this is not working
It is not clear whether this is not working in simulation environment (once above schematic seems like drawn on ISIS Proteus) or on assembled circuit. If you have the means to debug, why not just to see what apeears on the shift register?
 

Hi actually its a fully assembled circuit and im debugging with no success

- - - Updated - - -

For the LCd make sure that it is connected properly.
are you able to see black boxes in one line upon reset?

no just the backlight lights up
 

Why did you choose LSBFIRST? It doesn't seem right.
 

To be fair I tried both MSB and LSB but to be fair im not sure
 

im debugging with no success

How are you debugging, step by step with break points? Anyway, define how did you came to the conclusion that it is not working, just by not seeing expected characters on LCD, or checking each command sent to the shift register during simulation?
 

I am using VisualMicro which allows me to debug however that's as far as I can go without some ideas. I send simple text and no characters show up.

- - - Updated - - -

Here's a suspicion. Could the LCD be damaged if on VEE I supplied 5v? According to the datasheet, VEE should be from 0.3v up to 1.2v. But it says nothing about limits. As in the schematic I connected a trimpot to vary the voltage on VEE and I am certain that it was 5V at one point in time as I was turning it. It is currently set to exactly 1v.
 

Hi,

VEE: post (a link to ) the datasheet.

Klaus

Added: I just recognized it's on pos#1.
So, No, it should not get damaged with VEE = 5V.

I agree, that the datasheet is not like a datasheet should be.
I'm missing:
* absolute maximum ratings
* recommended operating conditions
* timing diagrams
... and so on

I personally like (and use) the Electronic Assembly parts, but the datasheets are really poor.

Klaus
 

I agree, that the datasheet is not like a datasheet should be.
The display module datasheet should be read together with controller ST7066 documentation which has all the missing information.

I suggest to proceed with the suggestions given by andre_teprom. LCD controller interface is fully static, you can single step through the code and check the shift register operation as well as the correct output of each command byte.

I guess 95% of failing LCD interface codes are due to misunderstanding the protocol requirements, e.g. command timing, soft versus hardware reset.
 

Hi, Yes while I do agree that it is easy to misunderstand, I am using an existing library as in my first post and only changing the last 2 functions which instead of outputting bits directly to different pins, I am outputting bits to the shift register. I shall try to figure out a way to find out what the shift register is outputting.
 

just backlights may mean the lcd is not initialised properly or it is not functioning.

connect the LCD alone to pwr supply ,backlight and contrast setting pot without any i/p data and .control connections.

Switch on LCD and adjust the pot to see the character boxes.

If you are able to see it then you must check the serial2parallel block and up the line.

If not replace LCD and see.
 
Ok so clearly the LCD may be bust because I see nothing at all! :(

- - - Updated - - -

just backlights may mean the lcd is not initialised properly or it is not functioning.

connect the LCD alone to pwr supply ,backlight and contrast setting pot without any i/p data and .control connections.

Switch on LCD and adjust the pot to see the character boxes.

If you are able to see it then you must check the serial2parallel block and up the line.

If not replace LCD and see.

You were correct Sir! The LCD was bust! Thanks for the tip. It works like a charm
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top