Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 SerialPorts
HI Friends,
i am going to read machine Data using COM Port but failed to read. when i read data from other computer using com port then my program work fine but whenever i read data from machine then its not working. Hyper Terminal shows data perfectly and hyper Terminal setting's are
Port= COM3 , Baud Rate=9600, Parity=None, StopBits=One, DataBits=8. My Program is
        SerialPort mySerialPort = new SerialPort();
                mySerialPort.PortName = Console.ReadLine();
                mySerialPort.BaudRate = 9600;
                mySerialPort.Parity = Parity.None;
                mySerialPort.StopBits = StopBits.One;
                mySerialPort.DataBits = 8;
                mySerialPort.ReceivedBytesThreshold = 1;
                mySerialPort.Handshake = Handshake.None;
                mySerialPort.RtsEnable = true;
                mySerialPort.ReadBufferSize = 2048;
                mySerialPort.WriteBufferSize = 2048;
                if (!mySerialPort.IsOpen)
                    mySerialPort.Open();
                Console.WriteLine("opened");
                Console.WriteLine(mySerialPort.IsOpen.ToString());
                while (true)
                {
                    string indata = mySerialPort.ReadLine();
                    Console.WriteLine("Data Received:");
                    Console.Write(indata);
                    Thread.Sleep(1000);
                }
                mySerialPort.Close();
                Console.ReadKey();
Please help Me to solve this Problem...
Thank you
Posted 9-Nov-12 18:03pm
Edited 9-Nov-12 18:14pm
v3
Comments
Richard MacCutchan at 10-Nov-12 6:01am
   
What is the data that you receive on the com port?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

mySerialPort.RtsEnable = true;
Which transmision control mode do you setup (None, XOF/XON, RTS+CTS)?
How many wires are in transmission cable?
Maybe you should to disable RTS? I don't know - you have the machine Smile | :)
 
regards
Mick
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 353
1 OriginalGriff 304
2 George Jonsson 258
3 Shemeemsha RA 138
4 Animesh Datta 130
0 OriginalGriff 5,985
1 Sergey Alexandrovich Kryukov 5,341
2 CPallini 4,760
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 8 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100