LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

what's a callback function?

 

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  ? 

 

0 Kudos
Message 1 of 7
(4,053 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 7
(4,050 Views)

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. 

0 Kudos
Message 3 of 7
(4,044 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 7
(4,026 Views)

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.

Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 5 of 7
(3,986 Views)

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.

Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 6 of 7
(3,986 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 7
(3,976 Views)