SERIN frustration


Results 1 to 9 of 9

Threaded View

  1. #6
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198

    Default Re: SERIN frustration

    I think Richard is correct. This from the manual:

    SERIN begins storing data in the variables associated with each Item. If the variable name is used alone, the value of the received ASCII character is stored in the variable.

    Meaning, in my mind, that you are actually receiving "3" "8" "4" "6" rather than 3846. If the LCD character codes are different than the ASCII character codes...

    The manual goes on to say:

    If variable is preceded by a pound sign ( # ), SERIN converts a decimal value in ASCII and stores the result in that variable.

    This seems to indicate you will receive 3, 8, 4, 6 if you modify your statement. You can receive your data as byte array, and then use multiplication to expand the value into a word variable.

    Editing to include this, a snippet from a recent project of mine that accepts a serial command in the format: CC*HR:MN to reset the time via serial input.

    IF (CO[0] ="T") AND (CO[1]="I") THEN
    REG_VAL[2] = (CO[3]-48) * 10 + (CO[4]-48)
    REG_VAL[1] = (CO[6]-48) * 10 + (CO[7]-48)
    GOSUB CLK_WRITE

    CO[3] and CO[4] are the hour value of the time - I had to subtract 48 from the serial input to convert from the string value to the numeric value and multiply. I suspect you will need to do something similar.
    Last edited by Amoque; - 20th November 2014 at 01:46.

Similar Threads

  1. New user frustration (16F688 + LCD)
    By wcpesp in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 3rd February 2013, 16:52
  2. forum posting frustration
    By Heckler in forum Forum Requests
    Replies: 8
    Last Post: - 16th March 2012, 11:31
  3. how to use SERIN???
    By texas5 in forum Serial
    Replies: 4
    Last Post: - 23rd September 2008, 00:03
  4. Serin
    By Eyal in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th February 2007, 13:10
  5. serin
    By Sphere in forum Serial
    Replies: 2
    Last Post: - 28th August 2005, 18:43

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts