TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Faisal Ansari
NA
451
832k
How to receive data from serial ports ?
Mar 30 2012 2:52 AM
Hello,
My question is that, i am creating an application in which application i have to receive data from serial ports and i am trying this code
class
Program
{
static
void
Main(
string
[] args)
{
SerialPort
mySerialPort =
new
SerialPort
(
"COM3"
);
mySerialPort.BaudRate = 9600;
mySerialPort.Parity =
Parity
.None;
mySerialPort.StopBits =
StopBits
.One;
mySerialPort.DataBits = 8;
mySerialPort.Handshake =
Handshake
.None;
mySerialPort.DataReceived +=
new
SerialDataReceivedEventHandler
(DataRecivedHandler);
mySerialPort.Open();
Console
.WriteLine(
"Press any key to continue..."
);
Console
.WriteLine();
Console
.ReadKey();
mySerialPort.Close();
}
private
static
void
DataRecivedHandler(
object
sender,
SerialDataReceivedEventArgs
e)
{
SerialPort
sp = (
SerialPort
)sender;
string
inData = sp.ReadExisting();
Console
.WriteLine(
"Data Recived..."
);
Console
.WriteLine(inData);
}
}
but exception occured "The semaphore timeout period has expired" what does it mean and what is the solution about it please reply soon Thanks
Reply
Answers (
1
)
How to save File Upload Control
Unique MacID compares with otherSystem MacID