Go Down

Topic: LCD wraps output to 1 or 2 columns (Read 2076 times) previous topic - next topic

GaryP

Don,
Hmm, this doesn't belong here really, but is that playground full of not well tested and possibly bad instructions? Anybody can send their creations there and look like it's made by someone who looks like he/she knows what they are saying? That's not good...

Cheers,
Kari
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

no245

#16
Mar 13, 2011, 11:25 pm Last Edit: Mar 13, 2011, 11:30 pm by no245 Reason: 1
And anyone can post anything in the Arduino forum.  ;)

Quote
I wouldn't use the same pin number for both Tx and Rx.

Ok, I'll try that later. (I doubt it will help, since this used to work fine. But it's worth a try I guess.)

Quote
Are you sure that the compiler is doing the logical operations the way that you expect it to?

Why, is the arduino compiler known for such bugs? I didn't check the generated assembly (is there an easy way to do that with the Arduino tools?) if you mean that. I'm fairly certain the code is correct though.

Quote
I would start out by sending the specific numbers that the Sparkfun controller is expecting.

I already did that in the second post (after you asked me to  ;)) and it made no difference.

Quote
Don't bet on it.  Read the datasheet - including the notes.

That quote is from the datasheet actually. I don't see any other information about initialization. (But I'm not sure what I would be looking for.)

Quote
How about this one:
http://www.arduino.cc/playground/Code/SLCD

Well, apparently that site is unreliable. ;)
Also the code in that library looks really equivalent, except that it uses HardwareSerial.h instead of SoftwareSerial.h.

floresta

Quote

Quote
Are you sure that the compiler is doing the logical operations the way that you expect it to?

Why, is the arduino compiler known for such bugs? I didn't check the generated assembly (is there an easy way to do that with the Arduino tools?) if you mean that. I'm fairly certain the code is correct though.

They aren't bugs, they are more like quirks.  The people who coded the compiler meant one thing and the people using it interpret things differently.  Kind of like operating system menus or error messages.  Take a look through the avrfreaks forum sometimes and see how many of the professional programmers there are beating their brains out trying to get the compiler to do what they intended.

Quote

Quote
Don't bet on it.  Read the datasheet - including the notes.

That quote is from the datasheet actually. I don't see any other information about initialization. (But I'm not sure what I would be looking for.)

Find the quote in the datasheet (p.23) and then look at the note directly below it, in the middle of the page. 
Note:    If the electrical characteristics conditions listed under the table Power Supply Conditions Using
         Internal Reset Circuit are not met, the internal reset circuit will not operate normally and will fail to
         initialize   the   HD44780U.   For   such   a   case,   initial-ization   must   be   performed   by   the   MPU   as
         explained in the section, Initializing by Instruction.

Follow the LCD initialization link at http://web.alfredstate.edu/weimandn for a complete explanation.


Don

floresta


Don,
Hmm, this doesn't belong here really, but is that playground full of not well tested and possibly bad instructions? Anybody can send their creations there and look like it's made by someone who looks like he/she knows what they are saying? That's not good...

Cheers,
Kari


It's not bad either - you just have to be skeptical.  It would be nice if only experienced programmers who have thoroughly tested their projects posted them in the playground but I don't think that is always the case.  I believe that with a resource like this they are relying on the Arduino community as a whole to make any necessary corrections but most of the playground readers probably do not feel that they are experienced enough to correct something that has been posted there by someone else.

Don



GaryP

I think I didn't really get the structure of the playground, I realized that it has ton of links around, where code actually are, and there's a chance to comment them pros and cos.

So, just have to be patient and test the code that might be usable for your application, if problems exists, then the forum is here waiting.
:)

Cheers,
Kari
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

mowcius

Quote
Do you think I should use SoftwareSerial(2, 2)? Or some other unused input pin?

People normally use SoftwareSerial(255, 2) or some other large value that will never be used by an output pin.

A few suggestions
- change to the newsoftserial library rather than the software serial one.
- have you tried resetting the serial LCD (as far as I can remember - there is a command for this or is it just to reset to 9600 baud?)
- have you asked Sparkfun about it as they wrote the code on the pic chip which controls the display so they might have a better idea (I presume it is a Sparkfun one - did I miss this somewhere?)

no245

Quote
Follow the LCD initialization link at http://web.alfredstate.edu/weimandn for a complete explanation.

Interesting, thanks.

I tried to implement that initialization as follows:
Code: [Select]

  delay(110);   // Step 1: > 100ms
 
  lcd_do(0x30); // Step 2: Function Set
  delay(5);     // > 4.1ms
 
  lcd_do(0x30); // Step 3: Function Set
  delay(1);     // > 100us
 
  lcd_do(0x30); // Step 4: Function Set
  delay(1);     // > 100us
 
  lcd_do(0x38); // Step 5: Function Set D=1 N=1 F=0
  delay(1);     // > 53us

  lcd_do(0x08); // Step 6: Display off
  delay(1);     // > 53us
 
  lcd_do(0x01); // Step 7: clear
  delay(5);     // > 3ms
 
  lcd_do(0x38); // Step 8: Entry Mode set: I/D=1, S=0
  delay(1);     // > 53us

  // step 9 = nothing 

  lcd_do(0x0C); // Step 10: Display on D=1, C=0, B=0
  delay(1);     // > 53us

Unfortunately this did not help. Any ideas?

Quote
People normally use SoftwareSerial(255, 2) or some other large value that will never be used by an output pin.

Ok, thanks. I changed this now, but unfortunately it did not change anything.

Quote
change to the newsoftserial library rather than the software serial one.

Ok, I tried this as well. No change either.

Quote
have you tried resetting the serial LCD (as far as I can remember - there is a command for this or is it just to reset to 9600 baud?)

There is a command to set the baud rate. I don't think there is a reset command.

Quote
I presume it is a Sparkfun one - did I miss this somewhere?

Yes it is. (see first page in this topic)

Go Up