Announcement

Collapse
No announcement yet.

how to send numeric data to uLCD via serial port

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

  • how to send numeric data to uLCD via serial port


    My goal:

    I send data from Arduino to uLCD via serial port. Arduino is the host. The data are integers from 0 to 256. I make an array of number in uLCD side and input the data.

    I want to display the waveform pulse by calculating the data in the array. Moreover, I want to display some simple strings from Arduino. These strings are less than equal three words. For example, B+X, A+,C-.

    (However, I want to verify that the data was sent correctly, before displaying a waveform pulse. So, I want to display numerical enumeration. An examples: 15,100,0,10,26…).

    This is my goal. What should I do?



    Currently:

    I send data now using “Software.Serial.println(“B+X”)” from Arduino.

    I send a string “B+M” instead of a number. The uLCD side received this by serin( ),is output by converting the characters. I convert it into letter because it becomes the ASCII code. I ignore “-1”. So, B,+,X line up lengthwise and output.



    Func myStart



    val ch;

    setbaud(BAUD_9600);



    repeat

    ch := serin();

    if(ch!=-1)

    print([CHR]ch);

    putch(‘\n’);

    endif

    forever



    endfunc

  • #2
    Hello,

    The demo files in Workshop will show you the basics of using the serial ports.

    Workshop --> File menu --> Picaso Designer --> PICASO - SERIAL COMMS

    Perhaps you might wish to do buffered comms since you intend to use an array. The COMCHECK.4DG demo shows you how this is done.


    There is an alternative (and perhaps quicker) way by which you can implement your project. This is by configuring your display module as a serial slave. By doing this, all computations can be done on the Arduino side. The display module will simply act as a display slave. You can draw points, lines, shapes, etc onscreen, the coordinate/s of which can be derived from arrays or variables. To illustrate:


    In your Arduino sketch:

    //displaying strings
    Display.putstr("Hello World! \n") ; //make the module display "Hello world" onscreen //move origin Display.gfx_MoveTo(50 ,50) ; //draw a waveform for(x = 50; x <= 250; x++) //x axis, x is from 50 to 250 { Display.gfx_LineTo(x,random(50, 150)) ; // generate random data for y (or use an array of values) delay(50); // for every value of x }

    Attached now is a demo sketch which you may further improve for your application.

    1. You need to install the Arduino-Picaso Serial library to compile this sketch.

    2. You also need to configure the display module as a serial slave.

    3. More information and further instructions for 1 and 2 are in the demo sketch

    4. App notes coming soon. =>

    Hope this helps.


    Doff

    Comment

    Working...
    X