Announcement

Collapse
No announcement yet.

Screen doesn't display string or return ACK/NAK

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

  • Screen doesn't display string or return ACK/NAK

    I'm just trying to send a simple string to my display: uLCD-32ptu. I'm using an Arduino Due with the according .h file.
    I've double checked all connection and made sure I used the commands from .h file. The display is already programmed and
    has been tested by displaying per-programmed figures, like an rectangle.

    The Arduino does indeed send out the commands and they're transmitted to the Display. I've already checked this with
    a logic analyzer. The display doesn't return anything or displays the sent string.

    Does anyone know why this happens?

    My code:
    Code:
    #include "./TinyGPS/TinyGPS.h"
    #include "./genieArduino/genieArduino.h"
    #include "./DueTimer/DueTimer.h"
    
    TinyGPS gps;
    /****Declaration variables****/
    char ID;
    char Name[20];
    char Team;
    
    bool newdataGPS = false;
    float old_flat, old_flon;
    float new_flat, new_flon;
    
    char aRX[25];
    
    /***Declaration objects***/
    Genie genie;
    
    void setup()
    {
      Serial.begin(115200);                    // Communication Due-PC
      Serial1.begin(9600);                     // Communication Due-Display
      Serial3.begin(9600);                     // Communication GPS-Due
    
      Serial.println("Reading GPS");           // Test to PC
    
      genie.Begin(Serial1);
    
      pinMode(2, OUTPUT);             //Pin 2 connected with display reset
      digitalWrite(2, 1);
      delay(100);                     
      digitalWrite(2, 0);
    
      delay(3500);
      genie.WriteContrast(15);
      char myString[] = "Reading GPS";
      genie.WriteStr(0, myString);
    
      Timer3.attachInterrupt(_timer3).setPeriod(5000).start();
    }
    
    void loop()
    {
    
    }
    
    void _timer3(void)
    {
      if (feedgps())
      {
        newdataGPS = true;
      }
      if (newdataGPS)
      {
        TX_Pos(ID, gps);
      }
    }
    
    // Feed data as it becomes available
    bool feedgps()
    {
      while (Serial3.available())
      {
        if (gps.encode(Serial3.read()))
          return true;
      }
      return false;
    }
    
    void TX_Pos(char &ID_speler, TinyGPS &gps)
    {
      unsigned long age;
      gps.f_get_position(&new_flat, &new_flon, &age);      // Huidige positie verkrijgen
      if (new_flat != old_flat && new_flon != old_flon)    // Vergelijk posities
      {
        old_flat = new_flat;        //Posities bijwerken
        old_flon = new_flon;
    
        Serial.write(0x55); Serial.write(0x02);
        Serial.write(ID_speler); Serial.write(new_flat);
        Serial.write(new_flon); Serial.write(0xAA);
    
        char positie[] = {new_flat,', ', new_flon, '\0'};
        genie.WriteStr(0, positie);
      }
    }

  • #2
    Hello NGfour

    Welcome to the forum.

    So how have you wired the 32PTU to your Due exactly?
    I see you have it connected over Serial1, and that you have Reset connected to D2. You are obviously not using an Arduino Adaptor Shield - right?
    If this is the case, then your reset logic is backwards, assuming you have directly connected the Due to the 32PTU's reset, as without the Arduino Adpator Shield the reset logic is active Low, not Active High.
    How have you connected TX and RX between the two?

    Regards
    James

    Comment


    • #3
      Hello James,

      Thanks for responding this quick.

      Indeed, I'm not using the adaptor shield.
      So, in order to make it work, I have to send a constant High signal over D2 - right?
      I've connected the one's Tx with the other's Rx and vice versa. This should be the correct way, I assume.

      Kind regards
      -Nathan

      Comment


      • #4
        Hi Nathan

        TX to RX, and RX to TX is correct, yes.
        In order to reset the module at the start of your program, you send a logic 0, wait 100ms, send a logic 1, and then delay 3500ms (or higher in some cases, depending on program size in the display and the card being used). So yes, you would hold that pin high. However its pulled high on the display, so you could release it as being an output if you really wanted, and set the pin to be an input later, and it would also likely be fine. But holding it high will not cause any problems, yes.

        Hopefully that helps

        This should be fine
        Code:
        pinMode(2, OUTPUT); //Pin 2 connected with display reset
        digitalWrite(2, 0); // Reset the Display
        delay(100);         // Delay to make a 100ms pulse (can be shorter)            
        digitalWrite(2, 1); // Unreset the Display
        delay(3500); // Wait for the display to start up before allowing Arduino to send data
        Regards
        James

        Comment


        • #5
          Hi James,

          I really hope this does it. Thank you very much for helping.
          I'll let you know if it works or not.

          Edit:
          I've tested it and it works.
          I just couldn't think the problem would be such a simple and small thing.
          This was a huge help, 'cause it is for my graduate project.

          Kind regards
          -Nathan
          Last edited by NGfour; 9th March 2016, 02:29 AM.

          Comment

          Working...
          X