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

TaskHandle limit

$
0
0

Hello,

I am converting a nidaq 6.9.3 version-based program into DAQmx 9.5.5f4 version using CVI 2012.
The program moves the light detector using a stepper motor and reads the light detector output at various points on a linear stage.

Old program worked well with some homemade hardware that were controlled by NI PCI-1200 DAQ card in Dell Precision 390.

My new hardware is NI PCIe-6321 in Win 7 HP Z210 computer. None of the other hardware is changed. To save time, I used a strategy to combine many DAQ processes in a one function called Configure(). Here is how it was written in Configure() function:
----------------------------------------------------------------
// taskHandle1 - to read Port 0 (motor data)
DAQmxErrChk (DAQmxCreateTask("",&taskHandle1));
DAQmxErrChk (DAQmxCreateDIChan(taskHandle1,"Dev1/port0", "",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxStartTask(taskHandle1));

 

// taskHandle2 - to read Port 1 (motor limit data)
DAQmxErrChk (DAQmxCreateTask("",&taskHandle2));
DAQmxErrChk (DAQmxCreateDIChan(taskHandle2,"Dev1/port1", "",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxStartTask(taskHandle2));

// taskHandle3 - to read/write Port 2 (for control pulses)
DAQmxErrChk (DAQmxCreateTask("",&taskHandle3));
DAQmxErrChk (DAQmxCreateDIChan(taskHandle3,"Dev1/port2", "",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxStartTask(taskHandle3));

 

// taskHandle4 - PC0/P2.0 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle4));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle4,"Dev1/port2/line0","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle4));

// taskHandle5 - PC1/P2.1 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle5));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle5,"Dev1/port2/line1","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle5));

// taskHandle6 - PC2/P2.2 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle6));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle6,"Dev1/port2/line2","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle6));

// taskHandle7 - PC3/P2.3 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle7));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle7,"Dev1/port2/line3","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle7));

// taskHandle8 - PC4/P2.4 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle8));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle8,"Dev1/port2/line4","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle8));

// taskHandle9 - PC5/P2.5: !OE Low = 0, Hi = 1
DAQmxErrChk (DAQmxCreateTask("",&taskHandle9));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle9,"Dev1/port2/line5","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle9));

// taskHandle10 - PC6/P2.6: Clear UP/DN Counter
DAQmxErrChk (DAQmxCreateTask("",&taskHandle10));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle10,"Dev1/port2/line6","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle10));

// taskHandle11 - PC7/P2.7
DAQmxErrChk (DAQmxCreateTask("",&taskHandle11));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle11,"Dev1/port2/line7","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle11));

// taskHandle20 - Analog Input Ch0
DAQmxErrChk (DAQmxCreateTask("",&taskHandle20));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle20,"Dev1/ai0","",DAQmx_Val_RSE,minimum,max,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle20,"",rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,nSamples));
DAQmxErrChk (DAQmxStartTask(taskHandle20));

---------------------------------------

I have declared the taskHandle's globally as:
TaskHandle taskHandle1, taskHandle2, taskHandle3, taskHandle4, taskHandle5, taskHandle6;
TaskHandle taskHandle7; taskHandle8, taskHandle9, taskHandle10, taskHandle11, taskHandle20;

 

When I compiled the program, I received the error starting from taskHandle8 for each of the tasks from 8, 9, 10, 11, & 20:

here is the error I received relating to taskHandle8 (Line #349-351):

 

349, 54 Type error in argument 2 to `DAQmxCreateTask'; found 'pointer to int' expected 'pointer to TaskHandle'.
350, 96 Type error in argument 1 to `DAQmxCreateDOChan'; found 'int' expected 'TaskHandle'.
351, 49 Type error in argument 1 to `DAQmxStartTask'; found 'int' expected 'TaskHandle'.

 

I was wondering if there are any limits on creating the number of tasks at a time. It looks to me the error started showing after starting the 7th task.
If anybody has similar experiences, it would be very much appreciated if you could point out what I was doing wrong. Thanks!


Can I solve 3 nonlinear equations in LabWindows/CVI

$
0
0

I have 3 nonliear equations with 3 unknowns (x^2, y^2, and z^2) and get the roots?

IMAQ RT Video Out

$
0
0

There exists in LabVIEW RT a VI called IMAQ RT Video Out; does an analogous function exit in LabWindows/CVI RT?

InstallComCallback on Win7

$
0
0

I seem to have found a slight issue using InstallComCallback() between WinXP and Win7 target machines.

 

I developed my initial software on WinXP.  The following two bits of code worked fine in WinXP with an eventMask = LWRS_RXFLAG | LWRS_RECEIVE.  But when I distributed the final software to Win7 machines, I was observing the callback getting called twice each time.

 

Here's my callback:

 

// Callback scanner COM function
void BarcodeScanner(int scannerPortNumber, int eventMask, void *callbackdata)
{
	// re-init the output buffer
	memset(scannerData,0,SCANNER_MAX_BYTES);
	// go get the buffer
	ComRdTerm(scannerPortNumber,scannerData,SCANNER_MAX_BYTES,SCANNER_EOS);

	// raise the data flag
	scannerDataFlag = TRUE;

	// empty the buffer
	FlushInQ(scannerPortNumber);
}

 

 

And here's my use of InstallComCallback():

 

void InitScannerComm(void)
{
	int notifyCount = SCANNER_MIN_BYTES;	
	int eventChar = SCANNER_EOS; 	// terminator charactor
	//int eventMask = LWRS_RXFLAG | LWRS_RECEIVE;	// callback event won't happen unless the eventChar is received after notifyCount characters
	int eventMask = LWRS_RXFLAG;	// TODO: the InstallComCallback() function seems to be calling the callback twice each time, even though I get a verified buffer of only N number of bytes
	int dataBits = SCANNER_DATABITS;
	int stopBits = SCANNER_STOPBITS;
	int inputQueueSize = SCANNER_MAX_BYTES;
	int parity = SCANNER_PARITY;
	int comportRing = 0;
	int i;
	// close port if it's already open:
	CloseCom(scannerPortNumber);
	// open COM port one time
	OpenComConfig(scannerPortNumber,scannerDeviceName,scannerBaudRate,parity,dataBits,stopBits,inputQueueSize,-1);

	// Make sure Serial buffers are empty
	FlushInQ(scannerPortNumber);
	FlushOutQ(scannerPortNumber);
	
	// look up how many COM options there are in the control
	GetNumListItems(tabPage2Handle,TABPANEL2_COMPORT,&comportRing);
	// set up callback function for COM
	for (i=1; i<=comportRing; i++)
	{
		if (i != scannerPortNumber)
			// disable all the other callbacks
			InstallComCallback(i, 0, notifyCount, eventChar, BarcodeScanner, NULL);
		else
			// enable the port that's been selected
			InstallComCallback(i, eventMask, notifyCount, eventChar, BarcodeScanner, NULL);
	}
}

 

A bit of background... the device sending COM traffic is a barcode scanner from Motorola/Symbol.  I have it set up in a virtual COM mode.  Using RealTerm in hex display mode, I can confirm that this hardware is set up correctly, i.e., it is sending what it should be (a string in the form: "012345" with a CR at the end).

 

And I know that the string is correct in that the callback gets called.  The puzzling thing is that in Win7 only, the callback gets called twice and then it's done.  The second time through, the string is all nulls.

 

My fix was to eliminate the LWRS_RECEIVE option in the eventMask (i.e., remove the notifyCount threshold).  Phew!

 

Is this a bug?

.NET 4.0 - Function CDotNetInvokeGenericMember return with -6571

$
0
0

Calling .NET assambly throws an exception in Function "CDotNetInvokeGenericMember". I invoked the beamgage automation interface, which properly work with Labview 2012, but not with Labwindows/CVI. Initializing assembly and creating target was OK.

Import VideoLAN (VLC) dll to cvi

$
0
0

Hello,

 

Anyone who has experienced the progess? My application is  64-bit based, and I have download the vlc x64 version, using the libvlc.lib as the source, but when call its dll, that give a BADFF error.

 

 

 

David

Problem with Stripchart

$
0
0

Hi,

I am having a problem using a strip chart and two numeric controls.

I am running LabWindows/CVI 2010 Version 10.0.1 (434)

I have searched the database but did not find anything close to the problem I am having.

It's actually quite simple.

As you can see from the graph below I have a strip chart and two numeric controls.

The numeric controls are meant to adjust the starting and ending values

The numeric; "shot count start" works flawlessly.

 

The ending numeric called; "Shot Count  End"  has its value written into the starting X position of the strip chart when it changes. (The only time I change this X value is when the starting numeric changes. When the ending numeric  value changes all I do is change the number of points to display.)

 

I have placed the steps I use for each case below the diagram

 

stripChart.png

 

When a change is made to the starting numeric

1. Clear Chart Data                                                ClearStripChart ( panel, TRI_PANEL_CHART)

2. Change set number of points                             SetCtrlAttribute( panel, TRI_PANEL_CHART, ATTR_POINTS_PER_SCREEN, numberOfPoints);

3. Set the new X offset                                           SetCtrlAttribute( panel, TRI_PANEL_CHART, ATTR_XAXIS_OFFSET, (double)newStart);

4. Draw Chart

 

When a change is made to the ending numeric

1. Clear Chart Data                                                ClearStripChart ( panel, TRI_PANEL_CHART)

2. Change set number of points                             SetCtrlAttribute( panel, TRI_PANEL_CHART, ATTR_POINTS_PER_SCREEN, numberOfPoints);

3. Draw Chart

 

I last thing I attempted was to make the callback for the numerics the same.

Here is a graph of the crazy update when  change the ending numeric

 

stripChart2.png

 

Thanks in advance for any suggestions

Auto-generated header has "Redefinition of macro "

$
0
0

The header file generated from the uir file has a duplicate macro definition. I deleted the file and rebuilt and got the same results:

"FMTSTCAL.h"(547,45)   Redefinition of macro 'Menu1_Test_SEPARATOR'.


CVI under Windows 7. Runs in Debug mode but not as release EXE

$
0
0

I have a project the the ran fine under windows XP.  Moved it under windows 7 and things do not run as expected.  Sometimes the screens update, sometimes I get the twisting hour glass and "Not Responding" message on the UIR screens. I can pull the project under the debugger and the project appears to start to run again.  Has anyone come across this sort of mind melting item and if so how does one go about trying to track down the cause?

getting relay count

$
0
0

hi,

 

i want to read the count of the particular switch using niSwitch_GetRelayCount(); .i am not at all understanding arguments in that function could you send any sample codes to understand working of that function.

 

Thanks & Regards

 

link error

$
0
0

hi,

i am using niSwitch commands during compailation i am getting link error like    Undefined symbol '_niSwitch_init@16' referenced in "nirelay.c".could you please tell me do i need to add any instrument file if so what is that.

 

Thanks & Regards

handling .NET events in Labwindows/CVI 2012

$
0
0

Is there anyone who has some sourcecode about handling .NET events in LabWindows/CVI. Especially I need some informations about using of "CDotNetCreateDelegate(..)" and handling Callback functions.

splitting out columns of data from a text file

$
0
0

Hi,

 

Urgent help/direction required to do the following.

 

I have 6 serial numbers and one text file, attached (for example xs0000_G1_7.6V_pre.log).

 

In the text file there are 48 column, each column is 4 hex digits long. In the file attached the first 8 columns have data.

 

I need to make 6 new files, <S/N>.txt, containing 8 columns of data, with the last file containing the last 8 columns and the first <S/N>.txt having the first 8 columns of data.

 

What do you think?

 

Thanks

Simon

   

Put an application labwindows on tablet

$
0
0

Hello,

 

I would like instal an application developped with  labwindows/CVI on tablet, Is that possible?

 

Romain

It wants a char; then says it's too small

$
0
0

Hello,

 

I have created a UI for a TestStand program in LabWindows/CVI; and it's causing me headaches. The problem is two out of several dozen of (nearly) identical function calls:

 

GetCtrlVal(panel, UUT_Test4, &gTestTemp); basicTest[3] = gTestTemp;
GetCtrlVal(panel, UUT_Test5, &gTestTemp); basicTest[4] = gTestTemp; //Error here
GetCtrlVal(panel, UUT_Test6, &gTestTemp); basicTest[5] = gTestTemp; //Error here
GetCtrlVal(panel, UUT_Test7, &gTestTemp); basicTest[6] = gTestTemp;

 

gTestTemp is defined as a static int. The functions are called in a callback function, which runs when the user clicks the "Ok" button in my UI.

 

When I run my TestStand program and I press said OK button, I get a fatal runtime error: "Invalid argument type: found 'pointer to int', expected 'pointer to char'".

I attempted to fix this issue by defining a new value, gTestTempC, as a static char and using it to retrieve the result for only these two function calls:

 

GetCtrlVal(panel, UUT_Test4, &gTestTemp); basicTest[3] = gTestTemp;
GetCtrlVal(panel, UUT_Test5, &gTestTempC); basicTest[4] = gTestTempC; //Error here
GetCtrlVal(panel, UUT_Test6, &gTestTempC); basicTest[5] = gTestTempC; //Error here
GetCtrlVal(panel, UUT_Test7, &gTestTemp); basicTest[6] = gTestTemp;

 

This results in the fatal runtime error: "Argument too small".

 

I have gone into my *.uir file and have verified that there is absolutely no difference between the checkbox control elements of the functioning and the error-bringing function calls (apart from their name and their label).

 

Does anyone have any idea what may be the problem here?

 

~Cheers,

D.W.


How to add a control to another by using ms common control 6.0

$
0
0

Hi,

 

I used Microsoft Windows Common Controls 6.0 to create a status bar in my application, and then I want to add a progress bar and a LED to the status bar, but who can help to tell me how should i do? Thank you.

 

Michael

 

E-mail:bintao.ji@qq.com

Why didnt' the ActiveX controller wizzard create a function to get CAObjHandle from interface

$
0
0

I used the Create ActiveX Controller Wizzard and a lot of the functions from the server were created.  However, I get to one part and it requires a handle for an interface/struct that it stuffs status data into.  I can see all of the compnents in the .c file, but no function was returned to create the handle.  Why?

Can we create relative include path?

$
0
0

Hello all,

 

Actually we are using the same project on different computers, and the project will be on different path for each computer.

As we have to install the project on another computer, we just copy-paste the whole source code files, and re-link the lost files. Mainly for includes which were correct for the last source computer.

 

Instead of re-create the absolute include files path for each computer, is it possible to put these path in relative, as for compilation files ?

Copying Projects

$
0
0

Hi,

 

I've had this problem for a long time and am looking for a solution.  I often find that it's easier to copy an existing project to another folder then edit for a new project.  As far as I can tell, CVI has no way to copy a project.  So what I end up doing is manually editing the .cws and .prj files so that the new paths are correct, then opening CVI.

 

Recently a client sent me the project they were working on.  Editing the .prj has been completely unsuccessful.  For some reason, CVI sees the source files but is clueless as to the project configurations.  It opens an Untitled project with no files.  I tried adding the files, but then I get compile errors (when my client does not).

 

Of course NI will help me fix my problem, but the bigger issue is I think there should be a more automated way to copy projects, and/or zip them up, ship them off, and have them build on a different system without having to manually edit .cws and .prj files.

 

Yuck!

 

BTW, NI used to have a suggestion link.  What happened to that?

 

Dave

Memory leak in image rings on Linux

$
0
0

Hello all,

I have a very serious problem I didn't have in previous version of my soft and one of the only addition I've made recently is to use image rings. The soft uses 6Mb more every minute. If I remove the rings, it stops. It could be a wrong lead, so I'm trying to write a test case, but is there a list of identified memory leaks somewhere ?

THanks.

Viewing all 5355 articles
Browse latest View live