No announcement yet.

Strings/list help please

  • Filter
  • Time
  • Show
Clear All
new posts

  • Strings/list help please

    Hi all,

    I've been lurking here for a few weeks now, doing alot of reading and learning as I go along, I've just hit my first problem that I haven't been able to resolve so far.

    I've got a uOLED-160-G1, which I'm using to display data sent via RS232.

    The data is sent in blocks of 7 characters, the first six are displayed on the OLED screen, the 7th character will be used to select the correct units for the data.

    i.e. data sent = 1000.01

    where the 1000.0 will be displayed on the OLED screen and the last digit 1 will pick volts from a list and display it on the screen.

    I can receive the data and display the six digits fine, I'm struggling to pick out the 7th character and usee it to display the units required, i'm assuming I should use strings for this (you can tell I'm not a programmer can't you , last time I did any programming was about 18 years ago in pascal).

    This is my program so far.

    I've had a number of attempts to get past this point, had a good look at the demo programs and had a go at adapting them, but I have to admit I'm stumped, so any pointers are greatfully received.

    Thanks for any help.


    Attached files remote_display.txt (1.3 KB)

  • #2

    The following command line is taken from your code snippet.
    com_Init(combuf,6,0); // initialize comms buffer

    Following is the syntax of the above command line, followed by the usage example.

    com_Init(*buffer, bufsize, qualifier);
    com_Init(mybuf, 20, 0); // receive 20 characters in var array mybuf[] as a circular buffer with no qualifier.
    com_Init(rxbuf, 16, ':'); // receive 16 characters into rxbuf[] only after the ':' character has been received.

    Note: You need to set your buffer size bigger (bufsize) than 6 characters when you are trying to receive 7 characters.


    • #3

      Thanks, I'll try and incorporate the qualifier into my code this weekend. I'll be back with either more questions or tales of success

      I had been using a bigger buffer size, just forgot to change it back before I posted the code up.