Announcement

Collapse
No announcement yet.

Sending commands in linux to the uLCD32-pt?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sending commands in linux to the uLCD32-pt?

    I have the 4d programming cable hooked up into the uLCD32-pt its powered on and I can see it is located in /dev/ttyUSB0 how ever I'm having difficulties talking to it through minicom but for my purpose I need to know how to do it through the linux terminal or in C/C#/C++ code so I can write some SGC scripts for it. Some direction would be helpfull thanks!

  • #2


    I was able to successfully send commands to my uLCD32-pt from a different app call CuteCom worked just fine no problems and it took no setup at all.

    Still does anyone know how to send commands through a scripting language like Java or C?

    Comment


    • #3


      Hi Fenland,
      You can search for serial programming c++ linux
      and find articles similar to the one below:http://www.cplusplus.com/forum/beginner/6914/
      Regards,Anna.
      Attached files SyncSerialComm.zip (3.5 KB)

      Comment


      • #4


        Excellent! Thanks for the quick reply! Before I read the post I was able to finally get python to send commands to my uLCD32-pt with the following code....

        HTML Code:
        import serial
        import time
        ser = serial.Serial(
        port='COM5', 
        baudrate=9600, 
        timeout=1,
        parity=serial.PARITY_NONE,
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS
        )
        ser.write("U")
        
        while(True):
        #1-16 x white pixels
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x0001)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#1
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x0002)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#2
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x0003)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#3
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x0004)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#4
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x0005)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#5
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x0006)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#6
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x0007)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#7
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x0008)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#8
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x0009)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#9
        ser.write(chr(0x0050)+chr(0x0000)+chr(0x000A)+chr(0x0000)+chr(0x000A)+chr(0x00FF)+chr(0x00FF))#10
        It just draws a white line -- not very long either, I hope to have a python library made and then a C# library made too once I'm finished with the python library

        Comment


        • #5


          Whats the max refresh rate on these things? I was able to change the baudrate to 115200 but it seems that using the following code it takes for ever to make 1 frame of white pixels... whats the deal?
          import serialimport time
          #Connect to uLCD32-pt with autobaudser = serial.Serial( port='/dev/ttyUSB0', baudrate=9600, timeout=1, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)#AutoBaud -- HandShakeser.write(chr(0x0055))
          #Change Recieve BaudRate in deviceser.write(chr(0x0051)+chr(0x000D))time.sleep(0.2)
          #Change Send Baudrate on computerser.baudrate=115200
          #Clear Screenser.write("E")
          time.sleep(0.2)
          #Set orientation#ser.write(chr(0x0059)+chr(0x0004)+chr(0x0001))
          def draw_pixel(x, y, color): return
          #Draw white screenincrement = 0x0000increment2 = 0x0000while(True): if(increment >= 0x00FF): increment = 0x0000 increment2 += 0x0001
          ser.write(chr(0x0050)+chr(0x0000)+chr(increment)+chr(0x0000)+chr(increment2)+chr(0x00FF)+chr(0x00FF) )#1 increment += 0x0001

          Comment


          • #6


            You need to use some of the more complex commands.



            At 115200 baud drawing a full screen of pixels will take just under 47 seconds, and that's assuming that python can get through to the serial port at 'full speed' and that there is no latency in the USB-Serial converter and that the display is 'instantaneous'.



            Note: You need to check for ACKs in your code, if you don't eventually your code will cease working as you will be overflowing the buffer in the display.
            Mark

            Comment


            • #7


              Eventually I would like to stream movies from python to the lcd display I think draw pixel will be the only thing that will work, I don't see how using the triangle, circle, other shapes commands will help if i wanted to render a movie from the serial cable, where those the advanced commands your were talking about?

              Comment


              • #8


                Even if i stepped it up to 256k it probably wouldn't be fast enough to render movies does that sound accurate?

                Comment


                • #9


                  OH!? I think your referring to : Draw Image-Icon - 49hex
                  command?

                  Comment


                  • #10


                    Well, I had no idea what you were trying to do, but since I now know, yes, that is a better command for that sort of thing.



                    But, still, even at 256kb, you are still looking at at least 6 seconds per frame
                    Mark

                    Comment


                    • #11


                      So the uLCD models are basically concluded to be more like a controller for sensors for then a consumer display considering it can't play animations past 6 frames a second?(With the exception of animations saved on the uSD card)

                      Comment


                      • #12


                        If you want to put it that way.



                        BTW 6 seconds per frame, not 6 frames per second.



                        25 FPS is about 3.8 megabytes/second for a 320x240 display, You probably coundn't even get Python to process data at that rate.



                        PCs use specialised hardware to achieve that, quite a lot of it that costs $$$, whilst you can get some (physically large) chips that pack that hardware in one chip, they also need lots more 'Power' and can't do much else except play videos.
                        Mark

                        Comment


                        • #13


                          Helpfull as always ESPSupport!

                          Does the ulcd32 support a faster connection that would achieve frame rates of atleast 20 per second? Maybe i2c?

                          Comment


                          • #14


                            Other than putting the video on uSD (which will give you about 12fps) there is no way to get anywhere near that rate.
                            Mark

                            Comment

                            Working...
                            X