473,398 Members | 2,525 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,398 software developers and data experts.

New serialport in VS 2005

I am trying to read data from com1 and I am using the new serialport control.
I downloaded the script from microsoft that does a readline from the comm
port, but I keep getting the "operation timed out" error. I then will open
up HyperTerminal and connect and the output then displays? The arguments
appear to match up between my serialport control and what is setup in
HyperTerminal. Any help would be appreciated.
Thanks.

using System;
using System.IO.Ports;

class Sample
{
public static void Main()
{
string input;

SerialPort sp = new SerialPort("COM1", 9600, Parity.None, 8,
StopBits.One);
try
{
sp.ReadTimeout = 20000;

sp.Open();

input = sp.ReadLine();

Console.WriteLine(input);
Console.ReadLine();
}

catch (TimeoutException e)
{
Console.WriteLine(e);
Console.ReadLine();
}
finally
{
sp.Close();
}
}
}
Nov 22 '05 #1
1 2770
http://www.opennetcf.org/library/
seankub wrote:
I am trying to read data from com1 and I am using the new serialport control.
I downloaded the script from microsoft that does a readline from the comm
port, but I keep getting the "operation timed out" error. I then will open
up HyperTerminal and connect and the output then displays? The arguments
appear to match up between my serialport control and what is setup in
HyperTerminal. Any help would be appreciated.
Thanks.

using System;
using System.IO.Ports;

class Sample
{
public static void Main()
{
string input;

SerialPort sp = new SerialPort("COM1", 9600, Parity.None, 8,
StopBits.One);
try
{
sp.ReadTimeout = 20000;

sp.Open();

input = sp.ReadLine();

Console.WriteLine(input);
Console.ReadLine();
}

catch (TimeoutException e)
{
Console.WriteLine(e);
Console.ReadLine();
}
finally
{
sp.Close();
}
}
}

Nov 22 '05 #2

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

Similar topics

1
by: seankub | last post by:
I am trying to read data from com1 and I am using the new serialport control. I downloaded the script from microsoft that does a readline from the comm port, but I keep getting the "operation timed...
1
by: Richie Carey | last post by:
Here's my problem. I'm using Visual C# 2005 Express for a small project that requires simple AT modem commands to be sent to an external serial device. The device requires 2400 baud, no parity,...
1
by: Don Tucker | last post by:
Hello, I am using Visual Studio .Net 2005 beta. I have my computer's two comm ports connected with a serial cable (and null modem). I'm trying to write the letter 'a' out on comm port 1 with the...
6
by: DraguVaso | last post by:
Hi, I'm experimenting with the Serial Port in VB.NET 2005. Although it isn't that easy to get any feedback from my COM-port as I thought it would be... How can I read all the Data that the...
1
by: Tolgay Gül | last post by:
I need some codes that able to send and read data by serialport in VB.Net 2005 beta 2. I wrote some codes and It can send data via serialport but It cannot read what I send. I have looked up on...
2
by: Andrea Judge | last post by:
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...
0
by: Audio_Developer | last post by:
Hello, I have a problem with the SerialPort Control under VC# Express 2005. In my application I have to read data from an external device through RS 232. The process is built on a software-based...
13
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...
0
by: nmsreddi | last post by:
Hi friends I am working on serialport in c# ,i am using C#2005 i have successfully done the serial communication with GSM modem and able to send and receive data , the main problem ,the serial...
3
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,...
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...
0
marktang
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,...
0
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...
0
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,...
0
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...
0
agi2029
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,...
0
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...

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.