South UK
Offline
Sr. Member
Karma: 1
Posts: 479
|
 |
« Reply #30 on: September 06, 2011, 01:00:35 pm » |
I see what you mean about calling the reset, its no different to when it first powers up because the arduino starts running exactly the same code. I guess it must be something going wrong with the lcd on initial power up? Maybe its not ready and initializes before the arduino? I'm really stumped lol. Thanks for the help, much appreciated by the way, if it helps to understand here is the code that I'm currently running #include <LiquidCrystal.h> LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int analoginput = 0; int analoginput1 = 1; int analoginput2 = 2; float vin = 0.0; float vin1 = 0.0; float vin2 = 0.0;
void setup(){ delay(100); lcd.begin(16, 2); delay(1000); lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.setCursor(0, 1); lcd.print("iSensor tester"); delay(4000); lcd.clear();
}
void loop(){ delay(1400);
// read the value on analog input lcd.setCursor(0,0); lcd.print ("Vin:"); vin = analogRead(analoginput)*5.00/1024*2; lcd.print(vin, 3); lcd.print ("v"); lcd.setCursor(0,1); lcd.print ("R:"); vin1 = analogRead(analoginput1)*5.00/1024; lcd.print(vin1, 2); lcd.print ("v");
lcd.setCursor(9,1); lcd.print ("O:"); vin2 = analogRead(analoginput2)*5.00/1024; lcd.print(vin2, 2); lcd.print ("v");
delay(1400);
}
|
|
|
|
« Last Edit: March 04, 2013, 08:37:25 am by dtokez »
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 131
Posts: 4655
|
 |
« Reply #31 on: September 06, 2011, 01:04:08 pm » |
Following on from my previous reply, does it work if you repeat all the code in setup() again? i.e. do the whole block twice over.
btw I see that the AdaFruit tutorial says to connect the backlight directly between Vcc and gnd, but I think on some lcds such as the one I have, you need a series resistor for the backlight.
|
|
|
|
« Last Edit: September 06, 2011, 01:06:22 pm by dc42 »
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
South UK
Offline
Sr. Member
Karma: 1
Posts: 479
|
 |
« Reply #32 on: September 07, 2011, 06:46:17 am » |
Just tried with the set up doubled, still no good  Thanks for the heads up, I did use a resistor on the backlight. I really think its something simple that I'm doing wrong, because I have tried 3 different types screens, and two arduino's with all the same results 
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 131
Posts: 4655
|
 |
« Reply #33 on: September 07, 2011, 07:23:44 am » |
I can only thing of 2 3 things left to do: 1. Send the initialisation sequence yourself in setup(). See page 12 of the datasheet at http://www.egochina.net.cn/eBay/Download/SPLC780D.pdf for the sequence for 4-bit interface. For each item in the sequence, you need to wait for any delay time that is indicated, set the pins to the specified values, then pulse the EN pin high and then low again. If no delay time is indicated, you still need a delay between commands, but I can't find anything in the data sheet that says how long. 2. Try with the RW pin also connected to the Arduino, using the LiquidCrystal constructor that takes 7 pin numbers. That way, the LCD library will wait for the busy flag to clear before sending new instructions to the LCD. 3. Take a copy of the LiquidCrystal .cpp file and include it in your sketch, but double all the delays.
|
|
|
|
« Last Edit: September 07, 2011, 07:26:44 am by dc42 »
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3461
|
 |
« Reply #34 on: September 07, 2011, 07:57:18 am » |
2. Try with the RW pin also connected to the Arduino, using the LiquidCrystal constructor that takes 7 pin numbers. That way, the LCD library will wait for the busy flag to clear before sending new instructions to the LCD. If you are talking about the LiquidCrystal library that is suppiled with the Arduino IDE that won't help at all. All the LiquidCrystal library does with the R/W pin is drive it low and keep it there. What you would be accomplishing is just unnecessarily tying up a extra Arduino I/O pin.
On the other hand the LiquidCrystal440 library will indeed use the busy flag as described but that won't help you either since you can't use the busy flag during the early part of the initialization where the LCD controller reset is being accomplished. The improved time delays in the library will likely take care of your problem.Don
|
|
|
|
« Last Edit: September 07, 2011, 08:00:23 am by floresta »
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 131
Posts: 4655
|
 |
« Reply #35 on: September 07, 2011, 04:11:14 pm » |
It sounds like he should try the LiquidCrystal440 library then. How can he get it?
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3461
|
 |
