How can i read data from the serialport DCD pin ?

Thread Starter

Embedded Lover

Joined Dec 22, 2008
26
How can i read data from the serialport DCD pin ?

Hi All,
I am using C# and want to know how can i read data from the serialport DCD pin ?

there is a class Serial port that has a nice stuff, but no way to get the data carried by the DCD signal , just the status

can I ?

or in C++ and port it !
 

Thread Starter

Embedded Lover

Joined Dec 22, 2008
26
But I have a remote control ciruit that's designed to receive the signal on the DCD pin and it works well in already-made program called uICE . I made the circuit abd tested it with this program and it worked.

however, do u have any alternatives ? and how to decode the IR signal ?
 

beenthere

Joined Apr 20, 2004
15,819
Pin 1 is DCD, pin 5 is Ground, Pin7 is CTS.

When CTS is asserted, it powers the receiver. The received data is sent onto pin 1. The TSOP1738 is designed to work with IR modulated at 38KHz.

It might work better if the data was sent to pin 2, which is the Rx (receive data) input. Is there some reason for using DCD instead of Rx?
 

Thread Starter

Embedded Lover

Joined Dec 22, 2008
26
I did some thing else that worked with me

Checking the status of the DCD pin at time slots(e.g. every 1 ms). That enabled me to get the data from this pin.
 

xushirui

Joined Apr 7, 2009
8
If you are using SerialPort component, you can add a event handler of
SerialPinChangedEventHandler
like
mCom.PinChanged += new SerialPinChangedEventHandler(Com_StatusChanged);



void Com_StatusChanged(object sender, SerialPinChangedEventArgs e)
{
string info = string.Empty;
switch (e.EventType )
{
case SerialPinChange.Break:
info = string.Format("Break detected. BreakState = {0}", mCom.BreakState);
break;
case SerialPinChange.CDChanged:
info = string.Format("Carrier Detect (CD) signal changed state. CD State = {0}", mCom.CDHolding);
break;
case SerialPinChange.CtsChanged:
info = string.Format("Clear to Send (CTS) signal changed state. CTS State = {0}", mCom.CtsHolding);
break;
case SerialPinChange.DsrChanged:
info = string.Format("Data Set Ready (DSR) signal changed state. DSR State = {0}", mCom.DsrHolding);
break;
case SerialPinChange.Ring:
info = "Ring detected";
break;
default:
break;
}
LineStatusChangeEventArgs args = new LineStatusChangeEventArgs(info);
OnLineStatusChanged(sender, args);
}

Hope this could be help
 
Top