Announcement

Collapse
No announcement yet.

Display not responding! gen4-uLCD-50DCT-CLB

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

  • Display not responding! gen4-uLCD-50DCT-CLB

    Display: gen4-uLCD-50DCT-CLB
    Mode: Serial
    Master: Arduino Due
    BaudRate: 200000
    PC BaudRate: 115200

    Hello,

    I have a project using arduino reading an encoder and showing the pulses on gen4-uLCD-50DCT-CLB.

    Im using attachInterrupt for manager the encoder signals, it works very well, but when the encoder interrupt frequency go high the display stop respond.

    Arduino keep working very well, because i check the "counter" by PC Serial simultaneously and all data keep correct and ploiting.


    I think is something about how interrupt affects Serial communication or TimeOut. But the PC Serial keep well and this intrigue me.

    Anyone have a way to me? sry for no code information, is a big monster, but i can show some parts what you thinks relevant.

  • #2
    usually without code its hard to diagnose/help the user.
    if you could provide the zipped project and sketch that we can load directly on the unit it would be alot easier to help you out on finding the issue faster, the interrupt should not affect serial communications unless your staying too long within it, which i doubt you are since its an encoder



    Tony
    Last edited by tonton81; 11th August 2017, 01:47 AM.

    Comment


    • #3
      Originally posted by tonton81 View Post
      usually without code its hard to diagnose/help the user.
      if you could provide the zipped project and sketch that we can load directly on the unit it would be alot easier to help you out on finding the issue faster, the interrupt should not affect serial communications unless your staying too long within it, which i doubt you are since its an encoder


      Tony
      Ty for reply.

      I understand how dificult and Irritating when someone ask for help without the code, but, unfortunaly in this situation is impossible , the code is part of other project and is impossible to copy. Because i would had to write by hand all of it. =(


      but, this is where the problem appears. if the pulses frequency go very high(VERY FAST), the comunications stop, but the arduino keep working.

      setup()
      {
      attachInterrupt(encoder, ENCODER_A);
      attachInterrupt(encoder, ENCODER_B);

      ...
      }
      void touchGet()
      {
      int state;
      state = Display.touch_Get(TOUCH_STATUS);
      if(state == TOUCH_RELEASE)
      {
      button_id = Display.img_Touched(hndl, ALL);
      }
      ...
      switch(button_id)
      {
      case A:
      {
      break;
      }
      ...
      }

      }
      void encoder()
      {
      bool StateA = digitalRead(ENCODER_A);
      ​​​​​​​ bool StateB = digitalRead(ENCODER_B);
      ...

      }
      loop()
      {
      touchGet();
      }

      Comment


      • #4
        Hello

        Is there any code in your void encoder() that writes to the serial port ?

        Best regards

        Paul

        Comment


        • #5
          Originally posted by pauleilio View Post
          Hello

          Is there any code in your void encoder() that writes to the serial port ?

          Best regards

          Paul
          No. Is a encoder pulses counter.

          void encoder()
          {
          bool StateA = digitalRead(ENCODER_A);
          bool StateB = digitalRead(ENCODER_B);
          if (StateA != LastStateA)
          {
          if (StateA == LastStateB)
          {
          ​​​​​​​counter--;
          }
          else
          {
          counter++;
          }
          LastStateB = StateB;
          LastStateA = StateA;
          }
          else
          {
          if (StateB == LastStateA)
          {
          ​​​​​​​counter++;
          }
          else
          {
          counter--;
          }
          LastStateB = StateB;
          LastStateA = StateA;
          }

          }

          Comment


          • #6
            Hi,

            It is very possible that your interrupt routine is affecting Serial. Serial doesn't disble interrupts in use so you could be writing via Serial and then the interrupt routine fires again. You could possibly try using noInterrupts(); before writing to Serial to see if it changes anything https://www.arduino.cc/en/Reference/NoInterrupts

            I hope this helps

            Best regards

            Paul

            Comment


            • #7
              Originally posted by pauleilio View Post
              Hi,

              It is very possible that your interrupt routine is affecting Serial. Serial doesn't disble interrupts in use so you could be writing via Serial and then the interrupt routine fires again. You could possibly try using noInterrupts(); before writing to Serial to see if it changes anything https://www.arduino.cc/en/Reference/NoInterrupts

              I hope this helps

              Best regards

              Paul
              It works, but this solution dont solve my problem, because i cant stop read encoder signal, i will lose pulses. I need to make the LCD understand this problem and restart the communication. Like PC Serial Does.

              Comment


              • #8
                Hello,

                The display will be expecting a certain amount of serial bytes and if disrupted will cause problems.You could try adjusting your baud rate to see if it changes anything, Try lowering the baud to see what effect that has. Are you just monitoring PC serial ?

                Best regards

                Paul

                Comment

                Working...
                X