07-21-2008 02:26 AM
07-21-2008 04:09 PM
07-22-2008 12:56 AM
{
// to add on Initialize function here. How to do about it?
}
I would like to return the status of the Initialize function in a textbox too.
Also, from the AWG2041 *.doc downloaded, it seems to say that it can only support GPIB interface. My instrument AWG 2041 does come with RS 232. Can I use the RS 232 to do the initialization test?
tkwg20xx_init
ViStatus tkwg20xx_init (ViRsrc resourceName, ViBoolean IDQuery, ViBoolean resetDevice, ViSession *instrumentHandle); Purpose This function performs the following initialization actions: - Opens a session to the Default Resource Manager resource and a session to the specified device using the interface and address specified in the Resource_Name control. - Performs an identification query on the Instrument. - Resets the instrument to a known state. - Sends initialization commands to the instrument that set any necessary programmatic variables such as Headers Off, Short Command form, and Data Transfer Binary to the state necessary for the operation of the instrument driver. - Returns an Instrument Handle which is used to differentiate between different sessions of this instrument driver. - Each time this function is invoked a Unique Session is opened. It is possible to have more than one session open for the same resource. Parameter List resourceName Variable Type ViRsrc This control specifies the interface and address of the device that is to be initialized (Instrument Descriptor). The exact grammar to be used in this control is shown in the note below. Default Value: "GPIB::1" Notes: (1) Based on the Instrument Descriptor, this operation establishes a communication session with a device. The grammar for the Instrument Descriptor is shown below. Optional parameters are shown in square brackets ([]). Interface Grammar ------------------------------------------------------ GPIB GPIB[board]::primary address[::secondary address] [::INSTR] The GPIB keyword is used with GPIB instruments. The default value for optional parameters are shown below. Optional Parameter Default Value ----------------------------------------- board 0 secondary address none - 31 IDQuery Variable Type ViBoolean This control specifies if an ID Query is sent to the instrument during the initialization procedure. Valid Range: VI_OFF (0) - Skip Query VI_ON (1) - Do Query (Default Value) Notes: (1) Under normal circumstances the ID Query ensures that the instrument initialized is the type supported by this driver. However circumstances may arise where it is undesirable to send an ID Query to the instrument. In those cases; set this control to "Skip Query" and this function will initialize the selected interface, without doing an ID Query. resetDevice Variable Type ViBoolean This control specifies if the instrument is to be reset to its power-on settings during the initialization procedure. Valid Range: VI_OFF (0) - Don't Reset VI_ON (1) - Reset Device (Default Value) Notes: (1) If you do not want the instrument reset. Set this control to "Don't Reset" while initializing the instrument. instrumentHandle Variable Type ViSession (passed by reference) This control returns an Instrument Handle that is used in all subsequent function calls to differentiate between different sessions of this instrument driver. Notes: (1) Each time this function is invoked a Unique Session is opened. It is possible to have more than one session open for the same resource. Return Value This control contains the status code returned by the function call. Status Codes: Status Description ------------------------------------------------- 0 No error (the call was successful). 3FFF0005 The specified termination character was read. 3FFF0006 The specified number of bytes was read. BFFC0002 Parameter 2 (ID Query) out of range. BFFC0003 Parameter 3 (Reset Device) out of range. BFFC0803 Invalid Instrument Response. BFFF0000 Miscellaneous or system error occurred. BFFF000E Invalid session handle. BFFF0015 Timeout occurred before operation could complete. BFFF0034 Violation of raw write protocol occurred. BFFF0035 Violation of raw read protocol occurred. BFFF0036 Device reported an output protocol error. BFFF0037 Device reported an input protocol error. BFFF0038 Bus error occurred during transfer. BFFF003A Invalid setup (attributes are not consistent). BFFF005F No listeners condition was detected. BFFF0060 This interface is not the controller in charge. BFFF0067 Operation is not supported on this session.
07-23-2008 11:10 AM