How to tell if a serial port is powered (RS232)
How can i tell if the unit connected to serial port is powered on? Does serial communication have any means of 开发者_开发技巧acknowledging that a command has been received that i can check for? or is it entirely dependent on whatevers plugged into the serial port?
Most RS232 devices (such as modems) will raise the DSR (data set ready) line when they are powered on and ready to work. You can query the status of this line in software.
In a similar fashion, computers generally raise DTR (data terminal ready) to tell the modem (or whatever device) that they are ready. You can control this line from software.
Acknowledgement is not specified by RS232 and varies from one device to another, but many devices do indeed use hardware handshaking to indicate willingness to receive data. Specifically, they will raise CTS (clear to send) when they are ready. If the device is powered on, but can temporarily not receive data, it will leave DSR high, but will clear CTS.
精彩评论