02-03-2014 09:59 AM
What’s a callback function?
I opened “a project from template”. I selected a .uir. I placed a box that I could put text in. I double clicked on the box and an edit string box opened. It’s looking for a Source Code Connection. It wants a Constant name. And in the next box it wants a Callback function. I have some code that I think will make some resistance measurements using an Agilent 34970A. There are a bunch of AG34970A_MeasureResistance(&gpib… things.
Is the Callback function “AG34970A_MeasureResistance”?
Charlie Reiss
410 993 1418
Baltimore, MD
Trying to use the NI discussion forum.
I do see that this measurement routine starts with
Int ResistanceTest(double measurement[8])
Could that be what I should put in the Callback function box … ResistanceTest ?
02-03-2014 10:55 AM
The callback function associated to a control has nothing to do with functions from your instrument driver.
A control callback is the function that is in charge of receiving and handling the events that pertain to that control: mouse clicks, keypress events and so on.
If in case, you would put a call to the instrument function inside the callback for a control; just as an example, you may have a button "Acquire" on your panel: in the control callback you would handle EVENT_COMMIT event (which is received whe the user clicks the button) and insert in that event the appropriate functions to be used to acquire a set of measures from your instrument and eventually display results on screen.
If you are so new with CVI I suggest you go through the tutorial that in a few steps will clarify you the basic aspects of CVI paradigm. You can also look into the examples shipped with the product how the code is organized: a good starting point can be the Example finder that you can reach with Help >> Find examples... menu function.
02-03-2014 01:04 PM
Thank you so much for picking up my question. Where can I find the tutorial that will clarify the basic aspects of CVI paradigm you referenced?
Thank you again - Charlie Reiss and yes I am so new with CVI.
02-04-2014 12:47 AM
You could start reading Getting Started with LabWindows/CVI document that is installed on your system: here is the online copy for release 2013, you will need to use the one for your release.
After briefly describing the IDE, the document drives you through the creation of a simple application with which you can approach the fundamentals of programming with the product.
CVI is a good and powerful instrument: with a good starting point you can exploit all its characteristics and get optimum results.
02-05-2014 03:34 PM
here is what I would do.
Create your uir file. Place all the controls you need. (Textbox, buttons, listox etc)
Then Select Menu: Code\Generate\All Code
This will generate all necessary callbacacks and template callback functions.
Then you just write your own code in callback functions.
02-05-2014 03:34 PM
here is what I would do.
Create your uir file. Place all the controls you need. (Textbox, buttons, listox etc)
Then Select Menu: Code\Generate\All Code
This will generate all necessary callbacacks and template callback functions.
Then you just write your own code in callback functions.
02-06-2014 02:03 AM
Right, that's the path the tutorial drives you through.
With the addition of some informations on debugging and deploying the application.
It's a good guided tour that permits you to discover the basis of CVI IDE.