Hi there,
I'm developing an application to catch OBD sensors' data from my car.
I connect it via a RS232 interface.
Now.
with HyperTerminal I can connect and send/receive data, but I'd like to do
this from inside my C# program.
Anyone can write down a very small (or tell how to do it myself) application
containing methods like WriteToSerialPort(string what) and
ReadFromSerialPort(what).
Using the built in control SerialPort, I can correctly open a port, and
write something to it (commands like "ATX" and other worked fine from
HyperTerminal), but I can't read nothing, using SerialPort.ReadLine(). This
method always generates a Timeout exception.
What's wrong?
To send, for example, the "ATX" command through the serial port, I use
SerialPort.Write("ATX"), but nothing seems to happen.
Hope someone will help me soon!!!
Andrea 2 13404
Hi,
you should use SerialPort.ReadLine() when you recive DataReceived
event. If no event is triggered then you didn't recive any data.
Try to send SerialPort.WriteLine("ATX") or SerialPort.Write("ATX\r").
Ales
Andrea Judge je napisal: Hi there,
I'm developing an application to catch OBD sensors' data from my car. I connect it via a RS232 interface. Now. with HyperTerminal I can connect and send/receive data, but I'd like to do this from inside my C# program. Anyone can write down a very small (or tell how to do it myself) application containing methods like WriteToSerialPort(string what) and ReadFromSerialPort(what).
Using the built in control SerialPort, I can correctly open a port, and write something to it (commands like "ATX" and other worked fine from HyperTerminal), but I can't read nothing, using SerialPort.ReadLine(). This method always generates a Timeout exception.
What's wrong? To send, for example, the "ATX" command through the serial port, I use SerialPort.Write("ATX"), but nothing seems to happen.
Hope someone will help me soon!!!
Andrea
On Thu, 22 Dec 2005 18:32:27 +0100, "Andrea Judge"
<ju***@SPAMNOGRAZIEarea51staff.it> wrote: Hi there,
I'm developing an application to catch OBD sensors' data from my car. I connect it via a RS232 interface. Now. with HyperTerminal I can connect and send/receive data, but I'd like to do this from inside my C# program. Anyone can write down a very small (or tell how to do it myself) application containing methods like WriteToSerialPort(string what) and ReadFromSerialPort(what).
Using the built in control SerialPort, I can correctly open a port, and write something to it (commands like "ATX" and other worked fine from HyperTerminal), but I can't read nothing, using SerialPort.ReadLine(). This method always generates a Timeout exception.
What's wrong? To send, for example, the "ATX" command through the serial port, I use SerialPort.Write("ATX"), but nothing seems to happen.
Hope someone will help me soon!!!
Andrea
Send a carriage return along with your command string.
Oz
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Joshua Moore |
last post by:
I'm trying to convert from a lot of invoked code to c# 2.0 SerialPort code.
I can't find a way to set fOutxCtsFlow to true (maybe CTSEnable?) and
fRtsControl = RTS_CONTROL_HANDSHAKE (RtsEnable?). ...
|
by: Eric |
last post by:
I'm trying to send a text message via my cell phone using the .net 2.0
SerialPort object. The command to send a text message requires a newline
"\n" and a ctrl-z command to be entered. I've tried...
|
by: Jean Paul Mertens |
last post by:
Hello,
Someone can tell me why I dont get serial port events in a Service, I
created a separate Thread to open the port but no events are coming up (the
same happens when I use the timer...
|
by: ricolee99 |
last post by:
Hi Everyone,
I'm using the System.IO.Ports.SerialPort component to attempt to kill
an existing component opened by another application.
I use the following code:
SerialPort serialPort = new...
|
by: Jay |
last post by:
Extracted from the C# example in http://msdn2.microsoft.com/en-us/library/s14dyf47.aspx...
public static void Main()
{
string name;
string message;
StringComparer stringComparer =...
|
by: Adriano |
last post by:
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,...
|
by: Keith Lee |
last post by:
All:
I am attempting to compile the perl module Device::SerialPort and get
this error during make --
Manifying blib/man3/Device::SerialPort.3pm
Can't open blib/man3/Device::SerialPort.3pm for...
|
by: Benedictum |
last post by:
I have the following method that initializes the port. I am having problems
assigning values to the Serial port properties. Can someone help ? Here is
the snippet with my comments:
private void...
|
by: cronusf |
last post by:
I set up two virtual COM ports 3 and 4 using com0com. I tried to test
it with the following program. However, the DataReceived event
handlers never get called. Can anyone with SerialPort class...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
| |