LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I'd like to know the difference between the function "Ivi_SetAttributeViInt32" and the function "Ivi_SetAttrWriteCallbackViInt32"

I'm going to develop a (gpib,VXI,... ) general driver whith "Create Ivi instrument driver". I would like to know the most generic and easily useful function to read and write attribute. I read the documentation LabWindows/CVI Instrument driver developers guide. thanks
0 Kudos
Message 1 of 3
(3,197 Views)
Hi,

The Ivi_SetAttributeViInt32 is the function used to set a new value for particular attribute. This is the function you would use through your code. For example, if there is an attribute RANGE, you would call the SetAttribute function every time you want to change the range value.

the Ivi_SetAttrWriteCallbackViInt32 is used in the initialization of you driver to pass the IVI the Write Callback function for a particular attribute. The callback function is usually the function that performs the I/O with the instrument. The callback is executed everytime you set a new value to an attribute.

For example, you could define a callback:

Range_callback(...)
{
//Send GPIB command to set range
}

Use the Ivi_SetAttrWriteCallbackViInt32 to assign tha
t callback to the attribute RANGE.

Now everytime you call Ivi_SetAttributeViInt32 to set a new range value, the IVI engine automatically calls the Range_callback, which actually sends the new value to the instrument.

The advantage of this approach is the IVI engine performs automatic state caching. If the attribute RANGE already has the value you are trying to set, there is no need to call the range_callback.

Hope this helps,

DiegoF.
National Instruments.
0 Kudos
Message 2 of 3
(3,197 Views)
I'm sorry but I have not understood immediatly your explaination, but thanks to your help, now, it's all right
Thanks a lot.
0 Kudos
Message 3 of 3
(3,197 Views)