473,379 Members | 1,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

RS232 - Recive = Send????

Hi all,

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

Apr 22 '06 #1
6 4041
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.
Apr 22 '06 #2
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
"Dick Grier" <dick_grierNOSPAM@.msn.com> wrote in message
news:eo**************@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.

Apr 22 '06 #3
Hi,

Are your
DesktopSerialIO free to be used for commertial software?
<<

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.
Apr 23 '06 #4
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

"Dick Grier" <dick_grierNOSPAM@.msn.com> wrote in message
news:eo**************@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.

Apr 24 '06 #5
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.
Apr 24 '06 #6
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

"Dick Grier" <dick_grierNOSPAM@.msn.com> wrote in message
news:uV**************@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.

Apr 24 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Przemo | last post by:
Hi, Do you know some good RS232C class? There is one in VB.NET 101 Examples, but I think it is poor. 1. I can't for e.g. read into my application all data received. I must tell how many...
4
by: Laura Lucas | last post by:
Hi I'm working with visual C++ 6.0 I can detect when an EV_RING event is generated with: BOOL WaitCommEvent( HANDLE hFile, // handle to communications device LPDWORD...
13
by: jay.dow | last post by:
I want to write to the pins of an RS232 without using the serial protocol. The use would be every pin could act to complete a circuit in customized hardware. I could use python to communicate...
2
by: Rene Sørensen | last post by:
I'm using .NET 2.0 VS 2005 I'm creating a function that dos something similar to the. SmoApplication.EnumAvailableSqlServers() function. But for som resone I get an error or do i?. The problem...
3
by: Lars | last post by:
Hi I'm programming C to an AVR-Board and would like to activate a register on the board with an C# application. Instead of pressing the button (PINA.4 or address 0x19 bit 4) , i would like to...
1
by: fidel | last post by:
Hello, my target is a small application which: * Start as a small Window * Offers several input fields for RS232-related connection informations (like parity etc...) * A Send-function to...
5
by: Canuno | last post by:
Hi, I'm trying to send a small string to a serial port rs232 located in com 4. the string is: "ST GA#Ž" The Baud Rate is: 38400 Parity: None Data Bits: 8 Stops Bits: 1 Flow Control: None...
5
by: =?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?= | last post by:
Hi, how can I access the RS-232 hardware interface using C# and .NET2.0 to send and receive messages to a hardware component? Christian
1
by: khizerbasith | last post by:
i need to interface vba in excel to interface it to rs232.need to send the message from the vba throught the rs232 port
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.