Go Down

Topic: Enhanced LiquidCrystal (Read 16446 times) previous topic - next topic

TBAr

#30
Feb 13, 2010, 03:24 am Last Edit: Feb 13, 2010, 03:25 am by TBAr Reason: 1
Quote
I've learned a lot and had a lot of fun doing it.

... and provided a very useful contribution to the community on your first try. [smiley=dankk2.gif]

mowcius

Quote
... and provided a very useful contribution to the community on your first try.

Agreed  [smiley=thumbsup.gif]

Mowcius

mowcius

Hey is the server down again. I have downloaded your new code but appear to have lost it and I don't seem to be able to download it again...

Mowcius

jrraines

Thanks to Ben and Don for all their help. I think the server is OK now.

mowcius

It did download again, eventually (took like 5 minutes) but thanks again for the code.

Mowcius

jrraines

I've known about the bug with 40x4 displays and autoscroll now for 3 weeks and it finally occurs to me that there is surely an UGLY rather stupid work around for it. I haven't tested it actually but I'm sure it would work. it would involve calling autoscroll twice in succession. I suppose it might be necessary to reposition the cursor between the 2 calls. Even if for some reason the hd44780 controlling the 2 lines that scrolled after the first command received the second one, it would just keep scrolling. It could even be built into the library as a special case only with 40x4 displays and I could pretend I'd fixed the bug. But it would be ugly and stupid. :-/

mowcius

Well ugly and stupid would be better than not working...

Mowcius

jrraines

I posted the idea so people could use the work around. And perhaps to inspire someone with a different perspective to see a real fix.

Scrolling gets blown out of proportion when I work on the library, because its the complicated bunch of things the display can do and so is involved in many of the tests in my test program (which is included with the download). In real code, I have no use for it. I knew about the bug for at least 2 weeks before I posted anything about it; I was pretty sure no one would find it in a short period of time; I wouldn't have found it except that I started putting together a thorough test procedure when I started working on the library, adding tests as I added features and found problems to demonstrate. Then before I post code I run 4 interfaces on 4 different shapes of LCDs, 2 interfaces on the 40x4.
That takes almost an hour but it leaves me pretty confident I've found everything I ever knew could be a problem.

brtech

Great work.

I've been wondering about the RW pin.  

I have a project in development that needs a very fast bar graph.  I was going to use the programmable characters to make the last segment variable length to get a one dot wide bar resolution.

There are two, possibly academic questions:
  • Is "faster than the eye can see" really true for something like a bar graph?

  • Is there any way to, and do you get any advantage out of, trying to sync the value update (which is related to analog sampling in my case) to the refresh cycling of the LCD?


I was thinking of an experiment that involves getting the bar graph working, and then using something like an adjustable sine wave synthed signal to drive it.  Walk the frequency up until you can't really get the bar graph to follow the signal.  Try that with and without the RW.

I'm in the middle of building a shield for this project and can't try this experiment right now, but I'm planning to.  Do you have an old version of the code around I could try?

mowcius

#39
Feb 19, 2010, 08:51 pm Last Edit: Feb 19, 2010, 08:53 pm by mowcius Reason: 1
Well I would like to do a bar graph on my 40x4 but it seems very slow at refreshing. When I write one character over another it is visibly taking a long time. Any ways of speeding it up?

I did see something on fast refresh on LCDs some time ago but I can't for the life of me find it. Anyone else know where it is?
[edit]I can't have been looking very hard before, here it is:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264215873/0[/edit]

Mowcius

jrraines

"writing 80 characters to the screen then 80 blanks and looping through that 20 times. The results are:
4 data pins 727 milliseconds
8 data pins 644 milliseconds"
so (80+80)*20 = 3200 characters in less than 3/4 of a second. your bar graph is one line long so either 20 or 40 characters. Lets say you have 40 chars. 727 *40/3200 =  9 milliseconds. Probably the rest of your code will be the limiting factor.

in the benchmark I print 80 character long strings. If you use a for loop and call once per character, of course it will go slower because of all the loop and call overhead. If you need maximum speed you might create an array of strings of different lengths for the different bar lengths.

mowcius

Yeah it was the other code. After having a play around it is much faster now :)

Mowcius

jrraines

other thoughts about bar graphs that may be obvious:

if you're using an array of strings they should follow the pattern "x    ", "xx   ","xxx  ",.. so that trailing spaces overwrite what was left over from last time. If you use the for loop and single character print you want to do the same thing--print spaces over the old bar.  Using clear takes 2 milliseconds and then you have to reconstruct the whole screen.

A program that does bar graphs is likely to want to divide somewhere and if you can work it out so that >> will do, that is a LOT faster. so putting a short label on the line and having 16 or 32 segments in the bar may have a big payoff in speed.

mowcius

Yes, I will be sticking a bargraph in my media player project. It has an rMP3 and a 40x4 LCD showing lyrics, time, track etc. I will have a bargraph for the volume and for the track length (probably) but they don't need to be very fast...

Mowcius

brtech

I'm probably overthinking this.  I had thought that the display had something like a 200Hz refresh cycle, but that appears to be the refresh of one row, not the whole display.  The datasheet I'm looking at shows a 64hz frame rate.  at 64 Hz, I only need to get the bar graph into the LCD in 15 ms more or less, which clearly works without the RW.  I don't really want to use the RW, because I want to use the pin for something else :)

Go Up