Setting Up Serial Transceiver Wire Modes Programmatically in LabWindows/CVI Primary Software: LabWindows/CVI Run-Time EnginePrimary Software Version: 7.0 Primary Software Fixed Version: N/A Secondary Software: LabWindows/CVI Development Systems>>Full Development System
Problem: I need to set the RS-485 and RS-232 wire modes in CVI and have the new settings displayed to make sure they took effect. How do I do this? Solution: To set a wire mode, use the following function:   viSetAttribute (INSTHANDLE, VI_ATTR_ASRL_WIRE_MODE, VI_ASRL_WIRE_485_4); VI_ASRL_WIRE_485_4 sets the RS-485 wire mode to 4-wire mode (value of 0) Other possible settings are as follows: RS-485   VI_ASRL_WIRE_485_2_DTR_ECHO --> 2-wire DTR mode controlled with echo (value of 1)   VI_ASRL_WIRE_485_2_DTR_CTRL --> 2-wire DTR mode controlled without echo (value of 2)   VI_ASRL_WIRE_485_2_AUTO --> 2-wire auto mode controlled with TXRDY (value of 3) RS-232   VI_ASRL_WIRE_232_DTE --> DTE mode (value of 128)   VI_ASRL_WIRE_232_DCE --> DCE mode (value of 129)   VI_ASRL_WIRE_232_AUTO --> Specifies that the wire mode is automatically detected by the hardware (value of 130) To get the current wire mode, use the following function:   viGetAttribute (INSTHANDLE, VI_ATTR_ASRL_WIRE_MODE, &RetWireMode); To display the current wire mode, use the following function:   printf("Wire Mode %d\n",RetWireMode); Attached below is a .c file that returns the initial wire mode for an RS-485, sets the wire mode to 4-wire, then returns the new setting. Related Links: KnowledgeBase 17M6L0TI: What Are the Different Transceiver Modes on the NI RS-485 Serial Cards? Attachments:
Report Date: 07/20/2004 Last Updated: 10/28/2005 Document ID: 3BJC7JXR |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
