dcsimg
Results 1 to 4 of 4

Thread: Need help faster way to read byte from serial

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2018
    Posts
    3

    Need help faster way to read byte from serial

    Hi All,
    I am at a beginner level. I want to read all byte from serial until &H29. I have simple code below but it take over 6 seconds.
    Could you help to make it faster? or share better method. ( I try same data with commercial software it less than 1 sec )

    Code:
        Function GetBytes() As String
            Dim serialbyte(350000) As Byte 'For example set maximum byte is 350000
            Dim count As Integer = 0
            Dim i As Integer = 0
            Dim rcb As Byte
            While rcb <> &H29
                rcb = SerialPort2.ReadByte
                serialbyte(i) = rcb
                i += 1
            End While
            Dim str = "Nothing"
            Return str
        End Function
    Last edited by Shaggy Hiker; Feb 7th, 2018 at 10:45 AM.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width