473,626 Members | 3,947 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.DataParit y.Parity_None,
Rs232.DataStopB it.StopBit_1, 128)
obj_RS232.Write ("DSTATUS" & vbCr)

txtb_result.Cle ar()

Do
obj_RS232.Read( 1)
char_input = obj_RS232.Input StreamString()
txtb_result.Tex t &= char_input
Loop While Not (char_input = vbCr)

obj_RS232.Close ()

Hope someone can help.

/Henning

Apr 22 '06 #1
6 4055
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_grierNOSP AM@.msn.com> wrote in message
news:eo******** ******@TK2MSFTN GP04.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_grierNOSP AM@.msn.com> wrote in message
news:eo******** ******@TK2MSFTN GP04.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_grierNOSP AM@.msn.com> wrote in message
news:uV******** ******@TK2MSFTN GP05.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
7638
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 bytes I would like to read. If I specify too many exception occures, if too less there are still some data in buffer.
4
3026
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 lpEvtMask, // pointer to variable to receive event LPOVERLAPPED lpOverlapped, // pointer to overlapped structure );
13
6851
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 serially to a BASIC stamp or a Javelin stamp and then use the stamp to set however many pins as 0's or 1's but should it be that hard to do with python. I've looked through how python does serial with the "serial" module but it just uses Java's...
2
5692
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 is that the program just return from the function when it reach the recive part( reviced = socket.Receive(bytBuffer); ), below here you can se the code. I used eathereal to check the package that is send and reviced, that looks all fine. I do...
3
5014
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 press a button i C# instead. I got a serial connection to the board and experimented a bit, but i'm quite lost. I know howto send text... SerialPort port = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
1
3140
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 submit local files via the opened RS232 connection to the target.
5
4121
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 COM: 4
5
3031
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
3156
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
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.