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
hal s
NA
3
3.3k
Simultaneous Reading from Serial Port Problem
Aug 23 2010 12:19 AM
Hi,
I am new to serial port programming. I have RFID reader & sensor transmitting data through serial port. When RFID reader reads RFID hanger & sensor reads an object simultaneously then sensor fails to transmit data. Below is the code:
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
StationDATA szCANData;
//String szData ="";
int nBytesToRead = serialPort1.BytesToRead;
byte[] szBuff = new byte[nBytesToRead];
//string szCOM= serialPort1.ReadExisting();
//szData += serialPort1.ReadExisting();
//ProcessBuffer(szData);
serialPort1.Read(szBuff, 0, nBytesToRead);
szCANData.StationID = szBuff[0];
szCANData.StationCMD = szBuff[1];
szCANData.StationMSG0 = szBuff[2];
szCANData.StationMSG1 = szBuff[3];
szCANData.StationMSG2 = szBuff[4];
szCANData.StationMSG3 = szBuff[5];
szCANData.StationMSG4 = szBuff[6];
szCANData.StationMSG5 = szBuff[7];
szCANData.StationMSG6 = szBuff[8];
szCANData.StationMSG7 = szBuff[9];
szCANData.EOD = szBuff[10];
}
Please help. Many thanks
Reply
Answers (
2
)
how to create a quiz game
how to save file in Multipal Extenstion using c#