Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi
I have serial port accelerometer which i am connecting to PC via "USB to Serial" Cable. When i have tested it with Hyerterminal, AccessPort and Teraterm. It shows power light ON when i connect to the COM port. But when i am trying to use it with C# code with same configurations as Hyperterminal, I am getting success to connect with port but this modules don't turn on Power light and it is not working. Can you tell me that is their some specific configuration in C# serial port to provide power on serial port.


Thanks
Posted

Serial ports do not provide power, the pins are, in order:

1: DCD or Data Carrier Detect
2: RX or Receive
3: TX or Transmit
4: DTR or Data Terminal Ready
5: Signal Ground
6: DSR or Data Set Ready
7: RTS or Request To Send
8: CTS or Clear To Send
9: RI or Ring Indicator

None of those pins provide power to a device. The GND pin is to share a ground between signal levels so that the RS232 chip can detect the same levels as the device (called a ground reference).

You will need to Improve your question[^] and add details about the device and how you connect to it, perhaps it requires one of the other pins to go low, like DTR or CTS before it will send data.
 
Share this answer
 
Just to add to Ron Beyer's comments about pinout on serial - it is quite likely that Hyperterminal is setting some of the output signal pins high and your device is reading those and turning itself on (it may also be actually powering itself from them, if it's draw is low enough, RS232 signals can normally drive low power LED's pretty well, but they normally struggle with anything much above a couple of mA.)

So try playing with the output signals DtrEnable and RtsEnable - they may switch your device on!
 
Share this answer
 
Thank you for sharing your knowledge. Well I have enabled DtrEnable and RtsEnable now device is working fine. I have noticed that power LED was getting power from these signals.

C#
_serialPort = new SerialPort("COM3");
_serialPort.StopBits = StopBits.One;
_serialPort.Parity = Parity.None;
_serialPort.DataBits = 8;
_serialPort.BaudRate = 38400;
_serialPort.RtsEnable = true;
_serialPort.DtrEnable = true;
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900