ScanFile function in CVI 9.0.0

Hello,
I use ScaFile function to read binary file that exists floating points array. My file have a 1601 points (double).
The function works properly in CVI 8.5.1. When I upgrade to new version CVI 9.0.0, the function return wrong index number.
I use ScanFile(FileHandle,"%*f[i*]>%*f",2,479,2,&value); According this format I expect to receive the 479 index point in a file.
Despite this, I get an index 0.
I check this function in few different indexes, and every time i receive the point in index=0.
Is it possible that I wrote (in format value in the function )is not true?
Best Regards,
Boris.
Best Regards
Boris

Hi Boris,
It looks like the function may have changed slightly from 8.5 to CVI 9.0
If you look at the documentation on the ScanFile function, found here:
http://zone.ni.com/reference/en-XX/help/370051M-01/cvi/libref/cviscanfile/
it looks like some of the formatting for the string formatting parameter and the target parameter have changed compared to what you are using. I would recommend looking over the documentation as it does not appear to have chanved since CVI 9.0 but is the format we are using now for this particular method.
Regards,
James W.
Applications Engineer
National Instruments

Similar Messages

  • 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?

  • Transfer Function with CVI 5.0

    Dear Sir/Madam,
    Let me first introduce myself. I am a Telecomunication Engineering student
    from Spain workimg on a project based on Labwindows/CVI and the data adquisitionscard
    PCI 6024E.
    In this project I have to calculate the transfer function of a network
    under test, and I would like to display the amplitude and phase in frecuency.
    I just got to display the window spectrum so far (mainlobe and sidelobes),
    and I would like to display the amplitude and phase spectrum as a Bode Diagram.
    To develope this project I am using the Advanced Analisys Library and the
    function Transfer Function.
    I would really appreciate your help in the following matters:
    a) How can I display the transfer function as a Bode Diagram?
    b) What
    stimulus do I have to generate for a band width (2KHz)?
    c) What window do I have to use?
    I am grateful for your attencion and I will be working forward to hearing
    from you.
    I would also appreciate if you could send me an application example.
    Yours sincerely .
    Carlos Gutierrez Castellano
    e-mail:[email protected]

    Do a web serch for TVichw32, it's a small DLL/VXD the you can compile easily
    for CVI that does just that (I use v2.0).
    Guillaume Dargaud
    CNR/IFA
    http://sung3.ifsi.rm.cnr.it/~dargaud/
    http://sung3.ifsi.rm.cnr.it/~domec/
    http://sung3.ifsi.rm.cnr.it/~chooyu/
    "The church is near, but the road is icy. The bar is far, but we will walk
    carefully." - Russian Proverb.

  • Multithread functions in CVI

    Hi,
    i wan to use SuspendThread function in my project but i can`t.
    adding windows.h dooes not solve the problem,
    i use labwindows cvi of version 9.0.1
    thanks for any help.

    What does it mean you can't? Did you get some compile, link or execution error? Do you have a multithreaded application up and running and SuspendThread only is giving you problems? Which thread do you want to suspend?
    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?

  • How to get parameter information on DLL function call (CVI) in TestStand?

    Hi,
     I wrote a simple Instrument Driver in CVI, and it has 3 parameters Voltage, Current, Channel.
    I made a DLL in order to call this function in TestStand as an action.
    That works fine, the only problem I have is that it shows my function as DC_Conf (arg1, arg2, arg 3) and I only get the type information like double double int.
    I do not get the parameter names Voltage, Current, Channel...
    How can I get this information to be displayed in TestStand so I know which parameter arg 1-3 is Voltage,Current,Channel in case I forgot?
    or 
    Is there a way to display the help text of the driver in TestStand?
    I tried clicking on the (?) button next to the function call but it did not do anything...
    My TestStand is version 4.1
    Thanks...Ness

    Ness,
    When TestStand populates the parameter information, it does so by looking at the dll's type library.  CVI automatically creates a type library for a dll based on the function's signature, which can include the parameter names.  However, if the function prototype does not contain variable names, then CVI cannot include names in the type library.
    You can define your own type library to directly control the information available to TestStand from your dll.  If you want to define your own type library, you can do so using a .fp file.  This will allow you to use complex data types (such as structs), and to rename your parameters.
    Here's a KnowlegeBase describing the process: Embedding Type Libraries in a LabWindows/CVI DLL for use in TestStand
    Either solution proposed here will work, and they each have tradeoffs:
    You can definte the variable names in the function prototype.  This keeps the functions self-documenting, and is the easiest solution.
    You can create a .fp file and define your own type library.  This allows you the most control over exactly what you will see in TestStand, but requires you to create a new file, and to keep that new file up to date if you make any changes to your source code.
    Message Edited by Josh W. on 12-11-2009 01:08 PM
    Josh W.
    Certified TestStand Architect
    Formerly blue

  • CPU Load function CVI

    Is there a function for CVI for getting the CPU load and memory usage from a Real Time Controller?

    Hello -
    There's not a function available in CVI for getting this information.  However, if you have LabVIEW 2009 RT or later installed on your development computer, you should be able to install the System State Publisher to the real time target.  This will create network variables on the real time target that you can subscribe to to obtain this information.
    This component will not be available without LabVIEW RT until CVI's next major release.
    NickB
    National Instruments

  • CVI XML Functions Execution Times Increase When Looped

    I have written multiple functions using CVI that read XML files. I have confirmed in the Resource Tracking utility that i have cleaned up all of my lists, elements, documents, etc. I have found that when I loop any of the functions I have created, the execution times increase. The increase is small but it is noticable and does effect my execution.
    Are there any other sources of memory that I need to deallocate? It seems that there is a memory leak somewhere but I am unable to see where this increase is located.
    I am currently running LabWIndows/CVI 2009 on Windows 2008 Server. I have looped my functions using TestStand 4.2.1. Any help would be appreciated!
    Thanks in advance,
    Kyle
    Solved!
    Go to Solution.

    HI Daniel,
    Thanks for the quick response.
    It is indeed slow down in execution speed when we loop. When looped, the XML reader is overwriting variables, not adding to an array. Our application is structured differently than my test case. We run a CVI function from TestStand that contains a series of commands, which contains the XML reading. The XML looping is really done in CVI. I used TestStand in my test case just to get execution times. Our psuedocode for the CVI function is as followed:
    For loop (looping over values, like amplitude or frequency)
    Reading the XML
    Applying the data from the XML to set up some instrument(s)
    Do something...
    End loop
    I can confirm that the instrument set up is not the cause of the slow down. We have written the same XML reading in C# and applied the values to the instrument setup and do not experience the slow down.
    I tested with On-The-Fly Reporting enabled and the execution time continued to slow down.
    I hope that answers all of your questions!
    Thanks,
    Kyle

  • Return of void functions inconsiste​ncy between CVI 2013 and older

    Hello,
    I have discovered an inconsistency using CVI 2013 (SP2 or not) compared to CVI 2010 and CVI 8.5 (the versions I have).
    I have written, by mistake, a code where I'm returning a value for a void function. CVI 2013 does not complain (but should) while other CVI versions complain (and that's OK).
    Here is the code:
    static void pouet(void)
    return;
    static void hop(void)
    return pouet();
    int main(void)
    hop();
    return 0;
    Could this behaviour be fixed for the next CVI update ?
    Thanks.
    Frédéric Lochon.

    Well it's technically not causing wrong behaviour, but may cause less than best performance depending on the compiler code generation as the register usually used for function return values might be assigned some garbage value that never will get used though.
    Causing an error is likely a bit strict, issueing a warning would be the prefered behaviour, not generating either a warning or error is a bit lazy. Problematic would be if you could write this without getting an error:
    static void pouet(void)
    return;
    static int hop(void)
    return pouet();
    int main(void)
    hop();
    return 0;
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Compiling CVI project with low-level input/outp​ut function under VC++

    when compiling I get:
    MIN69101.OBJ : error LNK2001: unresolved external symbol _read@12
    MIN69101.OBJ : error LNK2001: unresolved external symbol _write@12
    MIN69101.OBJ : error LNK2001: unresolved external symbol _lseek@12
    Release/minil.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.
    minil.exe - 4 error(s), 0 warning(s)
    I think I need some libs.
    Who tell me what .lib I need?

    When you convert your existing CVI project, all external libs add automatically, you can see it in Project->Settings->Link.
    But they don't include low-level in/out function.
    If you use Dependency Walker you can see these functions in cvi-lvrt.dll, but not in cvi-lvrt.lib

  • ScanFile with scanning string modifier %s[in]

    For skipping over non-numeric characters by reading ASCII files I used to write, e.g.
    ScanFile (fhandle, "%s[i8]>%f", &x);
    This method works well with CVI 5.0 to 8.11 but no more with CVI 2009 and 2010.  I have modified my old code using other scanning string modifiers:  
    ScanFile (fhandle, "%s>%s[dt#]%f", &x);    or  
    ScanFile (fhandle, "%s>R1= %f", &x);
    The first one does not work with a string like “R1=200”.  The second requires the exact string and is more inconvenient.  Although the modified code works well now with CVI 2009, I would like to know why the scanning string modifier [in] does not work with CVI 2009 and 2010. Is there something wrong in my code, is it a feature of the new versions of CVI or is it a bug? How about CVI 2013?    

    Thank you very much for your reply.
    I would not use "%s[i8]>%f" to read the number 200 in string "R1=200".  I just wanted to take this string as an example to say that I couldn't simply change all of  "%s[in]>%f"s  in my code to  “%s>%s[dt#]%f"s, somewhere I had to use a quite inconvenient "%s>R1= %f". Therefore I do hope that "%s[in]>%f" works by a new version of CVI.
    In my code I use a lot of Scan (string, "%s[in]>%f", &x) and all of them work always correctly, also with CVI 2009-2010. But none of ScanFile (fhandle, "%s[in]>%f", &x) works with my CVI 2009, they work only with earlier versions.. That’s very strange to me as I couldn't find in the documentation/Help of CVI 2009-2010 a description that "%s[in]>%f" should not be used with the ScanFile function,
    My further tests showed that this problem seems to be related to CVI Run-time.  By reading the same ASCII file, the same executable created by CVI 8.11 works with CVI Run-time 8.1 but does not with Run-time versions 9.0 to 10.0.1.419.

  • How to Load a Panel during run time from a CVI dll

    Hi,
    I want to execute/load a panel during runtime, from a CVI dll function.
    my CVI dll "test.dll" has "READ_PAN" function. while executing this function from a Test Stand Action step i want Configure Panel (from FR_GUI.uir) to pop up.
    can you please suggest me how can i do this from my "test" project of CVI.
    int __stdcall __export RunFRConfig (CAObjHandle step,CAObjHandle thisContext)
        ERRORINFO errorInfo;
        char errMsg[1024];
        int pan;
        pan = LoadPanelEx (0, "FR_GUI.uir", READ_PAN, __CVIUserHInst);
        DisplayPanel (pan);
        RunUserInterface();
        DiscardPanel (pan);
        return 0;
            Error:
       // sprintf(FinalErrMsg,"Configure Error: %s",errMsg);  
        return -1;

    Thanks for ur reply.
    Hello Asad,
    It is possible to maximize the run time previewer when calling reports from forms. U need to set a parameter named 'MAXIMIZE' to do that.
    I m attaching a code sample for u. This is working in my production environment.
    DECLARE
    pl_id ParamList;
    BEGIN
         pl_id := Get_Parameter_List('setProposal');
         IF NOT Id_Null(pl_id) THEN
              Destroy_Parameter_List( pl_id );
         END IF;
         pl_id := Create_Parameter_List('setProposal');
    // This parameter is set to hide parameter form at run time     
         Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
    // This parameter is used to maximize previewer window at run // time
         Add_Parameter(pl_id, 'MAXIMIZE', TEXT_PARAMETER, 'YES');
    Run_Product(REPORTS, 'sample.rep', SYNCHRONOUS, RUNTIME,
    FILESYSTEM, pl_id, NULL);
    END;
    Feel free to contact me if u need anymore assistance.
    Take care and bye

  • Like Ini related functions, is there any functions for reading other functions like .c, .h file

    Hi,
          For reading the *.ini file there are many Ini realted functions. Like that I need in built function in CVI to read the files like
    *.c, *.h line by line. Actually string searching function is not helping me as I want to read it line by line and perform
    the operations in which I am interested.
    Can anyone help me on this?
    Thanks and Regards
    Nagraj B

    It's not clear to me what you are aiming to, but reading a text file line by line can be accomplished by ReadLine () function.
    Parsing the line read to intercept special keyword can be done via regular expression instrument driver, which is included in CVI distribution.
    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?

  • How to compact and repair a MS Access database with NI CVI 8.5 (and SQL Toolkit)

    Hello
    I'm using the SQL Toolkit with CVI 8.5 for accessing MS Access Databases.
    Is there a possibility to compact and repair the .mdb file with  CVI?
    Thanks in advance.

    Hello Ulrich,
    with compact and repair I mean the MSAccess function "Compact and Repair".
    Please follow the link below for more details:
    http://office.microsoft.com/en-us/access-help/compact-and-repair-an-access-file-HP005187449.aspx
    Normally you can execute this function directly in Access or with the Windows ODBC Data Sources Administrator  => "Control Panel" => "Administrative Tools" => "Data Sources (ODBC)"...
     I want to execute this function via cvi code and not by hand ;-).
    Thank you for your support.
    Frank

  • OPC UA in CVI

    Dear CVI experts!
    What do you recommend to connect to an OPC UA server ?
    I already asked the NI technical support and the response was, at present it would be the best to use a third party product ...
    Do you have any other suggestions ? I was used to use the functionality of CVI for "classical" OPC (and Netvars and Datasocket and ...).
    It was so easy ...

    Dear Matijas,
    thank you for your replay!
    First thing is: It was about LabWindows/CVI - so I think VIs is in LabView - isn't it ?
    I tried the "classical" approach, but I don't even have the possibility to select URL etc. because "OPC UA" is not COM based. It's a complete different technology.
    Best Regards,
       Tom

  • How can I pass a variable from Test Stand to CVI by reference

    Hi!
    I can't to pass numeric or boolean variable from Test Stand (for example: FileGlobals.StopFlag) into the step (CVI function).
    Function prototype: 
    void __declspec(dllexport) __cdecl PC2_WaitWhileResponceAppear(tTestData *testData, tTestError *testError, int *iStopFlag).
    When variable has bin changed I can't see this change from my function.
    CVI 2010, Test Stand 2010
    Can anybody help me?

    Hey Rombar,
    It is certainly possible to pass variables by reference; for example, if you go to <TestStand Directory>/Examples/Demo/C and open the computer.seq file, you can see one of the example sequences that uses CVI modules. If you click on one of these steps, you'll see that some of the parameters, such as the error information, is passed with pointers. This is a pass by reference.
    To help narrow this down, it'd be good for us to figure out a few things about how the code is run. First, if you go to Configure > Adapters, select the CVI adapter and choose Configure, you can see options for this adapter. Do you have it configured to run in an external instance of CVI or as an in-process call?
    Also, if you're wanting to see a change made in TestStand in your external code, this makes me think that you're wanting to run the code and then continue to execute your TestStand sequence while the code runs. How did you configure this behavior? For example, are you calling this code as a separate sequence in a new thread, or are you using another method to run this code while the sequence continues to run?
    Finally, if we could see a screenshot of how you're configuring the parameters on the TestStand step, that might be helpful as well.
    Daniel E.
    TestStand Product Support Engineer
    National Instruments

Maybe you are looking for