Announcement

Collapse
No announcement yet.

Parsing a serial byte?

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

  • Terry Glenn Capps
    replied
    Parsing serial data

    The device that I am communicating with is a DLP-USB245M-G which allows 8-bit hardware data to be read by a computer via a USB cable. FTDI's VCP (Virtual COM Port) drivers allow the PC to see the data as though it was connected to a COM (RS-232) port. I have a microcontroller project with data that I want to place in a log file on the PC. I also want to display information encoded in the data on the screen.

    John Gleason provided me with the statement that I had overlooked, CVBYT, which will convert the string data to a numeric form.

    Thanks to all who replied!

    Terry

    Leave a comment:


  • Cliff Nichols
    replied
    Serial Port

    I am not sure how PBCC handles Serial Ports (maybe I should check into it more)

    That aside, what is the piece of hardware that you are communicating with? (Communication parameters change depending on the device)

    Leave a comment:


  • John Gleason
    replied
    Terry, you can use:
    Code:
    #COMPILE EXE
    #DIM ALL
    
    FUNCTION PBMAIN () AS LONG
        LOCAL sb AS STRING, bb AS BYTE
        sb = CHR$(23)
        bb = 23
        ? BIN$(CVBYT(sb), 8)
        ? BIN$(bb, 8)
        WAITKEY$
    
    END FUNCTION
    Last edited by John Gleason; 26 May 2009, 12:13 PM. Reason: added WAITKEY$

    Leave a comment:


  • Marco Pontello
    replied
    You can test a bit with a logical AND, or check the BIT function.

    Bye!

    Leave a comment:


  • Terry Glenn Capps
    started a topic Parsing a serial byte?

    Parsing a serial byte?

    I am using PowerBasic Console Compiler5 to receive some data from a serial port. The data is actually a set of 8 bits, each of which represents a bit of hardware data. Apparently PowerBasic can only receive data from a serial port as a character. The debugger shows the value of a typical character as "<03>". I am trying to decode the character to obtain the original bits. I have tried VAL and I have tried parsing the character using a MID statement, but no joy.

    Does anyone know how I can obtain the original bit data?
Working...
X