Announcement

Collapse
No announcement yet.

gen4-uLCD-50DCT not able to draw something to a Particle Photon

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

  • gen4-uLCD-50DCT not able to draw something to a Particle Photon

    Hello guys,

    I have a gen4-uLCD-50DCT which is currently working but I only get the attached output. I know that Diablo16 is the processor and my connections are the following
    5v(LCD) - 5v VCC
    Tx(LCD) - Rx(Particle
    Rx(LCD) - Tx(Particle
    GND(LCD) - GND(Particle)
    Res(LCD) - 1k ohm - D0(Particle)

    Particle have a very similar programming enviroment focused on Arduino IDE. Some examples has the library "SoftwareSerial.h" which I can't add because Particle is not an AVR arduino board. I would like to know if I am missing something to programming it and control it. Do you have tips and example codes for this situation?

    Seems that my USART connections are not getting to the data from the microcontroller to send it to the display. Do you have the options or arduino sketches to use it as a guide to program the display?

    Thank you for your time!

    Attached Files

  • #2
    Is it possible to use the default Tx and Rx pins to send data to the screen?

    Comment


    • #3
      Hello,

      Welcome to the forum!

      If you are using ViSi-Genie Environment, you can use this Particle Photon library.

      However, if you want to send commands using byte streams you can refer to the two datasheets provided below.

      For Serial Environment for Diablo16 processor you may refer to this link.

      For ViSi-Genie Environment you may refer to this link.


      I hope this helps.

      Best regards,
      Kevin
      Last edited by John Kevin; 9th November 2018, 03:21 PM.

      Comment


      • #4
        Hello John,

        Thanks for your reply. I used the hello world demo from the Arduino library for the 4D Diablo16 processor and after removing some code I was be able to print something from Particle, however, is printing in an odd way.

        In the setup() function is supposed to print in the display the message "Mounting... " for the SD tasks, but it does not print or setup anything from the setup() function, instead, is capable to print text strings in the loop() function.

        but I need to set a delay(5) to print it normally, if not, it will print it like the attached picture

        This is my current code on Particle Dev IDE
        #define SCREEN_RESET D0
        #define DisplaySerial Serial1 // Serial1 is the physical Rx & Tx pins for Particle Photon
        //-------DIABLO16 DISPLAYS-------

        #include "Diablo_Const4D.h"
        #include "Diablo_Serial_4DLib.h"

        //use DisplaySerial to communicate with the display.
        Diablo_Serial_4DLib Display(&DisplaySerial);

        //---------END-----------------

        //enable message logging
        //#define LOG_MESSAGES // <-- to disable message logging, comment out this line
        #ifdef LOG_MESSAGES
        #define HWLOGGING Serial
        #else
        #define HWLOGGING if (1) {} else Serial
        #endif

        void setup()
        {
        //For handling errors
        Display.Callback4D = mycallback ;
        //
        //5 second timeout on all commands
        Display.TimeLimit4D = 5000 ;

        #ifdef LOG_MESSAGES
        HWLOGGING.begin(115200);
        //HWLOGGING.println(F("\nDisplay Images using an Arduino Host Demo w/ Message Logging"));
        HWLOGGING.println("\nDisplay Images using an Arduino Host Demo w/ Message Logging");
        #endif

        pinMode(SCREEN_RESET, OUTPUT); // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
        digitalWrite(SCREEN_RESET, 0); // Reset the Display via D4
        delay(100);
        digitalWrite(SCREEN_RESET, 1); // unReset the Display via D4
        //-----------------------------------------END---------------------------------------------

        delay (5000); //let the display start up

        //start
        //DisplaySerial.begin(9600) ;
        DisplaySerial.begin(200000) ;
        Display.gfx_ScreenMode(PORTRAIT);
        Display.gfx_Cls(); //clear the screen
        //uSD card mount routine
        Display.putstr("Mounting...\n"); //print a string

        //Display.gfx_BGcolour(WHITE) ; //change background color to white
        //Display.putstr("\n");
        //Display.putstr("HELLO WORLD\n");
        }

        void loop()
        {
        //Display.putstr("HELLO WORLD\r");
        Display.gfx_ChangeColour(GREEN, RED);
        Display.putstr("Testing LCD\r");
        Display.gfx_BGcolour(WHITE) ; //change background color to white
        delay(5);
        HWLOGGING.print(F("Serial 4D Library reports an error: ")) ;
        }


        //Error-handling routine
        //this will execute when a communication error occurs
        void mycallback(int ErrCode, unsigned char Errorbyte)
        {
        #ifdef LOG_MESSAGES
        const char *Error4DText[] = {
        "OK\0", "Timeout\0", "NAK\0", "Length\0", "Invalid\0" }
        ;
        HWLOGGING.print(F("Serial 4D Library reports an error: ")) ;
        HWLOGGING.print(Error4DText[ErrCode]) ;
        HWLOGGING.print(F("\n"));

        if (ErrCode == Err4D_NAK)
        {
        HWLOGGING.print(F("returned data = ")) ;
        HWLOGGING.print(Errorbyte) ;
        HWLOGGING.print(F("\n"));
        }
        else
        HWLOGGING.println(F("")) ;

        HWLOGGING.println(F("Program cannot proceed further. Please reset the display.")) ;
        while(1) ; // you can return here, or you can loop

        //#else
        // // Pin 13 has an LED connected on most Arduino boards. Just give it a name
        // int led = 13;
        // pinMode(led, OUTPUT);
        // while(1)
        // {
        // digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
        // delay(200); // wait for 200 ms
        // digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
        // delay(200); // wait for 200 ms
        // }
        #endif
        }
        Attached Files

        Comment


        • #5
          Hello,

          In the setup() function is supposed to print in the display the message "Mounting... "
          for the SD tasks, but it does not print or setup anything from the setup() function,
          instead, is capable to print text strings in the loop() function.
          On the program that you have attached, there is no uSD-card routine to check for
          an existing SD card.

          Replace this line of code
          Code:
          //uSD card mount routine
          Display.putstr("Mounting...\n"); //print a string
          With
          Code:
          //uSD card mount routine
            Display.putstr("Mounting...\n");  //print a string
            if(!(disk = Display.file_Mount()))
            {
              while(!(disk = Display.file_Mount()))
              {
                Display.putstr("Drive not mounted...");
                delay(200);
                Display.gfx_Cls();
                delay(200);
              }
            }
          I hope this helps.
          Best Regards,
          Kevin

          Comment

          Working...
          X