Pages: [1]   Go Down
Author Topic: l2c display issue  (Read 1089 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello, i have connected l2c interface with display to my arduino exactly like here:
http://forum.arduino.cc/index.php/topic,128635.0.html
I didn't get any response, just the backlight turned on and i can see rectangles(image)

If i turn a potentiometer on the interface  black rectangles  change their contrast till they dismiss totally. What could be  wrong ?
« Last Edit: March 14, 2014, 01:01:47 pm by fredybotas » Logged

NSW Australia
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3671
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well now, "exactly like here" referring to an extensive thread isn't very descriptive, but suggests you are using an I2C "backpack" of some random sort.

So, you now run bperrybap's "guesser" sketch, what does the serial monitor output tell you?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So i have tried the guesser. Here are tryes  from serial monitor
Code:
<Press <ENTER> or click [Send] to Continue>
Scanning i2c bus for devices..
i2c device found at address 0x20
Device found: PCF8574
<Press <ENTER> or click [Send] to start guessing>
Trying: lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE)
<Press <ENTER> or click [Send] to Continue>
Trying: lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, NEGATIVE)
<Press <ENTER> or click [Send] to Continue>
Trying: lcd(0x20, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE)
<Press <ENTER> or click [Send] to Continue>
Trying: lcd(0x20, 6, 5, 4, 0, 1, 2, 3, 7, NEGATIVE)
<Press <ENTER> or click [Send] to Continue>
Trying: lcd(0x20, 6, 5, 4, 0, 1, 2, 3, 7, POSITIVE)
<Press <ENTER> or click [Send] to Continue>
Trying: lcd(0x20, 4, 5, 6, 0, 1, 2, 3, 7, POSITIVE)
<Press <ENTER> or click [Send] to Continue>
Only one working guess is here

But if i put that LCD setting to code from thread mentioned above, LCD is showing just some "hieroglyphs", no text .
I am using this LCD and l2c interface
http://www.ebay.com/itm/111222815999?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
http://www.ebay.com/itm/251176520555?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
« Last Edit: March 14, 2014, 07:05:11 pm by fredybotas » Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4411
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But if i put that LCD setting to code from thread mentioned above, LCD is showing just some "hieroglyphs", no text .
The display may look like hieroglyphs to you but the information may still have meaning to others that might help in the diagnosis of your problem.


Don
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2745
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But if i put that LCD setting to code from thread mentioned above, LCD is showing just some "hieroglyphs", no text .
So you are saying you used the constructor that the guesser sketch told you to use?
Code:
LiquidCrystal lcd(0x20, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE);

Sounds like the wrong information was put into the constructor so the library is not properly
controlling the LCD lines which can cause all kinds of strange things to happen.

Also, the only code I saw in the thread mentioned above was not use the
full constructor, and was not properly using the API.
setBacklightPin() is obsolete and should no longer be used.
setBacklight(dimvalue) was being misused as it takes a dimvalue and not a HIGH/LOW argument.
While it happens to work on this hardware, it would give a very dim backlight on other hardware
if the hardware supports dimming as using a value of HIGH is 1 which is asking the hardware to
turn on the backlight at 1/255 of its brightness which is very dim.
For simple on/off control use:
backlight() and noBacklight()

--- bill


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much. I didnt use setBacklightPin() command and LCD is now working. But setBacklight(dimvalue) isnt working properly on this hardware i thought. Value LOW turns off the backlight  and value HIGH turns it on at highest brightness. Nothing happend by changing values 1-255, backlight is still at full brightness and potentiometer is changing just contrast of letters. The question is how can I modify backlight brightness ?  Is it even possible on that hardware ?
« Last Edit: March 15, 2014, 02:56:24 am by fredybotas » Logged

NSW Australia
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3671
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This was discussed in another thread (not surprisingly).  It is not a hardware matter.  The hardware switches it ON or OFF by sending commands to the port expander chip (PCF8574) via the I2C bus.

You could arguably implement PWM in software by sending a continuous stream of ON and OFF commands across the I2C bus but this would represent quite heavy activity on the bus and quite a bit of processing load.  I have commented frequently that in many cases, the processor is mostly biding its time and has nothing better to do than to poll pushbuttons, so you certainly could do just that - control the backlight brightness using software PWM.  Where it comes "unstuck" however, is where you really do want the processor to do some "heavy lifting" in which case the time division would either result in vigorous flicker of the backlight (flashing variously to full brightness or off) or you would have to choose one state or the other whilst the more important activity was in progress.

So - that would be your choice.

Note that by adding a resistor - in the order of 1k - in series where the jumper is or bridging pin 16 to ground (for a "POSITIVE" board, 15 to Vcc for a "NEGATIVE") will correspondingly either dim the backlight when switched on, or give it a fixed "dimmed" level, so you can have dimming, but only two actual states.

