Quantcast
Channel: LabWindows/CVI topics
Viewing all 5361 articles
Browse latest View live

Calling DLL in CVI2013

$
0
0

Sorry for this basic question but I am not very familiar with external DLL's...

 

I have some older code where I used

 

typedef void ( __stdcall *fp_SPNDLdllTYPE )( double *, double *, double *, double *, long *, char *, long );

I need this to assign the address of a function in the DLL using LoadLibrary and GetProcAddress.

 

Everything was fine until I recompiled this code with CVI2013,.the address obtained now is zero... ?

 

Since the compiler has changed I tried both default calling conventions in the Build options, but it did not help...

 

What do I need to change? Thanks!


Qsort issue with CVI 2012 in 64 bit mode

$
0
0

Possible CVI 2012 64 bit bug.

 

Qsort returns very slowly in CVI2012 in 64 bit release mode. Not sure if there are memory leaks or if function actually returns the correct answer as I fixed the problem before going back and isolating the issue to the code supplied. The issue seems to be resolved in CVI 2013.

 

In the example provided, an array is created, seeded, and sorted. Approximate timing results (with a chi by eye averaging) are given below for an array of 1e6 double values.

 

CVI 2012

 

32 bit debug                         32 bit release                                       64 bit debug                                    64 bit release

4.5 seconds                         0.32 seconds                                       4.3 seconds                                     44.0 seconds

 

CVI 2013

 

32 bit debug                         32 bit release                                       64 bit debug                                    64 bit release

2.8 seconds                          0.22 seconds                                      2.0 seconds                                     0.18 seconds

 

 

 

SQL Toolkit does not work when migrating from CVI9.0 to CVI2012

$
0
0

Hello

 

I have a monitoring software developed in LabWindows CVI version 9.0.  Software is complex and composed of different threads, instruments, activeX and SQL toolkit commands.  When releasing new versions, I ussualy build a realease .EXE and replace it in program folder.

 

Software is running in 71 machines that are in production so I cannot perform long maintenance stops.  

 

I want to upgrade it to CVI2012.  I created a new distribution and Installed it in a new PC and it is working OK.

 

However I also want to run it in old PCs with CVI9.0 installation (by replacing the exe file, so I avoid to perform a complete installation) .  

 To allow this I downloaded and Installed Run-Time Engine 2012 in that machines and the software seems to work well.

 

However I realize that SQL toolkit commands are not working at all.   Any ideas?

 

Thanks for your help

Ectron 1140A, USB Control....

$
0
0

Hi,

 

We have an Ectron 1140A, Thermocouple Simulator-Calibrator, with USB control.

 

I see there is LabView drivers, do you know is there anything for CVI?

 

Using the USB interface and MAX, Ver 5.4, I was able to show some simple commutation with the 1140A.

 

Any thoughts as how best to develop control with CVI?

 

Thanks

Simon

x64 distribution not working

$
0
0

I made a setup of an x64 application and installed it on another pc (Windows 7 x64), but it isn´t working. It can´t start and Windows gives me the error code 0xC000007B. The Problem is that there was already an x86 installation of the cvi runtime and this one is also needed by other applications on this pc.

 

So after I installed an x64 application there should be a x64 cvi runtime!?

 

What can I do to solve this problem?

x64 release not working

$
0
0

I develop an x64 application, which uses a SQL database and it works in debug and release, if I start the application from cvi. The application does not work (I get "Automation error code -2147024809 0x80070057 invalid parameter.") if I start it from outside if Windows, e.g. by starting it from the explorer.

 

Did anyone else have such a problem? And how to solve it?

Multithread mouse cursor issue

$
0
0

I have noticed a bad behavior of SetMouseCursor function when used in multithreaded programs.

 

I've written a simple program to demonstrate it (the full project is in the attached zip).

sshot-1.png

Pressing the Start button an asynchronous timer is started and the "hourglass" cursor is shown.

 

                case PANEL_CMD_START:
                    SetMouseCursor (VAL_HOUR_GLASS_CURSOR); 
                    SetCtrlAttribute(panel,PANEL_CMD_START, ATTR_DIMMED,   1);
                    SetCtrlAttribute(panel,PANEL_LED,   ATTR_CTRL_VAL, 1);
                    hTimer = NewAsyncTimer (3.0, -1, 1, OnTimer, 0);
                    break;

 

If you leave the mouse stationary, when the timer fires after three seconds, the cursor will be still shown as hourglass until the pointer is moved: this is because the function SetMouseCursor (VAL_DEFAULT_CURSOR) is executed by the asynchronous timer thread.

 

