Announcement

Collapse
No announcement yet.

Streaming COM data

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

  • Natalie Angel
    replied
    Thank you Dave.

    In fact the right way to do it was like this;

    dData = Val("&H" & HEX$(ASC(MID$(sComData, iPos, 1)),2))

    Leave a comment:


  • Dave Biggs
    replied
    Seems like there's a problem in the code that you are using to translate the received characters into hex. Are you using something like this?
    Code:
    #Dim All 
    #INCLUDE "WIN32API.INC"
     
    Function PbMain()
     Dim RxBuffer$, HexByte$, HexRx$, i&
     
     '(Comm Recv #hComm, RxQty, RxBuffer)
      RxBuffer = "Hello" + $LF + "Chum" + $CR         ' e.g.
     
      For i = 1 To Len(RxBuffer)
        HexByte = Hex$(Asc(Mid$(RxBuffer, i, 1)), 2)  ' Hex$(n,digits) 
        HexRx = HexRx + HexByte + ":"     
      Next
     
      MsgBox RxBuffer + $CR + HexRx,,"Received 'Hex' Bytes"
     
    End Function
    '------------------/PBMain

    Leave a comment:


  • Natalie Angel
    replied
    Hi Fred,

    Thank you... But the strange thing is that 0-9 is OK and what happening is that I receive the data in ASCII characters which I convert to HEX to add this into a Double (by adding 4-bytes together).

    Leave a comment:


  • Fred Harris
    replied
    Sounds like if the value of the number is less than or equal to F hex you need to account for that in your code that its only providing a single digit instead of two?

    Leave a comment:


  • Natalie Angel
    started a topic Streaming COM data

    Streaming COM data

    When I'm streaming GPS data I seams to heve problem with some control characters like

    Character 10 (Chr(10): [Line Feed Return]
    Character 11 (Chr(11): [Shift+Enter]
    Character 12 (Chr(12): [Page Break]
    Character 13 (Chr(13): [Carriage Return]
    Character 14 (Chr(14): [Column Break]
    Character 15 (Chr(15): [Shift In]

    I'm converting the CHR$ to HEX$ and when I look at the log file I can see that all other data is converted right beside the above characters...

    So when it's right it should be like i.e. 25:00:9E:05:0A:0F:FF but instad I get 25:00:9E:05:A:F:FF

    Any ideas to the problem? I use PBWin and make a DLL

    Thanks
Working...
X