|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
RS232 - Recive = Send????Im trying to send a command to my uprocessor project, but when i try to read the answer for the uPU I get the same commed I just send to it??? It is as if the command isn't send before I close the connection? Can it have something to do with Async/sync read/write???? Everything works when I just type the commands i Hyper Terminal I get the respond as I should... Here is the code I use... Dim obj_RS232 As New Rs232() Dim char_input As Char obj_RS232.Open(1, 19200, 8, Rs232.DataParity.Parity_None, Rs232.DataStopBit.StopBit_1, 128) obj_RS232.Write("DSTATUS" & vbCr) txtb_result.Clear() Do obj_RS232.Read(1) char_input = obj_RS232.InputStreamString() txtb_result.Text &= char_input Loop While Not (char_input = vbCr) obj_RS232.Close() Hope someone can help. /Henning Hi,
Generally, when you appear to have received what you sent, the fault lies with the cable between your PC and the device. If a RS-232 serial port is floating (not connected) often there is enough cross-talk between the Tx and Rx circuitry to give the result that you see. So, the first step is to check the connection (such as using HyperTerminal). After that, I suggest that you download DesktopSerialIO from my homepage. It is free (as is the class that you are using, of course). However, it is more flexible, and easier to use -- IMO. Also, I provide a simple terminal example in the download that may be instructive. 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. Hi, Dick,
Thanks for the responds, I will look into youre DesktopSerialIO. Are your DesktopSerialIO free to be used for commertial software? And as mentioned earlier "everything DO work when I use Hyper Terminal" Any other idears, about what could be wrong. /Henning Show quoteHide quote "Dick Grier" <dick_grierNOSPAM@.msn.com> wrote in message news:eoQfm5iZGHA.4916@TK2MSFTNGP04.phx.gbl... > Hi, > > Generally, when you appear to have received what you sent, the fault lies > with the cable between your PC and the device. If a RS-232 serial port is > floating (not connected) often there is enough cross-talk between the Tx > and Rx circuitry to give the result that you see. > > So, the first step is to check the connection (such as using > HyperTerminal). After that, I suggest that you download DesktopSerialIO > from my homepage. It is free (as is the class that you are using, of > course). However, it is more flexible, and easier to use -- IMO. Also, I > provide a simple terminal example in the download that may be instructive. > > 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. > Hi,
>> DesktopSerialIO free to be used for commertial software?Are your << Yes. If your code works with HyperTerminal, then it will work with DesktopSerialIO. Some devices require that RTS be set to True. Set the RTSEnable property to True. 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. Hi again,
I have now figured out somthing more. I tried to read more than one line after sending a command!! and guess what.. I got the respondse I want? Exampel. I send: "DSTATUS" & vbcr I recive "DSTATUS" & vbcr and if I read yet another line I get "DISKX is turned on" & vbcr As I should... I don't like that I have to read the first line and then discard it, before beeing able to read the real responds to my command! What goes wrong? How does the send command turn up in the inputbuffer? Thanks for the help so far. /Henning Show quoteHide quote "Dick Grier" <dick_grierNOSPAM@.msn.com> wrote in message news:eoQfm5iZGHA.4916@TK2MSFTNGP04.phx.gbl... > Hi, > > Generally, when you appear to have received what you sent, the fault lies > with the cable between your PC and the device. If a RS-232 serial port is > floating (not connected) often there is enough cross-talk between the Tx > and Rx circuitry to give the result that you see. > > So, the first step is to check the connection (such as using > HyperTerminal). After that, I suggest that you download DesktopSerialIO > from my homepage. It is free (as is the class that you are using, of > course). However, it is more flexible, and easier to use -- IMO. Also, I > provide a simple terminal example in the download that may be instructive. > > 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. > Hi,
Your connected device may be echoing them. If so, you have to parse them out (a simple proceedure). -- 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. I just found out 5 min ago, that that is exacly what is happening...
The hardware echoes the command... Thanks for all your help Dick /Henning Show quoteHide quote "Dick Grier" <dick_grierNOSPAM@.msn.com> wrote in message news:uVIf3W8ZGHA.3848@TK2MSFTNGP05.phx.gbl... > Hi, > > Your connected device may be echoing them. If so, you have to parse them > out (a simple proceedure). > > -- > 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. >
Web Browser in Windows App
Debug.Wrile does not appear on the Output Window Unused variables that really are?!? Can't delete an image that is in a picture box GetCurrentProcess.Id vs GetCurrentProcessId API Trying to execute something stored in variable Form Visibility Issue VB.NET 2003 Paste logo on image Newbie: Examples of ExecuteNonQuery VB2005 structures to file |
|||||||||||||||||||||||