vb.net - Serial Port strange data display and crash -


i trying create vb.net program data scales using serial port.

i don't know scales model, display model: ind231.

problem stupid data:

picture 1 program

but if turn on putty this:

picture 2 putty window

as see in putty there 1 line refresh every sec, true weight first 2 00 (in middle), in situation line not refreshing, make huge line , after 5-10 s, program crash.

my program code is:

imports axserial  public class form1     dim q queue(of string) = new queue(of string)      private sub form1_load(byval sender system.object,             byval e system.eventargs) handles mybase.load         each s in system.io.ports.serialport.getportnames()             lstports.items.add(s)         next s     end sub       private sub btnstart_click(byval sender system.object,         byval e system.eventargs) handles btnstart.click         try             if lstports.selectedindex = -1                 msgbox("please select port")                 exit sub             else                 serialport1.baudrate = 9600                 serialport1.databits = 8                 serialport1.parity = io.ports.parity.none                 serialport1.stopbits = 1                 serialport1.rtsenable = false                 serialport1.portname = lstports.selecteditem.tostring                 serialport1.open()                 timer1.start()             end if         catch ex exception             msgbox(ex.message)         end try     end sub      private sub serialport1_datareceived(byval sender system.object,         byval e system.io.ports.serialdatareceivedeventargs) _         handles serialport1.datareceived         q.enqueue(serialport1.readexisting())     end sub     private sub timer1_tick(byval sender system.object,            byval e system.eventargs) handles timer1.tick         synclock q             while q.count > 0                 txtreceived.text &= q.dequeue             end while         end synclock     end sub       private sub btnstop_click(byval sender system.object,         byval e system.eventargs) handles btnstop.click         serialport1.close()         timer1.stop()     end sub end class 

this ind321 serial port parameters

serialport1.baudrate = 9600             serialport1.databits = 8             serialport1.parity = io.ports.parity.none             serialport1.stopbits = 1             serialport1.rtsenable = false 

im not sure rtsenable, think flowcontrol.

what need correct data putty?

it looks scale/serial port returning data in format. check scale specs. might e72 or other even/odd/bits/parity combination.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -