Hello,
I'm developing an application in VB.NET 2005 that communicates with a device
through RS232,
and need to send the following sequence of hexadecimal data to the device:
0xFF, 0x01, 0xC3, 0xE3, 0xFF, 0xFF.
That's the configuration:
SerialPort.PortName = "COM1"
SerialPort.BaudRate = 9600
SerialPort.StopBits = IO.Ports.StopBits.One
SerialPort.DataBits = 8
SerialPort.Parity = IO.Ports.Parity.None
If SerialPort.IsOpen = False Then
SerialPort.Open()
End If
How to send and receive data???
??? SerialPort.Write(??????)
??? TextBox1.Text = SerialPort.ReadExisting
SerialPort.Close()
p.s. according to manual, the responce of device is also in hexadeciaml
format, smt. like 0xFF, 0x01, 0xC3, 0x00, 0x05, 0xFF
Any help would be greatly appreciated,
thanks in advance,
Adriano 3 31221
Dim xmtBuf() as byte = {&HFF,&H1,&HC3,&HE3,&HFF,&HFF}
SerialPort.Write(xmtBuf,0,xmtBuf.Length)
Dim rcvBuf(1024) as byte
SerialPort.Read(rcvBuf,0,rcvBuf.Length) http://msdn2.microsoft.com/en-us/lib...rt(VS.80).aspx
"Adriano" <ad*****@mail.itwrote in message
news:uJ**************@TK2MSFTNGP05.phx.gbl...
Hello,
I'm developing an application in VB.NET 2005 that communicates with a
device through RS232,
and need to send the following sequence of hexadecimal data to the device:
0xFF, 0x01, 0xC3, 0xE3, 0xFF, 0xFF.
That's the configuration:
SerialPort.PortName = "COM1"
SerialPort.BaudRate = 9600
SerialPort.StopBits = IO.Ports.StopBits.One
SerialPort.DataBits = 8
SerialPort.Parity = IO.Ports.Parity.None
If SerialPort.IsOpen = False Then
SerialPort.Open()
End If
How to send and receive data???
??? SerialPort.Write(??????)
??? TextBox1.Text = SerialPort.ReadExisting
SerialPort.Close()
p.s. according to manual, the responce of device is also in hexadeciaml
format, smt. like 0xFF, 0x01, 0xC3, 0x00, 0x05, 0xFF
Any help would be greatly appreciated,
thanks in advance,
Adriano
Hi,
To add to what Terry posted:
Dim Buffer() As Byte = {&HFF, &H01, &HC3, &HE3, &HFF, &HFF)
SerialPort.Write(Buffer, 0, 6) 'for example
--
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.
Thanks Terry,
seems it worked!
Regards,
Adriano
"Terry Olsen" <to******@hotmail.comñîîáùèë/ñîîáùèëà â íîâîñòÿõ ñëåäóþùåå:
news:%2***************@TK2MSFTNGP04.phx.gbl...
Dim xmtBuf() as byte = {&HFF,&H1,&HC3,&HE3,&HFF,&HFF}
SerialPort.Write(xmtBuf,0,xmtBuf.Length)
Dim rcvBuf(1024) as byte
SerialPort.Read(rcvBuf,0,rcvBuf.Length)
http://msdn2.microsoft.com/en-us/lib...rt(VS.80).aspx
"Adriano" <ad*****@mail.itwrote in message
news:uJ**************@TK2MSFTNGP05.phx.gbl...
>Hello,
I'm developing an application in VB.NET 2005 that communicates with a device through RS232, and need to send the following sequence of hexadecimal data to the device:
0xFF, 0x01, 0xC3, 0xE3, 0xFF, 0xFF.
That's the configuration:
SerialPort.PortName = "COM1" SerialPort.BaudRate = 9600 SerialPort.StopBits = IO.Ports.StopBits.One SerialPort.DataBits = 8 SerialPort.Parity = IO.Ports.Parity.None
If SerialPort.IsOpen = False Then SerialPort.Open() End If
How to send and receive data???
??? SerialPort.Write(??????) ??? TextBox1.Text = SerialPort.ReadExisting
SerialPort.Close()
p.s. according to manual, the responce of device is also in hexadeciaml format, smt. like 0xFF, 0x01, 0xC3, 0x00, 0x05, 0xFF
Any help would be greatly appreciated,
thanks in advance, Adriano This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: UrgeOverkill |
last post by:
I'm having a problem sending data from a socket server. The server
side reports that it has sent 4845 bytes but the client reports only
1448 bytes received. The kicker is that this ONLY happens...
|
by: Daniel |
last post by:
after opening socket, sending data then closing socket 3000 times i get
"Only one usage of each socket address"
what am i doing wrong? is there some thing else i need to do to free up the
socket...
|
by: David |
last post by:
I'm wondering if python is capable of fairly precise timing and also sending
data out the parallel port.
For example ; making a 7.5 KHz square wave come out of one of the data pins
on the...
|
by: MNQ |
last post by:
Hi All
I want to use my parallel port of my PC to control some external devices. I
am writing a program in ANSI C using the PacificC compiler. What I need to
know is how to access the parallel...
|
by: yaron |
last post by:
Hi,
I have a problem when sending data over TCP socket from c# client to java
server.
the connection established ok, but i can't send data from c# client to java
server.
it's work ok with...
| |
by: vladimir.plotnikov |
last post by:
Hello!
I have problem:
I have IPB forum installed. After search in IPB (search takes about 3-4
seconds for post table about 300 000 records) mysql shows "Sending
Data"
status and takes about...
|
by: Charlie |
last post by:
Hi:
I need a way to test my TcpListner, but not sure what applications are
sending data to tcp ports. How about Email or Instant Messenger? If they
are tcp, what ports are they sending data...
|
by: Mateo |
last post by:
(As.Net 1.1 framework!)
Hi!
So, I have problem as described in subject.
Here is source code:
|
by: WhiteRider |
last post by:
I have some basic knowledge of socket programming in Python. Up to now all I have been able to do when establishing a socket is sending a string to a client, what I would like to know is what else...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
| |
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,...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |