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