Control array of callback functions?

Apologies for my basic question.
I am experimenting with control arrays and so far am able to collect data in string controls that are inside control arrays.  Works well.  Naturally, none of these controls need callback functions.
Now I have need of some momentary command buttons in a control array as well.  So my question is, should I use a single callback function for all of the button controls in that single array?  And if so, how do I go about identifying which element in the control array called the function?  From reading on the forums, it seems as if use of the callback data parameter might get me there.
Just wanted to ask before I get off track.  Thanks!
Solved!
Go to Solution.

Yes, callbackData can be of help in such a situation, but if you can limit to switch on array index to discriminate what to do your button callback could be something on this line:
int CVICALLBACK BtnAttayCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
int handle, index;
switch (event) {
case EVENT_COMMIT:
handle = GetCtrlArrayFromResourceID (panel, control);
GetCtrlArrayIndex (handle, panel, control, &index);
switch (index) {
// Your code here
return 0;
 (No CVI install here so I cannot test it: double check the code but it should reasonably work)
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?

Similar Messages

  • Problem in adding "TableLayoutPanel" control array type functionality on windows form dynamically using drag and drop

    Environment: -
     (Application Machine)
    OS Name             : -
    Microsoft Windows 7 Professional/XP SP2/SP3            
    OS Bit Version      : -
    32 Bit                     
    Application Name: - Designer.exe                                  
    IDE                  
        : - Visual Studio 2008                        
    EXE Application development: -
    VB. Net
    Application Type: -
    Application “Designer.exe” was designed in vb6.0 and now, it has been upgraded to Visual Studio 2008 and it works properly.
    Product Description: -
                 We have an application Designer.exe, which is used for designing “Forms”.
    It has menu option with following option like Panel, Text Box, Combo Box, Button etc. We drag any of this menu items and place it to form.
    Requirement: -
    We have
    critical requirement in product. In Designer.exe, we need to align form margin, while we increase or decrease window. And for that we have searched that 
     “TableLayoutPanel” components can be helpful.
    Problem description: -
    Earlier code was in vb6.0, now it has upgraded to Visual Studio 2008. In vb6.0, we have used control array for memory utilization with Combo Box, Group Box, and Text
    Box etc.
    But, for alignment we have to use “TableLayoutPanel”
    control array type functionality on form.
    Code Snippet: - For earlier designing component e.g. Frame
    'Required by the Windows Form Designer
    Public WithEvents Frame1 As Microsoft.VisualBasic.Compatibility.VB6.GroupBoxArray
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.components = New System.ComponentModel.Container
    Me.Frame1 = New Microsoft.VisualBasic.Compatibility.VB6.GroupBoxArray(Me.components)
    CType(Me.Frame1, System.ComponentModel.ISupportInitialize).BeginInit()
    . Kindly suggest approach for implementing requirement.
    Kindly help us to complete the requirement. I will be really
    thankful for any assistance.

    Hi S.P Singh,
    Welcome to MSDN.
    I am afraid that as Renee Culver said, these forums donot support VB6, you could refer to this thread:
    Where to post your VB 6 questions
    You could consider posting this issue in these forums below:
    These forums do not support Visual Basic 6, however there are many third-party support sites that do. If you have a VB6-related question please visit these popular forums:
    VB Forums
    VB City
    Thanks for your understanding.
    Best Regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • NI DAQ and Arduino in Matlab (control obj in a callback function triggered by another obj)

    (I am aware that this may not be the most appropriate place to ask, but I'm pretty desperate...)
    I am writing a script to acquire online data from a DAQ card and to control an Arduino microcontroller based on the output of the DAQ card data.
    The acquiring of the DAQ card data works fine, but I'm having problems with (1) the online processing of these data and (2) the corresponding controlling of the Arduino microcontroller. I'll try to explain both problems as clear as possible, the matlab code that has already been written can be found at the bottom of this question.
    I'm using a 64-bit Matlab, so I can only use the Session-Based Interface.
    1) Online processing
    Data are collected at a rate of 1000 samples/s. Each time 250 new samples are available, a callback function is triggered to process these data (using a listener triggered by the 'DataAvailable' event). This processing consists of spectral analysis, using the 'spectrogram' function. The problem is that the spectrogram function should use a window of 500 samples and an overlap of 250 samples. So, new samples should be available for processing every 250 samples, but not only the new 250 samples but also the previous 250 samples are needed to accomplish the overlap. Basically, I need 500 samples for each callback function run, but this function has to be ran every 250 samples.
    2) Controlling the Arduino
    The biggest problem lies in the controlling of the Arduino. After spectral analysis, the calculated value is compared to a predefined treshold and if this value exceeds the treshold, the output of the Arduino should be put to one, else the output should be put to zero. The problem here is that, since the callback function is an external function, it doesn't recognize the Arduino object. The Arduino has been connected to Matlab at the start of the script, but is only available in the 'base' workspace. Connecting the Arduino on each function run isn't a possibility, since this should be done every 250 ms.
    Attempted solutions
    I have tried to make the function into a nested function, so that it can use the same variables as the ones in the script, but Matlab doesn't allow this. When I write a nested function, I get the following error: "A nested function cannot be defined inside a control statement (if, while, for, switch or try/catch)." However, I have never defined one of these statements, so the function isn't inside a control statement. I don't understand why this doesn't work.
    Matlab code
    Script
    %% Preparing Arduino
    % Connecting the arduino chip to Matlab
    a=arduino('COM4');
    % Defining the 13th pin as an output
    a.pinMode(13,'output')
    %% Preparing the DAQ card
    % Searching the DAQ card
    devices = daq.getDevices;
    % Create a session
    s = daq.createSession('ni');
    % Define the input channel
    s.addAnalogInputChannel('Dev1', 0, 'Voltage');
    % Define the total measuring and stimulation time
    s.DurationInSeconds = 4;
    % Define the interval for processing
    s.NotifyWhenDataAvailableExceeds = 500;
    % Loading the optimal stimulation parameters
    load('parameters.mat')
    setappdata(s,'freq',parameters(1))
    setappdata(s,'treshold',parameters(2))
    % Define a listener triggered by the DataAvailable event
    lh = s.addlistener('DataAvailable',@stimulation); 
    % Save the start time
    starttime=clock;
    % Start the measurements
    LFP=s.startForeground;
    Callback function
    function stimulation(src,event)
          freq=getappdata(src,'freq');
          treshold=getappdata(src,'treshold');
          LFP=event.Data;
          [S,F,T,P]=spectrogram(LFP,500,250,[],1000);
          PSD=log(P(freq));
          if PSD>=treshold
             a.digitalWrite(13,1)
          else
             a.digitalWrite(13,0)
          end
    end
    All comments/suggestions are welcome.
    Many thanks in advance!

    Hello hemm,
    As you noted this is most likely not the appropriate place to past these non-NI Development environment related questions.
    Especially since the issue does not seem to be related to the interface with the NI DAQ card.
    Maybe you could add some Message Tags so that people that are following specific tags might be able to  detect your question and help you.
    Would it be an option for you to use NI LabVIEW?
    If this is the case then it might be interesting to note that many of the Arduino users over here are using the NI LabVIEW Interface for Arduino Toolkit:
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/212​478
    This is however being supported from the following page:
    https://decibel.ni.com/content/groups/labview-inte​rface-for-arduino
    Kind Regards,
    Thierry C - Applications Engineering Specialist Northern European Region - National Instruments
    CLD, CTA
    If someone helped you, let them know. Mark as solved and/or give a kudo.

  • How to change the Callback function of a GUI button?

    I would like to change the callback function associated with a GUI button dynamically in the programming way.
    Here is the code piece I tried, but it does not seem to work:
    const char* pstrLabelSaveJpeg = "SaveJpegCb";
    SetCtrlAttribute(pahel_id, ctrl_id ,ATTR_LABEL_TEXT, pstrLabelSaveJpeg);
    int CVICALLBACK SaveJpegCb(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
    Solved!
    Go to Solution.

    The attribute you used is about the "label" of the button.
    It is just an appearence attribute. You can write your own name on it, but that does not change the callback function.
    You should change the ATTR_CALLBACK_FUNCTION_POINTER attribute, and you should not pass the function name as a string.
    So your function call will look like this:
    SetCtrlAttribute(pahel_id, ctrl_id, ATTR_CALLBACK_FUNCTION_POINTER, SaveJpegCb);
    Of course, you have to declare the SaveJpegCb function somewhere above that line.
    I think you have already done that.
    S. Eren BALCI
    www.aselsan.com.tr

  • MIDI in using DLL callback function

    I am trying to get MIDI into LV. The dll used is winmm.dll and the function midiinopen (plus others) is described here:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_midiinopen.asp
    The main problem is I don't know how to program the Call Library Function Node properly in order to perform the call
    plus set it to start receiving callback data, being midi messages. I have tried creating and registering a User Event and
    passing the Event ref to the dll's "dwCallback" and then trapping the callback in an Event Structure, but nothing happens.
    I have studied the "Communicating with a Windows MIDI Device in LabVIEW" example but it gives no hint since midi out
    does not require the use of callbacks.
    Please advice,
    Stefan

    Vedeja wrote:
    I am trying to get MIDI into LV. The dll used is winmm.dll and the function midiinopen (plus others) is described here:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_midiinopen.asp
    The main problem is I don't know how to program the Call Library Function Node properly in order to perform the call
    plus set it to start receiving callback data, being midi messages. I have tried creating and registering a User Event and
    passing the Event ref to the dll's "dwCallback" and then trapping the callback in an Event Structure, but nothing happens.
    Damn! Need to make this post shorter as this message
    board just silently told me that it needs to be shorter than 5000 words
    and ate up my lengthy repsonse with no way to get it back.
    You can't configure a Call Library Node to pass a Callback function to
    another function. Callback functions have been alien to LabVIEW for a
    long time with good reasons and what it has now as callback function in
    LabVIEw 7.1 and newer is not directly compatible with C callback
    functions.
    Basically as you want to get data from the callback function back into
    LabVIEW there is really no way around some intermediate software layer
    which in this case almost surely means your own specific wrapper DLL
    written in C.
    If you use LabVIEW 7.1 you could use user events but not in the way you
    describe. Attached is an example of how you can use user events from
    external code. Note the extra DLL you will have to write. You have to
    watch out what data you pass back to the user event as it has to match
    exactly the type you configured the user event for, otherwise LabVIEW
    will simply crash on you.
    For numerics this is quite simply and also shown in the example. For
    strings you can't just pass back a C string pointer but you will have
    to allocate a LabVIEW string handle with
    handle = DSNewHandle(sizeof(int32) + <length of C string>)
    and then copy the C string into it. For specifics about how to do this
    you should refer to the External Code reference manual in your Online
    Bookshelf. Similar rules apply for arrays or clusters for that matter.
    If you want or need to do this for LabVIEW < 7.1 there are two
    possible approaches but both are even less trivial. You could either
    create a wrapper DLL that translates your callback events into LabVIEW
    occurrences and for the data transfer back to LabVIEW you would have to
    implement your own queing too, or you could use the Windows Message
    Queue example somewhere here in the NI examples and adapt it to return
    your specific data. That would solve the data queueing more or less for
    you without having to worry about that.
    Rolf Kalbermatter
    Message Edited by rolfk on 05-22-2006 11:22 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions
    Attachments:
    userevent.zip ‏27 KB

  • In VB6, why is the "GPIBNotify sub" (from the GPIBNotify AtiveX Ctrl) all the time called even if no Event happened? This callback function is started then stopped permanently as if its received SRQ from the GPIB Bus. Any ideas?

    I'm programming in Visual Basic 6 to communicate between a computer and HP Measurement Devices (BER-Meter) with GPIB. I have already read information and code for this. My platform is W98. The NI488.2 commands can be sent without any problem between the equipements. However when I'm using the GPIBNotify ActiveX Control to use the callback function, there is a permanent starting and stop of the GpibNotify Sub. The SetupMask and RearmMask are set to RQS and the HP Device is well configured. Moreover an oscilloscope measuring the 10th line (SRQ
    ) of the bus didn't show any pulse on the line behalf the right one. Any Idea?

    Hello-
    So, the SRQ is not detected by the oscilloscope? It must be a setting that is not correct with the instrument. Try contacting the manufacturer of the instrument for details about SRQ's. The GPIBNotify ocx will not be able to react to an SRQ if there isn't one.
    Randy Solomonson
    Application Engineer
    National Instruments

  • Memory leak with callback function

    Hi,
    I am fairly new to LabWindows and the ninetv library, i have mostly been working with LabVIEW.
    I am trying to create a basic (no GUI) c++ client that sets up subscriptions to several network variables publishing DAQ data from a PXI.
    The data for each variable is sent in a cluster and contains various datatypes along with a large int16 2D array for the data acquired(average array size is 100k in total, and the average time between data sent is 10ms). I have on average 10 of these DAQ variables.
    I am passing the same callback function as an arguement to all of these subscriptions(CNVCreateSubcription).
    It reads all the correct data, but i have one problem which is that i am experiencing a memory leak in the callback function that i pass to the CNVCreateSubscription.
    I have reduced the code one by one line and found the function that actually causes the memory leak, which is a CNVGetStructFields(). At this point in the program the data has still not been passed to the clients variables.
    This is a simplified version of the callback function, where i just unpack the cluster and get the data (only showing from one field in the cluster in the example, also not showing the decleration).
    The function is passed into to the subscribe function, like so:
    static void CNVCALLBACK SubscriberCallback(void * handle, CNVData data, void * callbackData);
    CNVCreateSubscriber (url.c_str(), SubscriberCallback, NULL, 0, CNVWaitForever, 0 , &subscriber);
    static void CNVCALLBACK SubscriberCallback(void * handle, CNVData data, void * callbackData)
    int16_t daqValue[100000];
    long unsigned int nDims;
    long unsigned int daqDims[2];
    CNVData fields[1];
    CNVDataType type;
    unsigned short int numFields;
    CNVGetDataType(data, &type, &nDims);
    CNVGetNumberOfStructFields (data, &numFields);
    CNVGetStructFields (data, fields, numFields); // <-------HERE IS THE PROBLEM, i can comment out the code after this point and it still causes a memory leak.
    CNVGetDataType(fields[0], &type, &nDims);
    CNVGetArrayDataDimensions(fields[0], nDims, acqDims);
    CNVGetArrayDataValue(fields[0], type, daqValue, daqDims[0]*daqDims[1]);
    CNVDisposeData(data);
    At the average settings i use all my systems memory (4GB) within one hour. 
    My question is, have any else experienced this and what could the problem/solution to this be?
    Thanks.
    Solved!
    Go to Solution.

    Of course.....if it is something i hate more than mistakes, it is obvious mistakes.
    Thank you for pointing it out, now everything works

  • Application Builder, Callback function and ActiveX

    I have a software application which calls a callback function. This
    callback function talks to an Activex component. When I try to build
    an application.exe, the exe always hangs. Anyone know how to get
    around this? In the Labview developement envirorment it works just
    fine.
    -Chuck

    What is the ActiveX control that you're calling?
    Where in the execution of the code does the program hang?
    Can you post any of your code?
    What version of LV are you using? What version of Windows?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to use setTimeout for Callback function in ajax DWR?

    Hi,
    I am facing a problem of ajax request not returning back to the specified callback function. As a result my application screen gets locked waiting indefinitely.
    The timeout in DWR is controlled using a setTimeout method.
    Can someone plz tell me how to implement this in my javascript code so that my Callback function is invoked for sure.
    below is my code snippet...
    var dwrMap = new DWRMap(theMainForm);
         dwrMap['menuId'] = menuid;     
    CommonService.executeAutoLogOut(dwrMap, fnPerformLogOut);
    else{
         fnDoAnalyze(analyzeUrl);
    function fnPerformLogOut(response){
    if(response == "timedOut"){
         alert("Timed Out");
         fnAskToLogin();
    else{
         alert("Not timed out");
         fnDoAnalyze(analyzeUrl);
    Here CommonService.executeAutoLogOut(dwrMap, fnPerformLogOut); is sending ajax request.
    and fnPerformLogOut() is the callback function.

    Hi Shyam,
    Have a look at this,
    START-OF-SELECTION.
      gd_file = p_infile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = gd_file
          has_field_separator     = 'X'  "file is TAB delimited
        TABLES
          data_tab                = it_record
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
        IF sy-subrc NE 0.
          write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
          skip.
        endif.
    Regards,
    Sai

  • CALLBACK functions in cvi

    hi,
    Need a simple clarification on working with callback function.
    i have 3 different callback buttons function as start test, stop test, quit.
    Whenever Start test button is pressed by EVENT_COMMIT, it calls some functions and executes the same. in the middle of this function execution i need to stop the test by pressing stop test button or i need to quit the interface. How can i do this?
    i am facing problem like once i press the start button i am not getting controls to other button until the all functions available inside start button gets completed.
    Thanks in advance
    Solved!
    Go to Solution.

    The sleep (1000) and not calling ProcessSystemEvents () are the reasons!
    Sleep () completely blocks the program until the time has expired. It is advisable that you dont call it for long intervals!
    If you don't call ProcessSystemEvents () you cannot get stop button press
    Try modifying the code this way:
    int    requestToStop;    // Define this at module level
    int CVICALLBACK Btn_Start_Test (int panel, int control, int event,
      void *callbackData, int eventData1, int eventData2)
    switch (event)  {
     case EVENT_COMMIT:
       requestToStop = 0;    // Clear stop flag and start the test
       if (Tree_getselectedChilditems())
           MessagePopup ("Info", "Operator stopped the test!");
       else
           MessagePopup("Info","TEST COMPLETED SUCCESSFULLY");
       break;
     return 0;
    int CVICALLBACK btn_stop_test (int panel, int control, int event,
      void *callbackData, int eventData1, int eventData2)
     switch (event)  {
      case EVENT_COMMIT:
        requestToStop = 1;
    //  XL_KillWindowsProcess("EXCEL.EXE");//not exactly excel file,it may be any file which is running 
        break;
     return 0;
    int Tree_getselectedChilditems (void)     //double testcaseno)
     int noOfItems;int val,i;  //int index;
     int noOfChild,index=1;
     char treelabel[500]={0};
     char charval;char TCno[100];
     int select;  char testno[100]={0};
     double tini;
      for(error = GetTreeItem (panelHandle, PANEL_TREE, VAL_CHILD, 0, VAL_FIRST, VAL_NEXT_PLUS_SELF, VAL_MARKED, &index);
              index >= 0&&error<=0;error = GetTreeItem(panelHandle, PANEL_TREE, VAL_ALL, 0,
                    index, VAL_NEXT, VAL_MARKED, &index))
             GetTreeCellAttribute(panelHandle, PANEL_TREE,
                index, 0, ATTR_LABEL_TEXT, treelabel);
       Scan(treelabel,"%s",TCno);
       strcpy(testcaseno,TCno);
    //   Sleep(1000);     // Substitute this line with the following code
         tini = Timer ();
         while (Timer () - tini < 1.0) {
            ProcessSystemEvents ();
            if (RequestToStop) break;     // Operator stoo
       readTestcasesheet(ExcelWorkbookHandle, ExcelWorksheetHandle,testcaseno);
       Fmt(treelabel,"%s",""); 
       if (RequestToStop) break;     // Operator stop
      return requestToStop;
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Control Array Access Problem while loading panel on 2 Tabs

    I am using LabWindows CVI 10.0. My intention is to programmatically disable a control array in a panel.
    Problem:
           I am loading a panel with control array in TabControl pages -  Tab0 and Tab1.
    Error occurs, While programmatically accessing through below functions.
    GetCtrlArrayFromResourceID( Tab0_panel, CTRLARRAY) -  Able to get resource ID.
    GetCtrlArrayFromResourceID( Tab1_panel, CTRLARRAY) - Not able to get resource ID.
    Its giving error as Resource ID not found in UIR.
    Error picture i have attached below for reference.
    Please give some suggestions.
    Solved!
    Go to Solution.
    Attachments:
    Error.PNG ‏7 KB

    Ok, if you didn't use it so far you should use it now  : If you are accessing controls on a tab panel you have to use the correct panel handle using the function GetPanelHandleFromTabPage, you can not simply use the constant defined in your UIR.
    Have a look at the example TabExample.cws for an example of this function.

  • How to extract a cluster controls array in 8.2 PDA Module

    Hi Everyone,
    I'm in the process of porting an application from LV 8.2 to LV 8.2 PDA. The application relies
    heavily on using the controls[] property node which I just found out is not
    supported in LV 8.2 PDA. Does anyone know of any alternative method of
    extracting a cluster's controls array without using a property node?
    I've attached an example of the application.
    Thanks for your help,
    John.
    Attachments:
    Controls Property example.JPG ‏77 KB

    Hello Jon,
    Currently, there is now way to obtain a reference to a control inside a cluster in LV PDA. I have experimented a great deal with alternatives, but to no avail. However, I think you you may be able to accomplish the same behavior using just an unbundle, or just using explicit controls outside of a cluster. Hopefully we will have that functionality in a future version of LabVIEW PDA.
    Xaq

  • Callback function as soon as animation complete

    Hi all,
    My question is very straight forward:
    I would like to fire up a function as soon as a symbol has finished playing, and i would like to write the code in the stage event.
    Ive created a very simple exmple for the matter:
    I have two symbols each with a very simple animation taking them out of the screen, and each with a trigger on 0ms - sym.stop();
    I start rect1 animation in the stage event and i would like to call a callback function as soon as rect1's playback is complete.
    screensohts attached:
    I think a lot of people would like to see a sulotion to this issue.
    thank you!
    Asafg84

    Hi Anne, thank you for your reply
    I generate children of a symbol dinamically, in very large numbers. The symbols playing could be brothers (children of the same symbol) and i want only one of their animation complete to trigger a callback function,
    additionally in the child symbols there are a lot of sequences of animation (I play them according to certain events), and it doesnt make good practice that i call a function at the end of each sequence.
    putting all my code at stage level gives me the most control and its the best practice, and sometimes necessary. i should be able to do that.
    Have a wonderful day and thanks again for the answer!
    Asafg84

  • Updating a control array

    Thats all great guys! Thanks a lot....
    Just one last question... is it possible to update values held in a control
    array whilst a program is executing (other than manually!!), by loading them
    from a spreadsheet file?
    Cheers for any advice (As you see, I'm quite new to all this!)
    "Randy H" wrote in message
    news:[email protected]..
    > John,
    >
    > Sure. If the reading of the file is the first thing done in your
    > program, then this will be an easy task. That is how LabVIEW loads. It
    > stores a bunch of options in the LabVIEW.ini file. When LabVIEW first
    > launches, it parses this file ans starts LabVIEW with the correct
    > options. You would be doing something very similar.
    > Also, the way you are
    aproaching this is exactly what you would need
    > to do if you build your VI into an executable. See
    >
    href="http://pong.ni.com/public.nsf/websearch/BCFF7D3335E256E286256509006772
    3D?OpenDocument">this
    > as an example.
    >
    > Randy Hsokin
    > Applications Engineer
    > National Instruments
    > http://www.ni.com/ask

    Yes you can. There's a couple of routes you can go.
    1) LabVIEW has the function Read From Spreadsheet File in the File I/O palette. This will import a spreadsheet saved as comma or tab separated text data (not native Excel).
    2) Use ActiveX to read an Excel file. There's a shipping example called Write Table to XL that demonstratesm how to write to rows and columns. I've attached an example that reads a single cell. It's an example that I downloaded from somewhere I don't remember. Search the forum for other examples.
    3) Treat the spreadsheet as a database and use either NI database connectivity toolkit or LabSQL (http://jeffreytravis.com) to run SQL queries on it.
    Once you've read the data, it's then a matter of copying to the control by means of
    a local variable or property node.

  • How to write c wrapper it containing callback functions

    hi here shambhu below call can be containing some call back functions ,how can create wrapper for this,please suggest me
    _export int GDSRegisterStation(char *sPort, char* sPanel, int iStation, GDSCallback lpGDSTaskCall); /*
    This call hooks up user application onto the GDS environment. From this point on, the GDS application has continuous, concurrent access to the virtual machine representing the test system. As multiple independent test systems may be hooked onto the same host computer, the call needs to specify a "Port" (unsigned uPort) to which GDS memory access is sought. Character string sPanel (up to 63 chars) identifies the calling GDS task to the Virtual Machine. This entry will assist the System Manager in monitoring active GDS tasks by their assigned names. As multiple test stations (each with one or more control channels) may be associated with the same controller, (int) iStation specifies the station to which this application will be connected. (GDSCallback) lpGDSTaskCal specifies the subroutine in the user application that is to be installed as the real-time callback into the Virtual Machine. From this moment on, the specified subroutine will be automatically called by the Virtual Machine to periodically All subsequent calls to the GDS library will apply to this Station and its control channels. This call is made only once and prior to other GDS calls. 0 is returned upon normal completion -1 is returned if the call was a failure due to absence of GDS space associated with the call. Make sure station is connected and On-Line and make sure Port No was correct in the call -2 is returned if the application was already registered by a previous call

    You will have to write a wrapper DLL in C which converts the callback event into a LabVIEW compatible event. The most versatile way would be to generate a user event with the PostLVUserEvent() LabVIEW manager function. Callback functions are however an advanced C programming construct, so you should definitely have a pretty decent understanding of C programming before starting this endeavour. Otherwise you end up with a not working solution or maybe even worse, one that seems to work sometimes but doesn't really do the right thing.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for