ModifyingtheRS-485TransceiverModeProgrammatically
TomodifytheRS-485transceivermodeprogrammatically:
ChangetheNI-VISAwiremodeattribute.
TheNI-Serialsoftwareusesprogrammaticcontrolcodesandthe
DeviceIoControlWindowsfunctionforprogrammingtheRS-485
transceivercontrolmode.
SettingtheRS-485TransceiverControlModeonPCI,PXI,
USB,ExpressCard,andPCMCIAHardware
TosetandretrievetheRS-485transceivercontrolmodeusingthe
DeviceIoControlWindowsfunctiononPCI,PXI,USB,
ExpressCard,andPCMCIARS-485hardware,completethe
followingsteps:
1. Addthefollowinglinestoyoursourcecode:
#include<winioctl.h>
#include<NiSerial.h>
NoteYoucanfindtheheaderfileNiSerial.hintheNI-
SerialfolderwhereyouinstalledyourNational
Instrumentssoftware(typically,C:\Program
Files\NationalInstruments\NI-Serial).Itisalsoincluded
onyourNI-SerialsoftwareCD.
2. TheTRANSCEIVER_MODEattributecanhavethefollowing
values:
RS485_MODE_4WIRE
RS485_MODE_2W_ECHO
RS485_MODE_2W_DTR
RS485_MODE_2W_AUTO
3. TosettheRS-485transceivercontrolmode,use
NISERIAL_SET_RS485_MODEandDeviceIoControl.For