Announcement

Collapse
No announcement yet.

Arduino and uLCD 43PCT serial communication

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

  • Arduino and uLCD 43PCT serial communication

    Hello there,

    I am using 4DGL from designer. I want to send negative data from COM0/COM1 to Arduino's serial port.

    On designer side, I am using
    //////////////////////////////////////////////
    var x := -10;
    com_SetBaud(COM0, 960);

    repeat
    serout(x);
    forever
    /////////////////////////////////////////////

    On Arduino side, I am just reading the serial data and displaying it on serial monitor.
    /////////////////////////////////////////////
    void setup(){
    Serial.begin(9600);
    Serial1.begin(9600);
    }
    void loop(){
    if(Serial1.available() > 0){
    int x = Serial1.read();
    Serial.println(x);
    }
    }
    /////////////////////////////////////////////

    But I am not getting the data as expected.

    Any help ??

  • #2
    Hi Vijay,

    How did you connect the serial ports of the Display to the arduino?

    In your setup, The 'TX' and 'RX' Header pins are the ones used by serout().

    You might also want to try other Comms settings like: (In Diablo16)

    com_SetBaud(COM1, 960);
    COM1_RX_pin(PA2);
    COM1_TX_pin(PA3);

    **If you are using PICASO, Comms settings might be more limited..

    and also this one: (For Testing)
    --------
    repeat
    serout1(-10);
    pause(1000);
    forever
    --------

    Also, what kind of arduino are you using? Is it Mega?

    Don't forget to make sure the connections are correct =)

    I have edited your code using Software Serial just in case you want to try it on an Arduino Uno.

    --------------
    #include <SoftwareSerial.h> // Software Serial Library

    SoftwareSerial mySerial(10, 11); // pin10-RX (connect to TX pin of Display) , pin11-TX connect to RX pin of Display)

    void setup(){
    Serial.begin(9600);
    mySerial.begin(9600); // replace appropriate w/ Baud Rate
    }

    void loop(){
    if(mySerial.available()){ // replaced Serial1
    int x = mySerial.read(); // replaced Serial1
    Serial.println( x );

    if (x == 246) Serial.println("received: -10");
    }
    }
    ---------------

    **Take note that sending and receiving negative numbers doesn't translate directly to a negative number..(in this case)
    -1 -> 255
    -9 -> 247
    -10 -> 246

    Regards,

    Comment

    Working...
    X