LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

which function must I call in a write callback function to change an attribute?

Hi,
I use LabWindows/CVI 6.0. I develop a IVI instrument driver for GPIB, RS232, serial etc...
I'm using the wizard Create IVI instrument driver.
I have questions on the same topic : changing and reading an attribute

1) I have defined an attribute. I want ONLY READ the attribute value from the instrument with the function Ivi_GetAttributeViInt32 (for example)
In the function,
ViStatus Ivi_AddAttributeViInt32(ViSession vi, ViAttr newAttributeID, ViConstString attributeName, ViInt32 defaultValue, IviAttrFlags flags, ReadAttrViInt32_CallbackPtr readCallback, WriteAttrViInt32_CallbackPtr writeCallback, IviRangeTablePtr rangeTable)
can I to pass VI_NULL for the parameter writeCallback an
d readCallback ?

2) Now, I would like to change an attribute value (with the function Ivi_SetAttributeViInt32 for example). If I have well understood, I can't pass VI_NULL to the writeCallback parameter (in the function Ivi_AddAttrViInt32). So I pass a function (for example CB_MYATTR_WriteCallback) for the parameter writeCallback.

In the function CB_MYATTR_WriteCallback(ViSession vi, ViSession io, ViConstString channelName, ViAttr attributeId, ViInt32 value) I don’t know what to do. Which function do I use to change the attribute value ?

3) If I pass CB_MYATTR_ReadCallback to the the readCallback .
In the function CB_MYATTR_ReadCallback(ViSession vi, ViSession io, ViConstString channelName, ViAttr attributeId, ViInt32 value) I don’t know what to do. Which function do I use to read the attribute value ?

4) What’s happening if I pass VI_NULL to the writeCallback and readCallback parameter (in the function Ivi_AddAttrViInt32) and I call Ivi_SetAttrib
uteViInt32 or Ivi_GetAttributeViInt32 ?

The driver is a new notion for me. I have searched in the documentation but I haven’t found enough explanations.
Thanks
0 Kudos
Message 1 of 2
(2,906 Views)
Hi,

You can pass VI_NULL to the Read and Writecall back parameters. This instructs the IVI engine not to call any callbacks when the attribute is accessed.

You can check this in the CVI help for the Ivi_AddAttributeViInt32 function.

Also, you should post these questions in the instrument driver/IVI forum

DiegoF
National Instruments
0 Kudos
Message 2 of 2
(2,906 Views)