Announcement

Collapse
No announcement yet.

Arduino Serial WriteObj Slow

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

  • Arduino Serial WriteObj Slow

    I am using the Cool Gauge and 4 bar gages on my uLCD -32PTU display. I have a loop that runs and there is no delay. I write to the display at 9600 baud and update all 5 gauges in the loop as a simulation. I notice that it take 1 second to update each gauge so about 5 seconds for all. This is very slow and I need to know if there is a fast way to update the gauges.
    Here is my loop code:

    Code:
    void loop()
    {
    genie.DoEvents(); // This calls the library each loop to process the queued responses from the display
    
    // Write to CoolGauge0 with the value in the gaugeVal variable
    genie.WriteObject(GENIE_OBJ_COOL_GAUGE, 0, gaugeVal);
    genie.WriteObject(GENIE_OBJ_GAUGE, 0, gaugeVal);
    genie.WriteObject(GENIE_OBJ_GAUGE, 1, gaugeVal);
    genie.WriteObject(GENIE_OBJ_GAUGE, 2, gaugeVal);
    genie.WriteObject(GENIE_OBJ_GAUGE, 3, gaugeVal);
    
    // Simulation code, just to increment and decrement gauge value each loop, for animation
    gaugeVal +=5;
    if (gaugeVal > 100) gaugeVal = 0;
    }
    Thanks...

  • #2
    Hi,

    I have a uLCD-32PTU display and me too... my display is very very slow with my arduino...
    In fact, in the main loop, I have juste one instruction to make test:

    digitalWrite(7, HIGH);
    genie.WriteObject(GENIE_OBJ_LED_DIGITS, 0, portance_moyenne);
    digitalWrite(7, LOW);

    My digital PIN 7 is used to visualize with a scope, the time taken by the WRITE instruction... And surprise: about 1s!!

    This time is about the same wether if I connect the display or not!
    This time is about the same wether the serial COM is in 9600 or 20000 bauds.

    Any Idea to fix this isue?

    Thanks

    Comment


    • #3
      Hello,

      When using the WriteObj() function, the host must receive an ACK from the display that signifies successful data transmission. The DoEvents() function fetches the ACK from the display and waits for another transaction of data.

      The best way to improve the response of your display when you are sending the commands is to keep the DoEvents() function running in the loop and only send the Write object command to display at a certain interval or whenever you need it.

      You can check Visi-Genie Arduino Library sample programs for your reference.

      I hope this helps.

      Best regards.

      Comment


      • #4
        Hello...
        Thanks for your response... but the DoEvent() function il realy not the problem!! (I can remove it and now it works)
        I've search during many hours!! I was about to becoming crazy with my display!!
        I've realised many many tests!!! And finaly I've found the solution!
        I have 2 reasons why my display was very very slow!

        First, I had no delay just after the reset; this delay is MANDATORY!

        digitalWrite(RESETLINE, 1); // unReset the Display via D4
        delay (3500); (or more)

        And 2sd problem: in the "genieArduino_demo" program in the setup, there is a line:
        genie.WriteStr(0, GENIE_VERSION);
        I've removed it, because I have no need in my own program (if we want to execute a write command in an absent object, the program crashes)

        And we must be careful, not to wright a value with 3 numbers, on a led digits with only...2 digits.

        Hope it could help.

        Fabrice

        Comment


        • #5
          This sticky post might have helped you (You actually posted in the wrong group, which is why you likely didnt see it)

          https://forum.4dsystems.com.au/node/40596

          Good to hear you figured it out though.
          James

          Comment

          Working...
          X