« Reply #36 on: September 07, 2011, 10:11:26 pm » |
It sounds like he should try the LiquidCrystal440 library then. How can he get it? He could try the link in reply #7.Don
|
|
|
|
|
Logged
|
|
|
|
|
South UK
Offline
Sr. Member
Karma: 1
Posts: 479
|
 |
« Reply #37 on: September 13, 2011, 01:49:37 pm » |
Hi all, I have tried the liquidcrystal440 lib to no avail sadly  JRaines is currently looking at two of the screens for me too see if he can work out anything I'm missing
|
|
|
|
|
Logged
|
|
|
|
|
Minnesota USA
Offline
Sr. Member
Karma: 0
Posts: 323
Made it mahself outta sand 'n wahr.
|
 |
« Reply #38 on: September 17, 2011, 04:04:14 pm » |
I did look at the 2 LCDs Dan sent. They actually work well with the recent version of LiquidCrystal. I think it is slightly slower than the usual HD44780 type display. The benchmark that I use to determine how fast the display will process text using the busy flag to handshake with the Arduino shows it running about 9% slower than one i got from Adafruit (and THAT display was a little too slow for the LiquidCrystal routine that is packaged with Arduino 17- 1.0). It does not, however, run slower than the display I bought at Axman; that one is about 30% slower yet)
This is a good place to review the timing changes I made in the recent LiquidCrystal440 versions. There are several delays involved in initialization:
delay to allow power to rise to 5 volts and chip to initialize itself: 135000 usec was 50000usec in 17-1.0 delay after pulling RS high 1st time: 5000usec was 4500 usec in 17-1.0 delay for next 3 writes of init: 150usec no change (note that 17-1.0 also has an 8bit mode with an extra 4500usec delay)
and there are two delay timings in the code not associated with initialization: delay after home command: 2900 usec was 2000 usec delay for each character: 320 usec was 100 usec
Remarkably when one uses the LiquidCrystal440 interfaces that check the busy flag even on my slowest (axman) display the throughput is about 3 timss as fast as it is with these timed delays. I suspect that there must be some specific situations that take much longer in the HD44780 than others so that only occasionally is the full 320usec needed on the axman display, but that display won't run reliably with a 300usec delay between characters when not testing the busy flag.
|
|
|
|
|
Logged
|
|
|
|
|
South UK
Offline
Sr. Member
Karma: 1
Posts: 479
|
 |
« Reply #39 on: September 19, 2011, 05:43:42 am » |
Thanks for looking into it! Did you see any start up issues at all similar to the ones that I am regularly seeing?
|
|
|
|
|
Logged
|
|
|
|
|
Minnesota USA
Offline
Sr. Member
Karma: 0
Posts: 323
Made it mahself outta sand 'n wahr.
|
 |
« Reply #40 on: September 19, 2011, 05:30:47 pm » |
I did not see any problems, here.
|
|
|
|
|
Logged
|
|
|
|
|
South UK
Offline
Sr. Member
Karma: 1
Posts: 479
|
 |
« Reply #41 on: September 20, 2011, 11:19:17 am » |
so if if you power up the arduino and the screens at the same time the screen always initialized fine? Really wish I could work out what I'm doing wrong 
|
|
|
|
|
Logged
|
|
|
|
|
Minnesota USA
Offline
Sr. Member
Karma: 0
Posts: 323
Made it mahself outta sand 'n wahr.
|
 |
« Reply #42 on: September 20, 2011, 05:48:03 pm » |
I just did that a bunch of times in a row. The one way I saw a problem was if it was powered up, I removed power briefly from the Arduino and then quickly plugged it back in--power off for just a second. Don (floresta) probably can say more precisely what is likely going on in that specific situation. If the power is off for 3 seconds or more it always seems to work fine.
|
|
|
|
|
Logged
|
|
|
|
|
Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3461
|
 |
« Reply #43 on: September 20, 2011, 09:03:05 pm » |
Don (floresta) probably can say more precisely what is likely going on in that specific situation. I would say 'don't do that'.Don
|
|
|
|
|
Logged
|
|
|
|
|
Centurion RSA
Offline
Full Member
Karma: 0
Posts: 154
Arduino rocks
|
 |
« Reply #44 on: September 26, 2011, 04:05:29 pm » |
I have been following this topic as I had the same type of error. I finally noticed that the two control signals were swapped. (pins 12 and 11). After fixing that I removed all the delays and the many displays that I tested all worked just fine with the LiquidCrystal440 without the R/W signal.
|
|
|
|
|
Logged
|
Rather people think you to be a fool than you open your mouth and confirm it.
|
|
|
|
|