Count byte from Rs232
Hello ,every body .I want to count byte from Com transmit .Can you help me .I am using C#
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Feb 26, 2011, 2:19 AM EST
//configuring the serial port
serialPort1.PortName="COM1";
serialPort1.BaudRate=9600;
serialPort1.DataBits=8;
serialPort1.Parity=Parity.None;
serialPort1.StopBits= StopBits.One;
//opening the serial port
serialPort1.Open();
serialPort1.Read(byteArray,0,byteArray.Length);
//Returns the number of bytes in buffer.
serialPort1.BytesToRead;
For more clear details look at
http://www.c-sharpcorner.com/uploadfile/eclipsed4utoo/serialportcommunication12082008111137am/serialportcommunication.aspx,
http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx?ppud=4
toanhoi bui70 reputationPosted Feb 27, 2011, 4:35 PM EST
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Feb 27, 2011, 6:23 PM EST
Did you try this?
byteArray is a variable which is type of byte Arrary. you have to declare the byteArray as given below.
byte[] byteArray = new byteArray[1024];