If the checkbox "main thread" is checked, the function SetMouseCursor will be executed in the context of the main thread of the application and in this case the mouse cursor will be updated immediately.

 

        GetCtrlVal(panel, PANEL_CHK_WA, &UseWorkaround);
        if (! UseWorkaround) {
            SetMouseCursor (VAL_DEFAULT_CURSOR);    // call in Asynchronous Timer thread
        }
        else {
            PostDeferredCall (DeferredCB, 0);       // call in main thread
        }
....

static void CVICALLBACK DeferredCB (void *callbackData)
{
    SetMouseCursor (VAL_DEFAULT_CURSOR);  
}

 

 

network exist function & UIEIOError

$
0
0

Well, just when I thought I was out of the woods, I have Ini_WriteToFile errors again.  My app runs in a network environment.  You can read about my first run-in here.  That time, it was all about the instrument driver's temp file, and the other client computers trying to overwrite each others' file.  The error then was UIETooManyFilesOpen.

 

And now, all of a sudden, it's UIEIOError (Input/Output error).  Why?  What changed?  Not much on the topology end.  I've added a bunch more client machines to this same network, none of which have access to the destination directory that my INI driver is trying to write to.  And even more troubling, when we are getting these errors, it is bringing down the entire application.  I have the ConfigCVILogging.exe tool running on all my client machines to try to catch any other errors, but the most I see are some TCP/IP things.

 

So in the interest of fixing this soon, I'm entertaining a different writing scheme. Now I want to copy the file from the server, do all the editing and writing locally, then at the end copy it back to the server with a CopyFile.  This way, I have the best possible scenario for successful INI writing, and minimize the amount of network access by several orders of magnitudes.

 

The critical step in my app is to gaurantee that locally I have the most recent copy of the server's INI.  So at the beginning of this process I do this:
 

serverStatus = FileExists(serverFileName, 0);

FileExists gives either True, False, or (presumably) FmtIOErrType.  In a test, I yanked my ethernet cord and attempted the function call but simply got a 0, because the mapped network drive didn't resolve.  This is a problem.

 

Is there such thing as a PathExists function?  I need to know, at the time of reading the latest INI file and the time of writing my local copy back out, that the network connection is good.  I saw this post, but it doesn't look quite what I'm after.


Multiple user access to files with Formatting and I/O Library

$
0
0

 

I'm developing a data-logging application using LabWindows/CVI 2013.


This is for a life test that will run for 2 years uninterrupted.
It will save data at a rate of about 20 bytes once per second.
I figured the app would open, write, close every sample.


I would like to keep the data logging application simple and build some sophistication into a separate application for analysis and progress tracking.

I'm thinking about using the file access functions in the Formatting and I/O Library.
OpenFile, CloseFile, ReadFile, WriteFile etc.

 

My question is:
Using this library, will the analysis application be able to be used by multiple users to open the log data file for reading and analysis while the logging continues?
I plan to put the log file on a network drive that is accessable throughout the company.

No writing to the log file will be allowed.

 

Also would like the logging app to periodically copy the log file to a backup.  Again this is while logging continues.


Thanks,
Kirk


 

Differences between OnboardClock and SampleClock

$
0
0

Hello,

 

what is the exact difference between OnboardClock and SampleClock as clock source for 6024E device?

 

Greetings,

chemph

Using Traditional DAQ for NI USB 6509 (Digital I/O)

$
0
0

Hi all,

I am trying to port an old Program (written in CVI 5.5 using Traditional DAQ for a PCI DIO card) to new Hardware (NI USB 6509) and OS (Windows 7 enterprise, sp1). As I'm new with LabWindows/CVI using old drivers seems to be the fastest way. Unfortunately I can't find any TDAQ driver for windows 7.

 

I tried this one: http://www.ni.com/download/traditional-ni-daq-legacy-6.9.3/860/en/

but the install wizard tells me it wouldn't do with win 7.

 

So is there any way to get these old drivers working on windows 7? Or is it easier to go through all the source code, which is 13 *.c files with 500 to 3000 lines each trying to find the relevant functions and commands?

 

rd

 

PS: I work with CVI2013

self programmed pre- and post trigger

$
0
0

Hello,

 

I am planning a measurement system and search some ideas for programming how to realize it.

 

I have an older NI PCI-6024E and want to measure 8 voltage signals with 2 kHz. When task is started it should run some hours without task stop.

 

