|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Q: Vb.net serial port helpI have some questions about serial port in vb.net.... I try only to recieve data, and I'm using this to open port -------------------------------------------------------------------------------------------------------------- With sPort .PortName = "COM1" .BaudRate = 9600 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .RtsEnable = True .DtrEnable = True .ReadTimeout = 1500 End With sPort.Open() and I have this event handler txtBox.Invoke(New myDelegate(AddressOf updateTextBox), New Object() {}) and this sub and delegate Public Sub updateTextBox() With txtBox .AppendText(sPort.ReadExisting) .ScrollToCaret() End With End Sub This code is from vb.net 2005 example ------------------------------------------------------------------------------------------------------------------ When I recive some data from hyper terminal, this works fine..... But when i try to recive data from eg. t central i have bunch of ??????. I try to use in With ..Encoding = System.Text.Encoding.GetEncoding(28591) ..Encoding = System.Text.Encoding.GetEncoding(1252) ..Encoding = System.Text.Encoding.ASCII but not work for me, HT recive this data OK..... Can anybody help me with this problem. regards Hi,
Download the VB.NET example code from my homepage. I think this will get you started. You haven't shown all of your code, so it is a little hard to tell exactly what the problem might be. However, "????" generally indicates that there is some non-ASCII data in the serial stream. My example will allow you to display this data as HEX, so that you can determine what actually is present. Dick -- Richard Grier, MVP Hard & Software Author of Visual Basic Programmer's Guide to Serial Communications, Fourth Edition, ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March 2006. See www.hardandsoftware.net for details and contact information. BTW, the code on my homepage may not include the Hex Display function (I
don't recall). So, if you download it, and don't see it -- contact me offline, and I'll send you an update. Dick -- Richard Grier, MVP Hard & Software Author of Visual Basic Programmer's Guide to Serial Communications, Fourth Edition, ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March 2006. See www.hardandsoftware.net for details and contact information. Dick Grier je napisao/la:
Show quoteHide quote > BTW, the code on my homepage may not include the Hex Display function (I Thanks Dick's for the reply And you Reny..> don't recall). So, if you download it, and don't see it -- contact me > offline, and I'll send you an update. > > Dick > > -- > Richard Grier, MVP > Hard & Software > Author of Visual Basic Programmer's Guide to Serial Communications, Fourth > Edition, > ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March > 2006. > See www.hardandsoftware.net for details and contact information. Dick your's example is help me very much, and all home page, thank you for second time ... regards
dim differences
how to make my own classes show their methods and/or variables while typing? how to send null value to an Integer type variable? SendKeys problem when using Non-English Windows keyboard layouts Killing a Process if no App. ADO.NET dataset limit Ping subnet Creating custom command line switches? Can you send a "Get" request through a browser? Q: Vb.net serial port help |
|||||||||||||||||||||||