Reading Data from Serial Port RS232 in Visual Basic 2013 (Visual Studio .NET) -


we trying getting weight weighing machine.

while reading in hyper-terminal in windows xp using com1 getting right values. reading data in visual basic 2013 (in windows 10 pro) on laptop using usb com port convertor cable getting different values x, ?, 3, &, etc. kindly suggest solution can right data through code.

our code is:

 me.mvserialport         .portname = "com11"          ' shown in device manager         .baudrate = 2400         .parity = parity.none         .stopbits = stopbits.one         .databits = 8         .handshake = handshake.none         .dtrenable = true         .rtsenable = true         .newline = vbcrlf         .readtimeout = 1000         .writetimeout = 1000     end  'function code     private function readcom() string                     if me.mvthread_stop = true exit             try                 try                     if me.mvserialport.isopen                         me.mvserialport.close()                     end if                 catch ex exception                     '                 end try                  try                     me.mvserialport.open()                     if me.mvserialport.isopen                         'thread.sleep(200)                         thread.sleep(val(me.textbox4.text))                         dim svmessage string = ""                         try                             'svmessage = me.mvserialport.readline()                             svmessage = me.mvserialport.readexisting                             updatestatus(svmessage)                         catch ex exception                             'me.mvthread_stop = true                         end try                     end if                     me.mvserialport.close()                 catch ex exception                     me.mvserialport.close()                     '                 end try             catch ex timeoutexception                 'updatestatus(ex.tostring)             end try         loop         return ""     end function      public delegate sub updatestatusdelegate(byval newstatus string)     public sub updatestatus(byval newstatus string)         try             if me.invokerequired                 dim upbd new updatestatusdelegate(addressof updatestatus)                 me.invoke(upbd, new object() {newstatus})             else                 dim svsplit() string = split(newstatus, " ")                 me.textbox4.text = svsplit(svsplit.count - 1)                 richtextbox1.text = newstatus & vbcrlf & richtextbox1.text             end if         catch ex exception             '         end try     end sub 


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -