I am using a Ez430-F2013 to try and drive a 16x2 LCD. I know that the MSP430's run off ~3.3v so I have a 7805 dropping a 9v battery down to 5v to drive the LCD.
The problem...
To begin with I was using the wrong datasheet (doh!) and hence was wiring up wrong. Since then I have found the error in my ways and corrected the circuit, but still no reaction from the display other than the backlight turning on.
So...
I was wondering if (with 5v for no more than 60s on the wrong pins) there could be enough damage to the lcd to stop it working?
I was helping my brother hook one of these up today and he did exactly the same (swapped all the pins, connecting VCC and VO to the data pins). There was no damage to the display, but you can never know. You can simulate your code using Proteus if you can obtain a trial license - that will eliminate any software issues.
Other than that, post your schematic and code we we can try to take a look.
Thanks for the quick reply. I cant remember which pins were reversed, Im thinking that some of the data pins were stuck high and others grounded, but I cant be certain.
I do have access to proteus, but didnt know that it had the MSP430 chips available on it? Would be great to try it out like that if it does.
Im not certain which lines got reversed as I was looking at a different datasheet, but I dont think that I reversed Vdd and Vss at any point.
Does proteus simulate the MSP430 range? I do have access to it but have not used it as i didnt think it did.
After powering up the LCD is there an easy way to tell that it is damaged or not without sending inststructions? Is there also a noticable difference when the screen itself is powered up to when it is not and just the backlight functioning?
Unfortunately it doesn't, but since the LCDs are operated via GPIOs it shouldn't be too hard to simulate using a PIC (which proteus does support) - just to make sure you are sending the commands right.
Visual indications - i don't know if all LCDs behave the same way. The one i used today showed slight shadowing of the first row which increased as i upped the voltage on VO (before any commands sent).
Again, if you post your code and schematics maybe we can point glaring errors.
Hi. In order to test the lcd I have been using pre-written code by two other people (neither of which has worked so far) I was aiming to get it running as a test then start coding my own set of instructions.
The code and pin connections are used there, but modified for my lcd display as pin positions are pretty different (hence wiring up wrong)
Might just get another LCD display and give it a try. Anyone know where to get one pretty cheap in the UK? This one cost me just over £5 from RS with my student discount.
After a further hour of tests Ive given in to the thought that Ive broken the LCD, so have ordered some more.
If anyone is interested, someone is selling 10x 16x2 LCD's without backlight for £10 + £2P&P... Just ordered mine and it still says over 10 lots available.
Have you got the contrast voltage set for the lcd? If its set too high it would give the symptom of being dead..
I found the first time I used an lcd, I thought it was dead...Turned out that the contrast voltage needs to be turned rifgt down to zero volts almost...in fact even a negative voltage might have helped.
LCD contrast is correct I think, when the LCD turns on it shows one line light and the other dark, I'm assuming this is some sort of startup test? As I mentioned before, I'm sure its powered up ok... just wont take data and give me a blinking cursor!
Ive tried manually setting DB0 - DB4 at 5v and clocking E, no result
I have also tried with microcontroller doing DB5, E, 0, E, 0, E, DB4-DB7, E. ( I think this is the same as above but 4bit mode?)
as it seem there isnt contrast prob.. so have u grounded the R/w pin ? and it also appears tht lcd is not initializing means tht ur microcontroller has not started or else there is some error in ur control command..
R/W is grounded, I assumed a problem with the uc, so tried to connect DB0-DB3 to +5v, then touch +5v to the E, but no response. Is this normal also? Tried looking on the internet for stuff like this, but all info assumes that you can get them running ok!
What exactly did you expect to happen when you did that? You do realize that if you are working in 4 bit mode you need to connect to DB[4:7] and not DB[0:3]?
I don't understand why you don't just post your schematics and code. HD44780 LCDs are easy to set up and if it doesn't work it should be pretty easy to spot the error.
Hi. Thanks for all your help, it is much appreciated.
The basic code follows.. just to try and get the lcd initialized!
Code:
#include <msp430x20x3.h>
#define E BIT0
#define RS BIT1
#define DB4 BIT2
#define DB5 BIT3
#define DB6 BIT4
#define DB6 BIT5
void wait(void) // simple function creates delay
{
int i, q;
for (i = 0; i < 100; i++);
{
q = 10*100; // slow it down a little
}
}
void enable(void)
{
wait();
P1OUT |= E; // enable E
wait();
P1OUT ^= E; // disable E
wait();
}
int main(void)
{
P1DIR = 0xff; // all ports facing out
P1OUT = 0; // make sure everything is off
wait();
P1OUT |= DB5; // set 4bit mode
enable();
P1OUT = 0; // first nibble
enable();
P1OUT |= ( DB4 | DB5 | DB6 | DB7 ); // clear screen, blink cursor
enable();
__low_power_mode_4(); // dont move any further
return 0;
}
The circuit should explain itself from how the code is written, but it is attached anyway.
Regarding the parallel port, its a good idea, but Im on one of those laptops that has got rid of every port aside from usb, hdmi, esata and all other stuff that I dont need
Once again, thanks for all the help that your offering.
1) There is no way for me to see how P1 is connected to the LCD (which bits are mapped to which data lines). According to your code, the MSb (bit 7) is connected to DB7, bit 6 to DB6 and so forth. If this is not the case you are not connected properly. To verify, break after: P1OUT |= DB5; and test the data lines. The correct values should be: DB7: 0 DB6: 0 DB5: 1 DB4: 0
2) I don't know if your startup sequence is wrong, but it's different than mine. Try to following:
// initial function set
DB7 : DB4 = 0010
Pulse Enable
Wait 50ms
At this point you should see a blinking cursor. Check my drivers page for an HD44780 driver which should show you how to continue the initialization (not much further).
3) Your contrast pin (3) is grounded. This will set the contrast to 0 and you will see nothing. Connect this to a variable resistor.
4) I think the enable pulse has a max value. Check the data sheet and see that you are within spec. I pulse it for about ~5uS i think.