Every 2000th sample (= every second), I want to store this sample (all 8 voltages) into a continuous file with printf.

 

For this I do not need the sampling rate of 2 kHz, 1 Hz would be enough but I want to do more:

 

Every time when voltage_1 increases over 1.1 V, I want to store all data – and 100 samples before– with 2 kHz into an other file till voltage_1 decreases under 0.9 V – and 100 samples after–. It will be like a self programmed pre- and post trigger with continious running measurement task.

 

I think I can work with an fifo-buffer (double fifo[10000 samples][8 channels]) but do not know how to do this on a smart way ;-)

 

Do you have any ideas how to mange it?

 

chemph

Does a CVI 2013 product installer support integration into Visual Studio 2012?

$
0
0

Hi all,

 

I determined that the latest release of TestStand 2013 supports Microsoft Visual Studio 2012:

http://zone.ni.com/reference/en-XX/help/370052M-01/tshelp/infotopics/2013whatsnew/#VSSupport

 

...and of course, the latest Measurement Studio 2013 supports Visual Studio 2012 as well:

http://www.ni.com/mstudio/

 

But does the latest CVI 2013 product installer support integration into Visual Studio 2012, or is it still expect that Visual Studio 2010 should be resident, before installing CVI 2013, so that it will integrate into that version instead?

 

JB

cvi use of visa library creating a server/instrument

$
0
0

I was looking for an example of using the visa library in CVI, to create a TCP server within a thread to allow the thread to look like an instrument to another application already running on the system communicating with instruments connected to the system. This other application is a LabView interface that connects with instruments by the use of 'visa' connections, and we have another application being developed on the same system in CVI that we would like to connect to the LabView application using that 'visa' connectivity. The thought is that the LabView app recognize the CVI app as an instrument and connect to it on the fly.

Always getting "Invalid Argument" error on CNV functions

$
0
0

Hallo,

I'm quite new to LabView/LabWindows/CVI. I'm trying to create a very simple C++ application that will exchange Network Shared Variables with a LabView VI.

But no matter which function I call, I always get the error "Argument is invalid". For example when creating a browser to browse for available variables:

 

int _tmain(int argc, _TCHAR* argv[])
{
  CNVBrowser* browser = NULL;
  int retVal = CNVCreateBrowser(browser);

  if(retVal != 0)
  {
    const char* error = CNVGetErrorDescription(retVal);
    std:: cout << error;
  }//end if

  if(browser != NULL) CNVDisposeBrowser(*browser);

  return 0;
}

 This gives me a return value of -6393 which means "Argument is invalid".

I suppose there is something very basic I'm doing wrong. Can anyone help me out?

 

Thanks!


Too slow cycle time when using network variables

$
0
0

Hi there!

One the one side I have a LabView VI. In that VI a value is set to a shared network variable. This happs in a while loop with no extra delay.

Thus this should run at maximum speed (and my machine is pretty fast) ;-)

 

On the same machine I have a C++ application using the CVI library functions. This application has registered a simple data-callback for the same shared network variable using "CNVCreateSubscriber".

 

What I expected was that the callback would be called pretty often (every 1ms or faster).

The strange thing is: the updates come in EXACTLY every 10ms. Even when I change the number of transferred and subscribed variables from 1 to 100 the 10ms don't change. This seems to be somewhat slow...

 

So I guess there is some kind of bottleneck limiting the transfer rate.

  • Could it be the LabView VI?
  • Or maybe the configuration of my network variables?
  • Or the C++ application (do I need to do some some special configuration via the CNV functions)?
  • Or some hardware/software problems on my computer?

Thanks!

Does Coverity Support the LabWindows C Compiler?

$
0
0

Does the Coverity tool support the LabWindows C Compiler?  It appears that it does not.  Here is the list of compilers that Coverity claims to support:

 

ARM
Cosmic C Cross Compilers
Freescale Code Warrior
GNU GCC, G++
Green Hills
HP aCC
IAR
IBM, XLC
Intel C++
Keil
QNX
Renesas
Sun (Oracle)CC and cc
Texas Instruments
Visual Studio
WindRiver
Xcode GCC and G++

0xC0000005 Access Violation in cvirte.dll (SetWindowsErrorMode?)

$
0
0

Hello,

 

We will occasionally see a crash with our CVI LabWindows based 2010 SP1 application, a 0xC0000005 Access Violation exception thrown from within cvirte.dll. The app is working primarily from a spawned thread when the crash occurs. I've been able to get it consistently on a Win7 x64 VirtualBox VM and have some data that may be of use if someone there would like to investigate.

 

