Question Read Data From com Port in hex

abhi

New member
Joined
Dec 22, 2009
Messages
1
Programming Experience
1-3
Hello Frnds
I am new in this site,

My
Question is
How can i read Data from Com Port in hex format
my device write the data in hex format on com port

The Below code i am using for reading the data in string format
from byte




VB.NET:
Imports System.IO
Imports System.Text
Imports System.IO.Ports
Public Class Form1
    Dim sendDataa As [Byte]()
    Dim prn As String
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim port As New SerialPort(TextBox4.Text, 19200, Parity.None, 8, StopBits.One)'TextBox4.Text = Com1
        port.Open() '("com1", 19200, Parity.None, 8, StopBits.One)
        Dim i123 As Integer = 0
        Dim str123 As String = ""
        Dim byt As Integer
        i123 = port.ReadByte()
        TextBox2.Text = (port.ReadByte)
        For i123 = 0 To Int(TextBox2.Text) - 1
            byt = port.ReadByte
            str123 = str123 & Chr(byt)
        Next
       
        port.Close()
    End Sub


Thx in advance
 
Back
Top