Pages: [1]   Go Down
Author Topic: Can I do this? LCD+Arduino = fast moving display?  (Read 1133 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 102
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I wanted to read a sensor and display it's value as a bar graph on a LCD.

Something like this, but it doesn't need to be quite as fast.  But should be able to do a full sweep in, say 1/2 a second.

[media]http://www.youtube.com/watch?v=CGrBxH7qL94&feature=related[/media]

I've seen some work with arduinos and LCD's and most of them look quite slow. (nothing like the video above)

So, questions:

1.) Is there anything to gain by using a hd44870 compatible controller?  Or should I be looking at something else?

2.) Will I be able to have the speed/fps/refresh rate that you see above?  Is that a function of the uC?  Or the LCD?

Thanks!  I'm ready to buy, I just wasn't sure what I should be looking at getting.
Logged

Austria
Offline Offline
Sr. Member
****
Karma: 3
Posts: 260
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

you can get this speed when running 8Bit and Assembler  smiley

its possible to speed up the LCD libarys with removing all delays, but that will not work stable on all displays...

i would also like to know how to get "high speed LCD" for the arduino  8-)
Logged


Bristol, UK
Offline Offline
Edison Member
*
Karma: 0
Posts: 1197
Exhibitor at UK Maker Faire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't forget that the HD44780 is a character-based LCD driver, not a graphics (pixel-based) LCD driver.  The ultimate speed of the display update also depecds on the optical response time of the LCD itself, which is quite slow in the case of the text-based displays I've seen.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 102
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I assume the graph is made by using custom characters on a basic character LCD.  I think I'll try out the new I2C LCD's and see if that can do what I am wanting.
Logged

Austria
Offline Offline
Sr. Member
****
Karma: 3
Posts: 260
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

its possible!!!  smiley-grin

you can modify the LCD4Bit with some assembler, and never use the "cursorTo" Function.

heres the change:

Code:
void LCD4Bit::pulseEnablePin(){
  digitalWrite(Enable,LOW);
  asm("nop\n");
  // send a pulse to enable
  digitalWrite(Enable,HIGH);
  asm("nop\n");
  digitalWrite(Enable,LOW);
  asm("nop\n");
}

delete the LCD4Bit.o after modifying LCD4Bit.cpp.

and for positioning the cursor use:

Code:
 
      lcd.commandWrite(0x80);                   //Line=1, Cursor 0
      lcd.commandWrite(0xC0+val);            //Line=2, Cursor val
      lcd.commandWrite(0x94+7);               //Line=3, Cursor 7
      lcd.commandWrite(0xD4);                   //Line=4, Cursor 0


give it a try, the difference is impressive for so little changes  8-)

designer2k2
« Last Edit: April 18, 2009, 09:54:24 am by designer2k2 » Logged


London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You may not need those assembler nops. The arduino digitalWrite commands take longer without any additional delay then the Enable pulse width (450ns ) and Enable cycle time (1000us) specified in the HD44780 datasheet.

BTW, If you want the fastest performance then you should check the LCD busy flag to see when its ready instead of using delays before writing data.


« Last Edit: April 18, 2009, 04:47:17 pm by mem » Logged

Austria
Offline Offline
Sr. Member
****
Karma: 3
Posts: 260
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

it does not work without a line of code between the digitalWrite´s, looks like then there is no change at all on the line.

reading back from the LCD costs a Pin more, and also time, when running pure in assembler and having enough I/O left ok, but for the arduino i think that speed is ok...

check my thread in the exhibition http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1240088162
ive postet a vid there to show the speed. think thats enough speed  smiley-wink
Logged


London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
it does not work without a line of code between the digitalWrite´s, looks like then there is no change at all on the line.
Are you sure? This is what a digitalWrite(HIGH) followed by a digitalWrite(LOW) looks like on my Arduino without any assembler nops. The pulse width is 4.5 microseconds (this is much longer than needed but as you say, is fast enough for most applications)
The shorter pulse that follows was created using direct port IO and this would need nops to increase the pulse width (from 126 nanoseconds to around 1 microsecond)


The horizontal scale used above is 1 microsecond per division
« Last Edit: April 19, 2009, 03:21:46 am by mem » Logged

Austria
Offline Offline
Sr. Member
****
Karma: 3
Posts: 260
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

oh, thats cool!

i have not measured the output, but the display does not behave normal when having nothing between the HIGH and LOW write...

with more assembler the speed could be higher! but im satisfied with this, its faster than my eye, what do i need more  smiley

thats a project for the winter, making a LCD4Bit with pure assembler for the highest speed  8-)
Logged


London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the display does not behave normal when having nothing between the HIGH and LOW write...
I remain surprised that a 65 nanosecond nop makes a difference to a function (digitalWrite) that takes over 2000 nanoseconds to execute, but if that what you observed then I wont argue.

Quote
thats a project for the winter, making a LCD4Bit with pure assembler for the highest speed  
IMO, the Arduino LiquidCrystal library has many advantages over lcd4Bit, that would be a more fruitful base to work from if you want to tweak.  

But if you are out for speed, Peter Fluery's LCD library is highly optimised and can be made to work well with Arduino with a little effort. http://homepage.hispeed.ch/peterfleury/avr-lcd44780.html
« Last Edit: April 20, 2009, 06:44:32 am by mem » Logged

Austria
Offline Offline
Sr. Member
****
Karma: 3
Posts: 260
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

some years ago i wrote my own avr-assembler LCD routines, back in the days i was fighting with all what arduino makes so easy  smiley-grin

i will see if its needed to tweak, but at the moment im fine with the size and speed from the LCD4Bit  smiley

Logged


Pages: [1]   Go Up
Jump to: