SettingtheRS-232TransceiverModewith
DeviceIoControl
TherearetwowaystosetandretrievetheRS-232transceiverstate:
SetandreadtheNI-VISAwiremodeattribute.
TheNI-Serialsoftwareusesprogrammaticcontrolcodesandthe
DeviceIoControlWindowsfunctiontoretrievetheRS-232
transceiverstate.
TosetandretrievetheRS-232transceiverstateusingthe
DeviceIoControlWindowsfunction,completethefollowingsteps:
1. Addthefollowinglinestoyoursourcecode:
#include<winioctl.h>
#include<NiSerial.h>
NoteTheheaderfileNiSerial.hisincludedonyourNI-
SerialsoftwareCD.YoualsocanfinditintheNI-Serial
folderwhereyouinstalledyourNationalInstruments
software(typically,C:\ProgramFiles\NationalInstruments\NI-
Serial).
2. TheTRANSCEIVER_MODEattributecanhavethefollowing
values:
RS232_MODE_DTE
RS232_MODE_DCE
RS232_MODE_AUTO
3. TosettheRS-232transceiver,useNISERIAL_SET_RS232_MODE
andDeviceIoControl.Forexample,tosettoForceDCEmode,
usethefollowingcode:
TRANSCEIVER_MODEl_TransceiverMode=RS232_MODE_DCE;
DWORDl_ByteCount;
DeviceIoControl(