RetrievingtheSerialInterfaceType(RS-232or
RS-485)
Therearetwowaystoretrievetheserialinterfacetype(RS-232orRS-
485):
ReadtheNI-VISAwiremodeattribute.
TheNI-Serialsoftwareusesprogrammaticcontrolcodesandthe
DeviceIoControlWindowsfunctiontoretrievetheserialinterface
type.
ToretrievetheserialinterfacetypeusingtheDeviceIoControlWindows
function,completethefollowingsteps:
1. Addthefollowinglinestoyoursourcecode:
#include<winioctl.h>
#include<NiSerial.h>
NoteTheheaderfileNiSerial.hisincludedonyourNI-
SerialsoftwareCD.YoualsocanfinditintheNI-Serial
folderwhereyouinstalledyourNationalInstruments
software(typically,C:\ProgramFiles\NationalInstruments\NI-
Serial).
2. TheSERIAL_INTERFACEattributecanhavethefollowingvalues:
RS485_INTERFACE
RS232_INTERFACE
3. Toretrievetheserialinterfacetype,use
NISERIAL_GET_INTERFACE_TYPEandDeviceIoControlwiththe
followingcode:
SERIAL_INTERFACEl_SerialInterface;
DWORDl_ByteCount;
DeviceIoControl(
PortHandle,
NISERIAL_GET_INTERFACE_TYPE,
(LPVOID)NULL,