When I track down the location of the instruction pointer (work below) it seems to be in the "SetWindowsErrorMode()" function (at least going by the exports in DependencyWalker):

 

1. The IP is 0x687B5F1C at the time of the crash.
2. The base module address for cvirte.dll is 0x68420000, so the IP is 0x395F1C bytes into the DLL.
3. Using DependencyWalker on cvirte.dll and sorting by entry point indicates that the IP is inside of "SetWindowsErrorMode()" at 0x003938D0, which comes before "MinimizeAllWindows()" at 0x003984B0.

 

Coincidentally, this crash happens in CVI 2013 F1 as well, the offset within "SetWindowsErrorMode()" is a bit different (0x264C past entry in 2010 SP1, 0x2D0C past entry in 2013), but locally the code looks the same in my VS2010 disassembler:

 

CVI2010 SP1

 

*Address *Code Bytes          *Instruction
687B5F02 89 17                mov dword ptr [edi],edx
687B5F04 8B 48 5C             mov ecx,dword ptr [eax+5Ch]
687B5F07 89 78 6C             mov dword ptr [eax+6Ch],edi
687B5F0A 89 4F 04             mov dword ptr [edi+4],ecx
687B5F0D 89 58 5C             mov dword ptr [eax+5Ch],ebx
687B5F10 C7 40 60 00 00 00 00 mov dword ptr [eax+60h],0
687B5F17 5E                   pop esi
687B5F18 85 DB                test ebx,ebx
687B5F1A 74 09                je 687B5F25
687B5F1C 8B 13                mov edx,dword ptr [ebx] <--- CRASH


CVI2013 F1

 

*Address *Code Bytes          *Instruction
687CA2B2 89 17                mov dword ptr [edi],edx
687CA2B4 8B 48 5C             mov ecx,dword ptr [eax+5Ch]
687CA2B7 89 78 6C             mov dword ptr [eax+6Ch],edi
687CA2BA 89 4F 04             mov dword ptr [edi+4],ecx
687CA2BD 89 58 5C             mov dword ptr [eax+5Ch],ebx
687CA2C0 C7 40 60 00 00 00 00 mov dword ptr [eax+60h],0
687CA2C7 5E                   pop esi
687CA2C8 85 DB                test ebx,ebx
687CA2CA 74 09                je 687CA2D5
687CA2CC 8B 13                mov edx,dword ptr [ebx] <--- CRASH

I have dump files (mini, or mini+heap) for both builds if it would help.

 

This bug seems semi-similar to the thread "Is InstallPopup not threadsafe?":

http://forums.ni.com/t5/LabWindows-CVI/Is-InstallPopup-not-threadsafe/m-p/716822/highlight/true#M35963

 

Just for posterity, I'll add the data for the 2013 build. IP is 0x687CA2CC, DLL Module address is 0x68420000-0x68A28000, so offset is 0x3AA2CC. "SetWindowsErrorMode()" enters at 0x003A75C0 in this dll, and "MinimizeAllWindows()" is at 0x003ACB20.

 

Thanks-
Baker

ADE does not remember screen size

$
0
0

Hello,

 

Windows 7 provides the possibility to maximize windows by moving the upper/lower window bar to the upper/lower screen border. This works even for CVI :smileywink:

 

If I have the environment option 'Hide windows when application is running' selected, after closing the application and returning to the source code window it turns out that CVI does not honor/remember the screen size, i.e. the CVI window size is not maximized any longer :smileyfrustrated:

 

If possible, I'd prefer to have it fixed :smileywink:

 

Workaround is to not to use an automatically maximized window... manually adjusted window sizes are remembered.

how to start two or more tasks at the same time?

$
0
0

Hi all,

  I have few tasks setup to send analog and digital output to different channel with buffer and given sampling rate. I need to precisely control the timing of samples output to each channel. But if I start the task in labwindows

 

    DAQmxStartTask(taskHandle1)

    DAQmxStartTask(taskHandle2)

    DAQmxStartTask(taskHandle3)

 

they actually not start at the same time since they are exectued in sequence. I wonder how much time delay will be if I start each task in sequence. Also, is it possible to have 2 or more tasks started at the same time?

 

p.s. I think it will be easier if I could bind different channels to a single virtual channel but I don't think it is possible to create a signle virtual channel with analog channel and digitial channel.

Viewing all 5361 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>