Any function in the current (or ever) libraries for "setBacklight(dimvalue)" refers only to direct connection of the display to Arduino ports such that the LED is switched by a PWM-capable port.
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2745
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But setBacklight(dimvalue) isnt working properly on this hardware i thought. Value LOW turns off the backlight  and value HIGH turns it on at highest brightness. Nothing happend by changing values 1-255, backlight is still at full brightness and potentiometer is changing just contrast of letters. The question is how can I modify backlight brightness ?  Is it even possible on that hardware ?
It is working properly on that hardware.
As I said in the previous post:
Quote
setBacklight(dimvalue) was being misused as it takes a dimvalue and not a HIGH/LOW argument.
While it happens to work on this hardware, it would give a very dim backlight on other hardware
HIGH/LOW are invalid parameters for setbacklight(dimvalue);
And while using HIGH happens to turn on the backlight for this h/w because the h/w doesn't
support dimming, it would be very dim on other hardware that does support dimming.

More details below....


This was discussed in another thread (not surprisingly).  It is not a hardware matter.  The hardware switches it ON or OFF by sending commands to the port expander chip (PCF8574) via the I2C bus.
I'm assuming there is a typo above?
It is a hardware matter.
The hardware on the backpack is incapable of being told to do anything but turn on/off
a PCF8574 pin that turns on/off a transistor that turns on/off the backlight.
The hardware on the backpack does not have the capability to do PWM on the pin
to dim the backlight.

Quote
Any function in the current (or ever) libraries for "setBacklight(dimvalue)" refers only to direct connection of the display to Arduino ports such that the LED is switched by a PWM-capable port.

Not exactly.
Remember it isn't just direct Arduino pins that can do dimming,
some backpacks like the ByVac ones can also do dimming.
In fm's library we made the decision to try to do the best we could for setBacklight(dimvalue);
given the available hardware as some hardware can do dimming and some can't.

What confuses things so greatly is that there are still many improper examples
out there that mis use the API functions.


There are several ways setBacklight(dimvalue) could
be handled/supported on non dimming h/w:
1) remove the function if it isn't fully functional - create an error in the sketch
2) leave it in but make it only set backlight on or off to get the attention of the user to change his code
3) "The arduino way", which does 0-127 is off, 128-255 is on
4) any non zero value is on

We opted for #4 as it would offer the most s/w compatibility across all the various hardware.
In other words the goal of the library is ensure that sketch code you write for one set of
LCD hardware will for the most part "just work" if moved to another another LCD hardware without
having to go in and change anything but the constructor. No changes to the
actual sketch code should be needed to change communication interfaces as that should
be handled by the constructor. i..e if you change from 4bit to i2c, just change the constructor.
So the thought was that if dimming isn't supported by the h/w then it should still work to turn
off the display with a value of 0, but then any other value will dim the best it can
and if the h/w can't dim, the best it can dim is obviously full on.
This ensures that code that trying to do dimming simply loses the dimming capability.
In other words, we assume that a request for a dimmer backlight is still wanting the backlight
to be on and does not want the backlight to be off if dimming can't be supported.

This is very different from the "Arduino way" in analogWrite(dimvalue); which sets
the LED off for dim values 0-127 then on for 128-255.
This method turns off the display for half the dim values.
Their thinking was to "round" the value so below half way is off, above half way is on.
It was our opinion that this is wrong and that is why we use 0 for off and any non zero value for on.
This same behavior is used on all the interfaces in fm's library not just i2c.
Remember that fm's library is for multiple interfaces not just i2c using a PCF8574 and it is trying
to provide a common API across all of them.
So for example, if you used the direct Arduino pin mode in 4bit mode, and if you picked
an Arduino pin that doesn't support pwm you end up with the same behavior as
you see the i2c PCF8574 backpacks,  (0 off, any non zero is full on)
but if you picked a pwm Arduino pin, then full dimming would work.

And THAT is why I keep harping on users not to use setBacklight(HIGH); to turn on
the backlight, because if the hardware is changed to h/w that supports dimming,
then all your code using setBacklight(HIGH) would create a very dim
backlight and on reverse displays (dark with white pixels), it will usually appear
to be off.

For those that insist on using setBacklight(dimvalue) to turn the backlight on/off
rather than dimming the API must be used correctly to ensure it works properly
across all h/w interfaces:
Code:
setBacklight(BACKLIGHT_ON); // turn on backlight at full brightness
setBacklight(BACKLIGHT_OFF); // turn off backlight

--- bill
« Last Edit: March 15, 2014, 01:07:55 pm by bperrybap » Logged

Pages: [1]   Go Up
Jump to: