RetrievingtheRS-232TransceiverState
TheNI-SerialsoftwarereturnswhichmodetheRS-232transceiversare
currentlyoperatingin,andwhethertheserialconnectionisvalid.
NoteTransceivermodereferstotheprogrammedmode.
Transceiverstatereferstothephysicalstateofthetransceivers
(actualoperatingmodeandwhethervalidorinvalid).
TherearetwowaystoretrievetheRS-232transceiverstateand
tranceivermode:
ReadtheNI-VISAwiremodeattributetoretrievethetransceiver
stateandtheNI-VISAIsPortConnectedattributetoretrievethe
transceivermode.
TheNI-Serialsoftwareusesprogrammaticcontrolcodesandthe
DeviceIoControlWindowsfunctiontoretrievetheRS-232
transceiverstateandtransceivermode.
ToretrievetheRS-232transceiverstateusingtheDeviceIoControl
Windowsfunction,completethefollowingsteps:
1. Addthefollowinglinestoyoursourcecode:
#include<winioctl.h>
#include<NiSerial.h>
NoteTheheaderfileNiSerial.hisincludedonyourNI-
SerialsoftwareCD.YoualsocanfinditintheNI-Serial
folderwhereyouinstalledyourNationalInstruments
software(typically,C:\ProgramFiles\NationalInstruments\NI-
Serial).
2. TheRS-232transceiverstateattributeiscontainedwithinastruct
oftypeSERIAL_RS232_STATE.Thestructmembersandpossible
valuesareshownbelow:
Member
Name
Values
PortMode RS232_MODE_DTE
RS232_MODE_DCE
RS232_MODE_AUTO