serial in data needs nib


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153

    Default serial in data needs nib

    I have serial data that needs to be read, example 9 and D if I use a byte value it locks up so I never get to the D. I must echo each character to get the next so I cannot get both which is what I need 9D is what I need to come out with. I prototyped with a stamp it would catch the first character but was not fast enough for the second some of the times. I used a var byte and seriin for highnib and lownib of that byte. I tried 4 bit var it did not get it correct

    any ideas

  2. #2
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default Re: serial in data needs nib

    I seem to have the byte variable working
    a var word
    a.highbyte and a.lowbyte but when I serout a I get lowbyte only if i serout a.highbyte and a.lowbyte it shows both values.

    I have tried || ^^ && they seem to do nothing on the value I need both byte combined if I get 9 and then D I need 9D

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: serial in data needs nib

    Are you using any modifiers?
    1) A string constant is output as a literal string of characters.
    2) A numeric value (either a variable or a constant) will send the corresponding ASCII character. Most notably, 13 is carriage return and 10 is line feed.
    3) A numeric value preceded by BIN will send the ASCII representation of its binary value. For example, if B0 = 8, then BIN B0 (or BIN 8) will send "1000".
    4) A numeric value preceded by DEC will send the ASCII representation of its decimal value. For example, if B0 = 123, then DEC B0 (or DEC 123) will send "123".
    5) A numeric value preceded by HEX will send the ASCII representation of its hexadecimal value. For example, if B0 = 254, then HEX B0 (or HEX 254) will send "FE".
    6) REP followed by a character and count will repeat the character, count time. For example, REP A0"\4 will send "0000".
    7) STR followed by a byte array variable and optional count will send a string of characters. The string length is determined by the count or when a 0 character is encountered in the string.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: serial in data needs nib

    I am not sure what you are asking. Do you mean when you receive first byte and it's 9, then the second byte is D, you want to put these together as 1 byte 9D?
    To do that try this:
    Code:
    byte1 var byte
    Byte2 var byte
    Result var byte
    Byte 1=byte 1<<4 ' shift low nibble to high nibble
    Result =byte1 + byte2
    Now if this is not the question, can you please explain more?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

Members who have read this thread : 1

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