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
Haribabu Pathipati
NA
6
0
serial Port not working properly - VS2005 on Windows 7
May 15 2010 12:17 AM
Hi,
Recently I got a Desktop with Windows 7 Ultimate.
I installed VS2005 which I was using for more than four years on XP Machine.
My application which was working fine on XP is not working on windows 7 machine.
When bytes are read from the Serial Port ( I am using .NET 2.0 Serial Port ) BytesToRead is not getting reduced. it keeps increasing and eventually buffer is full and stops receiving any more data.
am I missing anything ?
code snippet which reads from serial port is given below.
public void PSerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
ushort addr, Data,crc;
byte cmd;
char ch;
do
{
CharReceived = ch = (char)this.ReadByte(); // read char from port
} while (ch != '@');
Packet[0] = (byte)ch;
this.Read(Packet, 1, 13);
crc = CRCGenerator.GenerateCRC(Packet, 10, 0);
cmd = (byte)toint((char)Packet[1]);
addr = (ushort)( toint((char)Packet[10]) * 16 + toint((char)Packet[11]));
addr = (ushort)(addr * 256 + toint((char)Packet[12]) * 16 + toint((char)Packet[13]));
if (crc != addr) // if crc is non zero then ignore packet.
{
return;
}
addr = (ushort)(toint((char)Packet[2]) * 16 + toint((char)Packet[3]));
addr = (ushort)(addr * 256 + toint((char)Packet[4]) * 16 + toint((char)Packet[5]));
Data = (ushort)(toint((char)Packet[6]) * 16 + toint((char)Packet[7]));
Data = (ushort)(Data * 256 + toint((char)Packet[8]) * 16 + toint((char)Packet[9]));
rRPktNo++;
if (rRPktNo == 128)
{
rRPktNo = 0;
}
DataReceivedEventArgs de = new DataReceivedEventArgs(cmd,addr,Data);
OnDreceived(de); // activate event
return;
}
the application was deployed and working fine on four different XP machines, for more than three years.
Reply
Answers (
0
)
How do you insert a child node in a TreeView Control in WPF C#?
Write in app.config file in C#