Serial Port Complete - Latest Microcontroller projects

(lily) #1
Managing Ports and Transfers in .NET

 internal void PinChanged( object sender, SerialPinChangedEventArgs e )
{
SerialPinChange SerialPinChange1 = 0;
bool signalState = false;


SerialPinChange1 = e.EventType;
switch ( SerialPinChange1 )
{
case SerialPinChange.Break:

Console.WriteLine( "Break is set" );
break;

case SerialPinChange.CDChanged:

signalState = myComPort.CDHolding;
Console.WriteLine( "CD = " + signalState );
break;

case SerialPinChange.CtsChanged:

signalState = myComPort.CtsHolding;
Console.WriteLine( "CTS = " + signalState );
break;

case SerialPinChange.DsrChanged:

signalState = myComPort.DsrHolding;
Console.WriteLine( "DSR = " + signalState );
break;

case SerialPinChange.Ring:

Console.WriteLine( "Ring detected" );
break;
}
}
Free download pdf