LCD Project for Linux (USB 635) - Need To confirm results?

crees

New member
Hi all

This is a show and tell but also a question on the results of the setup.

Based of of jdhawks code myself and another contrubitor have built a linux/php/mysql dynamic menu system. The action menus are not yet in place (display results, do actions etc) but will be working soon. however here is the code I have so far and would like to see what results anyone gets. Main thing I run into is that I am unable to consistently display more then 16 characters on the 4 lines(it works on and off). If I keep the lines under 16 charcters then it works great. Not sure if its my code or the dispay has an issue.

Example of problem:
This is line 1 test

This will work on and off on any of the display lines (1-4) When it doesnt work it simply will not display the line and will leave it blank.

But this will work fine consistently:
This is Line 1



Itroduction to the project and instruction on setup.

Basically this is a PHP CLI driven setup. Must be ran under root(still in develpment). The requirements are simple (PHP and Mysql and a 635 LCD)

Place these files anywhere in a directory. (I placed the files temporaily in the \var\www\html\ in a folder called ALCD.

In the include.inc I have the max_length set to 15 so that the menu will work consistently. If you set it to 20 thats when I start having random display issues(some lines work some dont and then they all work).

attached are the files needed and the mysql database.

make sure you take off or delete the .txt to make the files valid and place them in your directory. You will need import the sql file into your mysql database(using command line or phpmyadmin) and edit the database.inc file to reflect the username password to your mysql database

Execute the program by changing to the directory of the files and then issue:

php lcd.php


You will notice the screen will load the intro then sleep after 5 second. after a keypress it will light backup and then allow you to interact with the menu. If you let it stay idle for a few seconds it will sleep again (to help save the lcd backlight)

Thanks in advance and let me know if any one gets the same results of intermitten displaying by changing the MAX_LENGTH variable to 20. (Fist try it with the default variable 15, then switch it to 20 to see if its any different for you)

Thanks

crees
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

Attachments

Last edited:

deltaxfx

New member
I havent tested your code, but just wondering about your MAX_LENGTH variable
you have it set to 20, is that 20 as in 1-20, or 20 as in 0-20?
I have had a few problems with code that I have made where if I goofed and tried to put too many characters on the display, i.e. 0-20 = 21 characters, that it would not display anything.
 

crees

New member
Hi

The Maxlength varaible is to specify to either trim or pad the line before it is sent to the function that will convert it to binary and then generate the CRC etc. so if you have too much text it will trim it to 20 characters, or if its only a couple of characters it will pad it to the full 20.

I have figured the problem and its to do the display taking on too much information at one time for the 4 lines. I ended up puting a usleep fuction (millisecond sleep) of 5000 or usleep(5000) into the code between each send packet commands (that sends packets to each 4 lines) Here is part of the code detailing the under the function set_screen

//usleep helps to do a fraction of a second pause to prevent sending too much data at once to LCD
$this->send_packet($line1_pkt);
usleep(5000);
$this->send_packet($line2_pkt);
usleep(5000);
$this->send_packet($line3_pkt);
usleep(5000);
$this->send_packet($line4_pkt);

Now that each line has a millesecond sleep or pause, the LCD will have time to proccess it.

crees
 

deltaxfx

New member
That is interesting, I have never had a problem with sending too much information to the LCD at once. Do you check for replies from the LCD before you send the next packet? Or do you just keep sending them. I think I saw in another one of your posts that you are working with trixbox? I made a perl program for the LCD for the same thing :p Using trixbox, I eventually will post what I have so far but need to make a few more tweaks. So far it displays IP, uptime, load, and has a menu system to change the backlight, contrast, and screensaver (backlight off) and a config file to store the settings to use when the computer is restarted, you can also cleanly shut the system down (shutdown -h now) from the lcd. Its running on a headless system from logicsupply.com (its actually the VIA system they offer that has a CF635 built in)
But, when I send anything to the LCD I always check for a return packet, which gives a little delay before the next packet is sent to the display. Its also good for data integrity :p I just manage it with separate transmit, receive, processing and 'cron' threads.
Just a suggestion, but you might be better off checking for a return packet (any NON keypad event, and if you are not using the SCAB) and using that as the delay between sending lines of text, in case usleep(5000) isnt always long enough. Because if its not you may run into that problem at random times and it will be a lot harder to pinpoint as your program gets more complex.
 

sjconrad

New member
Hey there crees, have you done any more work on this?? It is something that would be very good for a project that I am working on currently. Contact me at gmail. (sjconrad).

Kind regards
 
Top