Shop OBEX P1 Docs P2 Docs Learn Events
receiving data from Parallax RF Transmitter — Parallax Forums

receiving data from Parallax RF Transmitter

TumblerTumbler Posts: 323
edited 2008-10-08 05:54 in BASIC Stamp
Hello,

I try to receive data from the RF Transmitter with visual basic 6.
The data wich is send looks like this:

SEROUT Tx, Baud, [noparse][[/noparse]"UUUU!", strLen, STR string\strLen,crc.LOWBYTE, crc.HIGHBYTE]

The packet data format:
' |----------||------------|   |------------||-------------||-------------|
' |Data Count||Data Value 1|...|Data Value n||Checksum  Low||Checksum High|
' |----------||------------|   |------------||-------------||-------------|
'    BYTE 1       BYTE 2          BYTE n+1       BYTE n+2       BYTE n+3
'
' Byte 1 consists of the Data Count. The Data Count is a value from 1 to 16
' representing the number of Data Values in this packet.  Packets can
' contain from 1 to 16 bytes of data values (at least 1 Data Value is
' required).
' Byte 2 through Byte n+1 are the actual Data Values where
' n = Data Count+1.
' Byte n+2 and Byte n+3 are the last bytes in the packet and consist of a
' 16-bit Cyclic Redundancy Check (CRC) Checksum value calculated using the
' bytes 1 through n+1 together

·I use the MSCom component in Visual Basic 6.

Private Sub commRFG_OnComm()
    Dim sData As String
        sData = commRFG.Input
            Text1.Text = Text1.Text & sData & vbCrLf
End Sub


In this example i don't receive all data, only a part of it.
The input length from the comm component is set to 0.

Anyone knows the problem here?

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-10-07 18:38
    If you output to a terminal window do you get the data correctly? You say you are getting part of your data. Which part. What are you sending (exact values) and what are you receiving?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • TumblerTumbler Posts: 323
    edited 2008-10-08 05:54
    Franklin,
    I found out that my settings of the comm control are wrong, that's why i only receive the first 8 bytes.

    The sended data is correct. These are packages with variable-length data (from 1 to 16 bytes)
    Package looks like this:
    "UUUU!", strLen, STR string\strLen,crc.LOWBYTE, crc.HIGHBYTE

    first the preamble ("UUUU!"): This gets the receiver "in sync" mode
    byte 1: the length of the package
    byte 2: data begin
    byte n+1: data end
    byte n+2: checksum (low)
    byte n+3:checksum (high)
Sign In or Register to comment.