|
|
|
|
#1 |
|
Registered
Join Date: 2005/12
Posts: 11
|
Hello !
I'm still trying to make my 635 work with perl. I'm able to get keypad press from my scripts, and it works OK. The hex I get back is fine. So basically, I'm able to receive packets from 635. The problem I have is to push packets to 635. First point: I'd like to be sure my test packets are valid: ping packet: 0x00 0x01 0xff 0xD0 0x6C contrast to 10: 0x0D 0x01 0x0A 0x8F 0x31 contrast to 95: 0x0D 0x01 0x5F 0x8A 0x19 Should those packets be understood by 635 ? Second point: I also suspect my port settings to be wrong. I grabbed the settings from the port when it was opened by your demo program. Would someone have a short sample script that outputs something on a 635, in perl under linux (or even windows) ? I had no problems making the 634 (both serial and early USB) work. The 635 is hard to get to work. My perl is also quite far away... Thanks. Vincent |
|
|
|
|
|
#2 |
|
Administrator
Join Date: 2001/11
Location: Adelaide, South Australia
Posts: 2,509
|
Your ping packet is correct.
Your contrast packets are also correct, but remember the value for contrast is not a percentage like the brightness value. The contrast value is 0 to 255. Im not sure about the port settings, i have only done very basic perl programming before.
__________________
Crystalfontz CrystalControl2 Author |
|
|
|
|
|
#3 | |
|
Registered
Join Date: 2005/12
Posts: 11
|
Quote:
Thanks for your response. |
|
|
|
|
|
|
#4 |
|
Registered
Join Date: 2005/12
Posts: 11
|
Some fresh update.
The best sites I have found on internet are: http://members.aol.com/Bbirthisel/alpha.html http://members.aol.com/Bbirthisel/tp...t.d/index.html and http://aplawrence.com/Unix/logger.html (probably based on previous links). Using all this, I was able once more to get packets for KP, but still unable to send anything. What is very strange is that just after sending a packet, I don't get anything back as if nothing was sent. The only packets I get back are the KP events. This is weird. The port settings I use are OK, otherwise I wouldn't receive anything back. Do you know how to "snoop" the serial port ? This is the only option I see now to make sure something goes to the 635. Thanks. Vincent |
|
|
|
|
|
#5 |
|
Administrator
Join Date: 2001/03
Location: Spokane, Washington
Posts: 4,015
|
We have a utility that can be used to snoop for packets. It runs under Windows. You would need to make a four-headed cable, two are pass-through of the connection under inspection, two additional connections go to the two serial ports of the snooping machine (one listens to Tx, one listens to Rx of the connection under inspection.
Please write support(at]crystalfontz[dot}com (edit to '@' & '.') and we can give you the program. You can make the cable, or we can supply a cable (though it is a bit spendy ).
|
|
|
|
|
|
#6 |
|
Registered
Join Date: 2005/12
Posts: 11
|
Hello again !
I GOT IT ! It finally works.... 2 things were wrong/missing: 1) The CRC calculation: the byte order is swapped is my previous post. Sending those packets was of no use. How did I come to this result ? I used a marvellous software to snoop the serial port: http://www.serial-port-monitor.com/index.html Then I used 635_WinTest_1_0.exe and sent a ping packet with one byte of data with 0xFF, as in my first post. And then, I got a big surprise: The first exchange is the WinTest one. The CRC for the ping packet is 6C D0. Mine was D0 6C, as show in the second example. And this doesn't trigger a response packet from the 635. I was expecting a message saying the packet was corrupted. I'll read the specs better next time. So I swapped the byte order in my code, and then it worked as show in the third exchange. 2) At the beginning, I couldn't get the packet back with my app. This was just due to a "sleep 1" missing, so the 635 had enough time to answer. He is fast, but not as my PC ![]() So I have now some working perl code, working both in windows and linux. Yes, I'm more of a linux guy but as I couldn't find an app to snoop the port under linux, I decided to switch to windows. So why not having a portable perl code ? The following calls: print "Sending ping packet: ".str2hex(genpkt(0x00,pack 'C',0xff))."\n"; $result=sendpkt($ob,genpkt(0x00,pack 'C',0xff)); #ping packet print "Result:".str2hex($result)."\n"; print "Sending version packet: ".str2hex(genpkt(0x01,''))."\n"; $result=sendpkt($ob,genpkt(0x01,'')); #get version packet print "Result in hex:".str2hex($result)."\n"; print "Result in str:".($result)."\n"; Produced: G:\lcdlib\TestsStandalone>serial6.pl baud from configuration: 115200 Sending ping packet: 00 01 ff 6c d0 Result:40 01 ff 1a d6 Sending version packet: 01 00 9f 16 Result in hex:41 10 43 46 41 36 33 35 3a 68 31 2e 30 2c 76 31 2e 34 63 a2 Result in str:A?CFA635:h1.0,v1.4có For now, I'll clean a bit the code and I'll post it here. I couldn't wait to send this post, as I provide an answer, for once. Thanks for supporting my annoying posts, but it helps me to write ![]() See ya ! |
|
|
|
|
|
#7 |
|
Administrator
Join Date: 2001/03
Location: Spokane, Washington
Posts: 4,015
|
Hey, I am glad you got it working. I am sure your post will be useful to other users who wish to use PERL to communicate with the LCD.
|
|
|
|
|
|
#8 |
|
Registered
Join Date: 2005/12
Posts: 11
|
So, here we are.
I have attached the perl code. It currently allows you to send commands by giving the type and the arguments, it reads data back from 635, you can configure retries and delay, it unserializes the data (not very efficiently, but it works), and it can decode the keypad as well. And it works both on linux and windows (one limitation though, on windows: as there is no usleep, it waits 1 second for incoming packets). If someone can test this, or optimize it, I'll be glad to get feedbacks. Now I'll work on the complete library function. It is a shame I didn't think to get the SCAB, so I'll blind code this. Maybe someone can test it later. Vincent. |
|
|
|
|
|
#9 |
|
Registered
Join Date: 2006/04
Posts: 2
|
Hi
Thanks a lot for your Code. I've changed and extended the Code to have a more flexible Skeleton for other Programs. I've also added some new Functions: - Playing around with the four LED's at the left side - Set Coursor Style - Set Key Report Mask - Set Backlight - Set Contrast Daniel |
|
|
|
|
|
#10 |
|
Registered
Join Date: 2006/04
Posts: 2
|
And here is the Code ;-)
|
|
|
|
|
|
#11 |
|
Registered
Join Date: 2007/09
Posts: 1
|
POE Event Driven Interface
I've further updated this script to use the POE module in perl.
Currently, it displays the current date/time, current load, and the cpu usage of the perl program. It also "heartbeats" the 4th LED to let you know that it's alive. :-) So far it works. Should be fairly easy now to attach multiple screens and such :-) Just remeber to point it at the proper serial port that the LCD is attached to. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|