471,316 Members | 1,026 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,316 software developers and data experts.

SerialPort c# .NET 2.0

I'm trying to convert from a lot of invoked code to c# 2.0 SerialPort code.
I can't find a way to set fOutxCtsFlow to true (maybe CTSEnable?) and
fRtsControl = RTS_CONTROL_HANDSHAKE (RtsEnable?). Also, do I need to set
the handshaking? Below is the old and attempted new (that continually gets
a timeout error on read. I upped the read timeout, but it's way too long
NOT for it to be a handshaking or other issue than the readtimeout setting.
Thanks in advance, Joshua Moore

Part of the old code to open the serialport connection was:

DCB dcb;

GetCommState(m_CommHandle, &dcb);

dcb.BaudRate = 57600;

dcb.ByteSize = 8;

dcb.Parity = NOPARITY;

dcb.StopBits = ONESTOPBIT;

dcb.fOutxCtsFlow = TRUE;

dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;

SetCommState(m_CommHandle, &dcb);

NEW CODE:

serialPort = new System.IO.Ports.SerialPort("COM1", 57600,
System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);

serialPort.Handshake = System.IO.Ports.Handshake.RequestToSend;

// serialPort.ReadBufferSize = 2047;

// serialPort.WriteBufferSize = 2047;

serialPort.RtsEnable = true;

serialPort.ReadTimeout = 800;

serialPort.WriteTimeout = 30;
Jan 5 '06 #1
0 8311

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Andrea Judge | last post: by
13 posts views Thread by Jean Paul Mertens | last post: by
2 posts views Thread by Jay | last post: by
6 posts views Thread by Keith Lee | last post: by
10 posts views Thread by sklett | last post: by
reply views Thread by cronusf | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.