Announcement

Collapse
No announcement yet.

Serial comunication from Arduino to display uLCD-70-DT

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

  • tntsei
    replied
    The project it's very big......next tuesday i post my project

    Leave a comment:


  • Doff
    replied
    Hi Tntsei,

    Is it possible for you to post your complete project files? I hope they're not that complicated though.

    Regards.

    Leave a comment:


  • tntsei
    replied
    Messages are available on the Arduino Serial monitor......i'll explain

    Arduino IDE

    #include <SoftwareSerial.h>

    SoftwareSerial Display(2,3);

    vois setup()
    {
    Display.begin(9600);

    Display.println(F("hi !!!")); // message 1
    Display.println(F("it's ok")); // message2

    Display.println(F('Z')); //ACK signal

    }
    void loop()
    {
    }


    Workshop IDE

    func read _string()

    var char;

    com_SetBaud(COM0, 960);

    repeat

    while((char := serin()) < 0 );

    if(char != 'Z')

    putch(char);// i print every char but not 'Z' that it's the ACK

    endif

    until(char == 'Z'); \\ i read the ACK (Z char) and the func end

    endfunc



    in this way there are able to read the strings inside the display correctly

    But if i have

    Void setup()
    {
    .....
    ....
    }


    void loop()
    {
    .......
    .......
    password_evaluation();
    }

    void password_evaluation()
    {
    ......if(password0) // first account
    Display.print("Y"); // means that the password it's ok and for this reason i send to the display the ACK

    Display.print("i'm Doff"); // this is one string that i need to send to the display, because i have more than one account with password
    // actually the display don't read this string i don't know why...
    Display.print(F("Z"));
    ......

    else if (password1) // second account
    Display.print("Y"); // means that the password it's ok and for this reason i send to the display the ACK(like preaviously)

    Display.print("i'm tntsei"); // this is one string that i need to send to the display, because i have more than one account with password
    // actually the display don't read this string i don't know why...(like previously)
    Display.print("Z"); //ACK

    else
    password0.reset(); // password it's wrong and for this reason i don't send ACK
    password1.reset();
    }



    and i use the same function (read_string()) inside the Workshop IDE the display it's not able to read the string and i don't know why....

    Leave a comment:


  • Doff
    replied
    Hi Tntsei,

    Display.print("i'm tntsei"); // this is one string that i need to send to the display, because i have more than one account with password
    // actually the display don't read this string i don't know why...(like previously)
    It seems that you are using your own library? I also see that you are coding in ViSi. Can you check the data coming out of the Arduino? Perhaps you can redirect the output to Serial0 so you can see the messages on the Serial Monitor.

    Regards.

    Leave a comment:


  • tntsei
    replied
    The problem it's this:

    i have the Arduino host that evaluate a password sendign by the display with another custom keyboard...the keyboard it's always numeric.

    The display send the numeric password to arduino which responds with an ACK if the password it's correct, othervise don't responds.

    What happens in the display it's that charge two kind of form: One form if the password it's correct, and a second form if the password it's wrong.

    for this reasone i need to send one ACK to the display ...if the display read the ACK means that the password it's correct and charge the form for password correct, if don't read the ACK , the password it's wrong:

    Arduino IDE:

    ......
    ...
    void setup()
    {
    ...
    ...
    }

    void loop()
    {
    .......
    .......
    password_evaluation();
    }

    void password_evaluation()
    {
    ......if(password0) // first account
    Display.print("Y"); // means that the password it's ok and for this reason i send to the display the ACK

    Display.print("i'm Doff"); // this is one string that i need to send to the display, because i have more than one account with password
    // actually the display don't read this string i don't know why...
    ......

    else if (password1) // second account
    Display.print("Y"); // means that the password it's ok and for this reason i send to the display the ACK(like preaviously)

    Display.print("i'm tntsei"); // this is one string that i need to send to the display, because i have more than one account with password
    // actually the display don't read this string i don't know why...(like previously)

    else
    password0.reset(); // password it's wrong and for this reason i don't send ACK
    password1.reset();
    }


    Workshop IDE

    func main()
    ...
    ...
    ..

    if( form == savekey2) // savekey2 it's a button inside a form that change the form like follow

    repeat

    while( serin() < 0 ); // if the ack don't arrive i stay here

    if(serin() == 'Y')
    form := Password_ok; // i read the ACK and the password it's ok, for this reason i charge the form password ok
    else
    form := Password_wrong; // i don't read the ACK and the password it's wrong, for this reason i charge the form password wrong
    endif
    until(serin() == 'Y');

    endif


    Actually the problem it's that the ACK doesn't work correctly and inside the Password_ok form i don't able to read the string " i'm tntsei" and "i'm Doff"

    Leave a comment:


  • Doff
    replied
    Hi Tntsei,

    Sorry for the late reply. How are you getting on with your project? Were you able to implement your own way of sending and receiving an ACK?

    Regards.

    Leave a comment:


  • tntsei
    replied
    Hi Doff.....

    Yes i have exactly impelmented yout item!!!

    Leave a comment:


  • Doff
    replied
    Hi Tntsei,

    Did you want the character 'Z' as the ACK byte? Such that the display waits for it to arrive then it does something? If yes, shouldn't the 4DGL code be something like,

    Code:
        repeat
            while((char := serin()) < 0);   // wait for a valid character
            if (char != 'Z')                // if the received character is not 'Z'
                putch(char);                // print it on the screen
            endif
        until(char == 'Z');                 // end loop if the received character is 'Z'
    Regards.

    Leave a comment:


  • tntsei
    replied
    Sorry Doff i' write the wrong word........the program it's ABLE and not UNABLE.....sorry ....

    For the ACK message, the problem it's that serin() it's function that don't read strings but always char.....for this reason if i want realize an ACK with serin i need to send only a char to the display.......

    For examples ...

    Arduino IDE

    Display.print(F("Z")); // i send Z to the display to realize ACK

    Worshop IDE

    repeat

    while((char := serin()) > 0 )

    if(char != 'Z')

    putch(char); // in this manner char Z isn't print to display
    endif

    untile(char == 'Z') //when ACK signal arrive i finish the function


    Leave a comment:


  • Doff
    replied
    Hi Tntsei,

    The program it's unable to show the string on the display...
    Did you happen to use third-party fonts? If yes, you will have to uncomment the relevant lines in the program skeleton. This app note will help you:

    4D-AN-P3001 ViSi Displaying Third Party Fonts

    App notes are here: http://www.4dsystems.com.au/appnotes


    IF i want send an ACK message to the display how can i do with Arduino?
    I think it would be:

    Serialx.print(0x06);

    Where "x" is the serial port (omit if using Serial0), and "0x06" is the hex value of ACK in the ViSi-Genie comms protocol, if that is what you are referring to?

    Regards.


    Leave a comment:


  • tntsei
    replied
    Perfect Doff...the program it's unable to show the string on the display...

    Now i have another question....

    IF i want send an ACK message to the display how can i do with Arduino?

    Leave a comment:


  • tntsei
    replied
    Thanks Doff!!!!!

    i'll let you know!!

    Leave a comment:


  • Doff
    replied
    Hi Tntsei,

    Attached is a zip file containing the ff:

    Arduino sketch - just for sending a string to Serial0

    ViSi project file 1 - illustrates how to receive a string (non-buffered comms style)

    ViSi project file 2 - illustrates how to receive a string (buffered comms style)

    They are based on the sample programs in Workshop. Hopefully you can use them as a reference and successfully integrate them to your project/s.

    I used a uLCD-35DT for testing, so just change the target screen to a uLCD-70DT.

    Regards.
    Attached Files

    Leave a comment:


  • tntsei
    replied
    Because I need to program the display in VISI....i need to send every char that i push to Arduino in Real Time.

    Can you give me some examples in code 4DGL to show strings inside a string object in VISI?
    it's possible that it's so difficult write string on the display?

    For examples if i use serin() i can read always char and not strings!

    Leave a comment:


  • Doff
    replied
    Hi Tntsei,

    The string object in ViSi will not "do anything" if you send it a string. You will have to write the 4DGL code for it to print the string received from the host. Hence the need to look at the sample programs in Workshop for basic serial comms. Why not use ViSi-Genie by the way?

    Regards.

    Leave a comment:

Working...
X