Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

interfacing between gui(pc) and the controller via rs232 using c#

Status
Not open for further replies.

poornimargowda

Junior Member level 3
Joined
Oct 22, 2011
Messages
31
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,456
Please, can anybody upload the sources for writing the code for communicating betweeen GUI(pc) and the MC3PHAC controller using c# programming language..?

Your help will be appreciated!!

Thanks,
Poornima
 

Some basic interfacing with the PC serial comm port:
Code:
using System.IO.Ports;

	public static SerialPort _serialPort;
         public Form1()
        {
                _serialPort = new SerialPort();
                _serialPort.BaudRate = 9600;
                _serialPort.Parity = Parity.None;
                _serialPort.DataBits = 8;
                _serialPort.StopBits = StopBits.One;
                _serialPort.PortName = COM1;

                try 
                {
                    _serialPort.Open();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this
                                    , "Error while attempting to open the serial port.\r\n" + ex.Message
                                    , "Open Serial Port Error"
                                    , MessageBoxButtons.OK
                                    , MessageBoxIcon.Error);
                }
                
                if (_serialPort.IsOpen)
                {
					_serialPort.WriteLine("Hello World\r");
				}
		}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top