LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can i recieve an error message when my serial hardware is not connected

Can i recieve an error message when my serial hardware is not connected to the serial port of the PC.i tried to indicate with the error message of the serialread.vi but it indicates no errors?
0 Kudos
Message 1 of 4
(2,716 Views)
Poll the unit and if it does not reply within a given timeout / tries then set the error flag...If the unit is sending out data continously when connected just check the number of bytes at the serial port and if there is none...then the unit is not connected.

The error messages from the serial functions will not detect that no unit is connected, they only care about the workings of the port itself, not what is connected to it.
0 Kudos
Message 2 of 4
(2,716 Views)
Aside from polling, you can do this using the NI USB-232 /2 and /4. These units have a DTE-Valid signal which will allow you to programatically determine whether there is a valid RS-232 signal present at the port. Access to this state is made via an IOCTL call.

Kinda cool demo when used with a palm pilot and its cradle 🙂
0 Kudos
Message 3 of 4
(2,716 Views)
Depending upon how the interface needs to be wired, and possibly the divice connected to it you might be able to detect the presence of the device by looking at the state of a handshake signal.

For example, if the device always asserts DTR when it's powered-on (or can be configured to), you can check for that using the VISA signal status properties.

Alternately, if you have two handshake signals that aren't being used (like RTS and CTS) you can short the two signals together at the device end on the serial cable. Then in software set RTS and verify that CTS shows the same state. Of course technically this only detects the presence of the cable, but sometimes signals like this are cross connected inside devices.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 4
(2,716 Views)