No announcement yet.

Gen4-uLCD-50DCT-CLB not updating after period of inactivitiy

  • Filter
  • Time
  • Show
Clear All
new posts

  • Gen4-uLCD-50DCT-CLB not updating after period of inactivitiy

    I've looked through a couple of similar sounding posts but the symptoms don't quite seem to fit. I've got a Gen4-uLCD-50DCT-CLB screen communication with an Arduino Due using my own set of routines. The screen requests data from the Arduino, the Arduino replies with a packet of data. If the screen doesn't see the correct length of packet within 2 seconds it resets the serial buffer and tries again. I have 3 screens which can be navigated between by pressing buttons, all 3 screens call the same function which gets the serial data. I have no screen saver feature at the moment. After a period of the order of tens of minutes the numbers on the screen will stop updating. If you press a button to change screens the action will be followed and the screen will return to normal functionality. There is sometimes a brief slow down in the screen populating the new screen. It's like the screen has entered a "sleep" mode but I can see no reason for it do such. The obvious fault is with my function for reading in the serial, but I can see no reason why changing the screen would reset this. Any suggestions?

  • #2

    Welcome to the forum!
    If the screen doesn't see the correct length of packet within 2 seconds it resets the serial buffer and tries again.
    Can I ask how are you resetting the serial buffer on the display?
    Usually, after implementing a buffer service for serial communications and if the coms is full, you must re-initialize the buffer.
    if(com_Full())  com_Init(combuf, 60, 0);  // initialize the buffer if full
    Can you attach a snippet of code, where you handle the serial comms on your display? You do not need to add the whole project,
    just the three forms present and the serial communication service. Also, you may want to attach the Arduino sketch you use so I can try and simulate this on my end.

    Best Regards,


    • #3
      Hi Kevin
      Arduino code:
      void Update_Display(){
      byte index;
      bool data_sent = false;
      while(Serial1.available() > 0){
      index =;
      if (index == 254){
      //data requested
      if (data_sent == false){
      data_sent = true;

      void Send2Display(){
      int packet_size = 167; //in bytes
      byte packet[packet_size];
      //create packet
      ifloat value;

      value.f = Concentration;
      packet[0] = value.b[0];
      packet[1] = value.b[1];
      packet[2] = value.b[2];
      packet[3] = value.b[3];

      Serial1.write(packet, packet_size);
      Other values of index indicate data is being sent back from the display. The packet is constructed of many more variables, omitted for brevity.

      Display code:
      func GetSerial()
      //if no data in serial buffer and timmer1 has expired ask for new data
      if (com_Count() == 0 && sys_GetTimer(TIMER1)== 0)
      com_Init(buffer0, Buf_size*2, 0); //reset buffer
      sys_SetTimer(TIMER0, 2000);
      sys_SetTimer(TIMER1, 1000);
      else if (com_Count() == 167 ) //has all the data been sent?
      NewDataFlag := 1;
      Concentration[0]:= serin() | (serin() << 8);
      Concentration[1]:= serin() | (serin() << 8);

      com_Init(buffer0, Buf_size*2, 0);
      else if(sys_GetTimer(TIMER0)== 0) //if timer has expired, reset buffer



      • #4

        I cannot seem to see any obvious reason for the issue to occur.
        Can you try to attach your sample project? If you do not want to post it here, you can email it to me at john dot asuncion at 4dsystems dot com dot au.

        Best Regards,


        • #5
          I've investigated further, the problem is not with the serial communication this continues to work after the display has stopped updating. For example a press on a toggle switch on the touchscreen will send a command over serial but the actual display will not update to show the new position of the toggle switch. If I press a button to display a new screen the display then comes back to life or occasionally displays a white screen requiring a reset, what is going on?


          • John Kevin
            John Kevin commented
            Editing a comment

            To further check the issue, you may e-mail your project to me.

            Best Regards,