Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

2 questions : changing and reading attribute without callback and the syntax of the write command

Hello,
I develop IvI driver instrument with the wizard LabWindows/CVI.
- I have ever posted this question but I have 2 different answer. Have I to use Callback to change attribute or read attribute ? Can I change or read the attribute of my instrument) if I pass VI_NULL for the callback function parameter in the Ivi_AddAttribute (using only the Ivi_SetAttribute and Ivi_GetAttribute?

- Another question: what is the syntax in the write command "writeBuffer" in the Prefix_WriteInstrData (ViSession vi, ViConstString writeBuffer)? Does it exist an universal convention ? Where can I find information please ?

Last question : Do the same IVI functions
work for GPIB, RS232 ...? In this case, I need to develop only one driver ?
thanks a lot
0 Kudos
Message 1 of 3
(3,204 Views)
Hi,

You don't necessarily need to use the callback functions, it depends on the attribute and its relation to the actual instrument. An attribute is simply a variable handled by the IVI engine. You access the variable using the Ivi_SetAttribute and Ivi_GetAttribute functions. Without callbacks you are just changing the attribute value in memory.

Usually, attributes reflect a setting or parameter in the instrument. The callback links that abstract representation (the attribute) with the actual device. Most IVI drivers implement the instrument I/O in the callback functions. The IVI engine handles the callback functions.

For example, define an attribute named RANGE. Without any callback functions, you can read and write to the attribute, but you are changing its value in memory. The IVI engine doesn't know how to tell the instrument to set the new range. That's where the callbacks come in. You define a write callback for the RANGE attribute. This function will send the appropriate commands to the instrument to set the range. When you call Set attribute RANGE, the IVI engine write the new value in memory and calls the callback function, which will do the actual instrument I/O.

>> Another question: what is the syntax in the write command "writeBuffer" in the Prefix_WriteInstrData (ViSession vi, ViConstString writeBuffer)? Does it exist an universal convention ? Where can I find information please ?

There is no universal syntax. Every instrument has a diferent command set. Instruments of the same manufacturer and family will most likely use the same commands. The ultimate reference is the instrument's User Manual.

>>Last question : Do the same IVI functions work for GPIB, RS232 ...? In this case, I need to develop only one driver ?

Use VISA. The VISA specification provides a standarized API for instrument I/O. Using VISA you have the option to use the driver with different buses and interface vendors.

Hope this helps

DiegoF
National Instruments
Message 2 of 3
(3,204 Views)
thanks a lot, your answer is very clear. I'm going to develop my driver using VISA (looking the forum, I think it will be the best means and you confirm that !). I'll maybe have another question in this new field 🙂
best regards
0 Kudos
Message 3 of 3
(3,204 Views)