Quantcast
Viewing all 5351 articles
Browse latest View live

LabWindows GUI freezes with Arduino communications.

Good morning,

I have a little issue with my LabWindows program, I will explain it in the following lines. 

I did a test bench with an Arduino Mega to perform 10 tests in a specific DUT and I control the entire system with a LabWindows GUI. Every single communication is ok, I send (from LabWindows to Arduino) and I receive (from Arduino to LabWindows) the correct value.

The problem is when Arduino makes test: if I want to stop the tests list in any time with LabWindows GUI (Command Button), I can't do it because the interface is freezed, so I can't push any button to click in case of emergency. I always wait the end of the tests to interact with the program.

 

HW parts:

- Arduino Mega;

- Cable TTL-234X-5V (with drivers installed);

- HP ZBook 15v G5.

 

SW used:

- Windows 10;

- Arduino IDE 1.8.9;

- LabWindows/CVI v17.0.0 (2017).

 

Configuration:

GND (Arduino Mega) --> Black wire GND (TTL-234X-5V);

Digital19 RX1 (Arduino Mega) --> Orange wire TXD (TTL-234X-5V);

Digital18 TX1 (Arduino Mega) --> Yellow wire RXD (TTL-234X-5V).

 

Windows S.O. recognizes the configuration above in "USB Serial Port (COM3)".

 

The code that I used is the following (I simplified it):

COMMAND BUTTON to start tests list

int CVICALLBACK testListArduino (int panel, int control, int event,
					void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_LEFT_CLICK:
			iTest = 1;
			do
			{
				if(iTest == 1)
				{
					firstTest(panel, info);
					if(iRS232Error != 0)
						iTest = 11;
					else
						iTest = 2;
				}
				else if(iTest == 2)
				{
					secondTest(panel, info);
					if(iRS232Error != 0)
						iTest = 11;
					else
						iTest = 3;
				}
				...
				else if(iTest == 10)
				{
					tenTest(panel, info);
					iTest = 11;
				}
			}while(iTest < 11);
			break;
	}
	return 0;
}

FUNCTION TEST (for example first)

...
#define READTERM	10
int iPortArduino = 3;
...

void firstTest(int panel, char info[LENGTH_INFO])
{
	dResult[0] = 0;
	dResult[1] = 0;
	dResult[2] = 0;

	SetCtrlVal(panel, PanelMain_STRING, "A");					// Letter A in Arduino is the first test case 
	DisableBreakOnLibraryErrors ();
	iRS232Error = OpenComConfig (iPortArduino, "", 9600, 0, 8, 1, 512, 512);	// Open port COM
	EnableBreakOnLibraryErrors ();
	if(iRS232Error != 0)								// If the COM is incorrect
	{
		MessagePopup("Error","Error.");
		dResult[0] = -1;
		dResult[1] = -1;
		dResult[2] = -1;
		return;
	}
	SetComTime (iPortArduino, 10);
	SetCTSMode (iPortArduino, LWRS_HWHANDSHAKE_OFF);
	FlushInQ(iPortArduino);
	GetCtrlVal(panel, PanelMain_STRING, info);					// info = 'A'
	Delay(1);									// I used this to delay serial port
	ComWrt(iPortArduino, info, strlen(info));					// Send A to Arduino
	inqlen = GetInQLen (iPortArduino);
	bytes_read = ComRdTerm (iPortArduino, read_data, 10, READTERM);			// Take result1 from arduino script with Serial1.println(...);
	CopyString (tbox_read_data, 0, read_data, 0, bytes_read);
	dResult[0] = atof(&tbox_read_data);
	bytes_read = ComRdTerm (iPortArduino, read_data, 10, READTERM);			// Take result2 from arduino script with Serial1.println(...);
	CopyString (tbox_read_data, 0, read_data, 0, bytes_read);
	dResult[1] = atof(&tbox_read_data);
	bytes_read = ComRdTerm (iPortArduino, read_data, 10, READTERM);			// Take result3 from arduino script with Serial1.println(...);
	CopyString (tbox_read_data, 0, read_data, 0, bytes_read);
	dResult[2] = atof(&tbox_read_data);
	FlushInQ(iPortArduino);
	CloseCom (iPortArduino);							// Close port COM

	return;
}

Do you have any ideas to create a stop button for emergency in CVI? Or, with this managing, is impossible (i.e. maybe OpenComConfig, SetComTime, CloseCom create a particular condition to freeze CVI)?

Thank you and have a nice day.

 

Best Regards,

Stefano


Change editor line spacing

I recently upgraded from 2015 SP1 to 2019.  Is there a way to change the font line spacing.  I am not a fan of the amount of space between lines since it reduces the number of lines of code I can see on the screen as I program.  I like the old NIEditor font with it's spacing.

Reading two tables in a SQL Database

I am trying to using the Automatic SQL maps to read data from two tables in an SQL Database.

In Function One, I open a connect to the database,  map database columns to program variables, activate the map pointing to Table 1, fetch the records, deactivate the map, and close the database connection.

 

In Function Two, I open a connect to the database,  map database columns to program variables, activate the map pointing to Table 2, fetch the records, deactivate the map, and close the database connection.

 

They code is very similar. If I run Function One first, Function Two fails.  If I run Function Two first, Function One fails.  The error I get is

Database Error #-94.
Command was DBFetchNext(iMapHandle = 2).
Error Message = Invalid statement or connection handle.

 

I have try leaving the database connection open for both functions and still get the same error.  Even in with all this mess, I can still write data to a third table

 

Paul

 

field array

Hello,

My problem is as follow:

I have this array

$fields = array('name' => 'Nome', 'surname' => 'Cognome', 'phone' => 'Oggetto', 'email' => 'Email', 'message' => 'Messaggio');

I would like to create a var similar to this

 $myemail = $_POST[$fields[$key]['email']];

Unfortunately I can't solve it, although I do not have any parse problem.

Thank you.

My best Regards

Problem with launching OSK (on-screen keyboard) using LaunchExecutableEx in Windows 10

Hallo, 

I developed an application which calls the on-screen keyboard when the String control gets the focus. I use the function LaunchExecutableEx to run the OSK.EXE, which is the part of Windows. In WindowsXP it works normally, in Windows 10 the OSK is not launched and the error message appears saying that Function on-screen keyboard cannot be launched, eventhough the return value of the function LaunchExecutableEx is 0. I tried also the example "launchexe" in utility CVI samples with the same result. When I run "osk" command in "cmd" window, the OSK appears normally. Can you tell what could be the problem?

I use the LabWindows/CVI 2019 now. The first version of my application was developed in LW/CVI 2015, the same problem exists when I run this application under Win10.

Thank you for the answer, with best regards

 

Roman Vitek.

 

labwindows使用visa的vifindrsrc函数报错vi_error_user_buf

labwindows使用visa的vifindrsrc函数报错vi_error_user_buf,但vopendefaultrm返回状态正确,同时直接使用viopen函数可以正确打开gpib设备

Minimum and maximum values Stripchart

Hi,
don't know how to set maximum and minimum values in StripChart?

I do not know what attribute is set, I did not find it in the properties and I want to set these values through numeric.

Thank you for your advice.
Image may be NSFW.
Clik here to view.
value.jpg

Running Matlab from LabWindows CVI using current versions

I want to run MATLAB 2019a (and its various functions) from LabWindows CVI (2017). I was trying to use the built in project on the CVI samples folder to interface but get an error message when the 'LAUNCH MATLAB' button is pressed (below is a screenshot). I browsed the forum and all the relevant posts are from about a decade ago. Can anyone kindly tell me that if it is possible to interface with MATLAB from CVI using the current versions of both the softwares?

Image may be NSFW.
Clik here to view.
matlabcvi.png


Crear un Osciloscopio virtual con USB 6008 utilizando CVI

Estoy necesitando Emular un osciloscopio utilizando el Modulo USB 6008, programando con CVI. Quien me puede orientar con la instalacion de las herramientas? o algun programa de ejemplo que me ayude con esta tarea de instrumento virtual?

Fatal Runtime Error Debugging

My PC has both CVI-2013 as well as previous version CVI2012. However while working with 2013 project whenever run-time error occurs, And if I press 'Break' to debug the code it opens CVI2012 and pops up a message " Unable to attach process for debugging. Either permission denied or Invalid process id".

How to set the option to use CVI2013 for debugging purpose.

 

 

DAQmx 19.1 Standalone

Is there a way to get DAQmx standalone, like we have gotten on the provided DVD up through 18.5?  I have computers that are not on a network -- in fact every target computer I have.  Cannot do a network download onto these.

MSCOMCT2.OCX Win10 64bit

We have a 32 bit SCADA application developed with LabWindows/CVI 2009. Our customers who have PC's with Win10 updated to 1809 and later are reporting that our 32 bit installer does not work (first attachment). The application and distribution package were regenerated in 64 bit mode. Now Win10 gives an ActiveX error (second attachment) although the ActiveX file loads properly (Regsvr32 mscomct2.ocx reports success). I can't find any evidence on the forums that updating our IDE would solve the problem. I could provide a snippet of our source and a uir file to test in a later version of the IDE if someone could help.

Thanks in advance,

Kevin Montcalm
Electrotechnics Corp. (ELTEC)
318-393-9865 cell
800-227-1734

TCP connection is not usable after I close a sub-panel and re-open again

I added a menu, "TCP_IF"  to my main panel. Whenever a user select this "TCP_IF" menu, opens a  panel to allow type IP address and connect to remote TCP server,a dn send messages once a while. 

What  I want to do is, if there is a connection established already and user closed the Panel, keep the TCP connection open. When user select the menu again, it will open up the panel again and continue...   Somehow, when the panel is opened again, even though the TCP connection handle is valid ( it has the same value as before the panel is closed), I can not use the TCP connection to send message out.  What I have to do is to close the connection using the TCP connection handler, and open a TCP connection again ( the TCP connection handle has a new number )

 

I do not know why?

 

Many Thanks,

Qing

LabWindows multiple Tasks data acquisiton problems

Hi all,

 

I'm new to LabWindows and have some problems with my data acquisition while running multiple tasks in the same loop.

I am using the cDAQ-9189 with the 2019 version of LabWindows. The following modules are used to read the data from different sensors:

 

NI 9218: Force at channel 0, Torque at channel 1.

NI 9203: Measuring current.

NI 9401: digital angular measurement.

 

The sample rate I chose is 1 kHz. In my code, there's a for loop with 5000 steps. In each step I read one sample from each of the modules. As long as only one of the tasks operates in the loop, everything is fine and no problems occur. The problem is:When there are two tasks running at the same time, the data acquisition is slowed down and not plotted correctly afterwards. When I run all the tasks in the loop, I get the error: Error -200279: Unable to Keep Up with Acquisition in DAQmx.

That's an error you could solve with the 'Producer & Consumer' architecture in LabView ... but is there anything similar to that in LabWindows? Multithreading maybe?

Do you have any hints or tips so that my data acquisition works correctly, with all the tasks in parallel? Any help would be appreciated. Thanks in advance!

 

See my code for the data acquisition below:


CreateDAQTaskInProject(&daqTaskCurrent);
CreateDAQTaskInProject2(&daqTaskAngle);
CreateDAQTaskInProject1(&daqTaskForce_Torque);

 

for(i=0; i<5000; i++){

       DAQmxReadAnalogScalarF64 (daqTaskCurrent, 10, &dataAmps[i] ,0);
 

       DAQmxReadAnalogF64 (daqTaskForce_Torque, 1, 10.0, DAQmx_Val_GroupByChannel, &dataForceTorque, 2,
       &sampsPerChanRead, 0);
       dataForce[i]=dataForceTorque[0];
       dataTorque[i]=dataForceTorque[1];

       DAQmxReadCounterScalarF64 (daqTaskAngle, 10, &dataAngle[i], 0);

}

DAQmxStopTask(daqTaskCurrent);
DAQmxStopTask(daqTaskAngle);
DAQmxStopTask(daqTaskForce_Torque);

 

NI MAX not detecting USB interface

Hello

I am using Tektronix PWS4323 Power supply with USB interface to windows XP machine.

I have problem with NI MAX 4.1, its not detecting power supply, but i can see it in VISA Interactive control as USB0::0x0699::0x0391::C020145::INSTR.

 

Any advise, should i upgrade NI MAX version ? please advise.

 

 

 


FlushInQ

I am sending the FlushInQ to the target port but when I check the GetInQLen. The buffer still having the same amount of data (I run GetInQLen before and after FlushInQ).

I am not setting any signal (CTS, RTS, etc)

Decoration border color mystery

Hello

I have a Tab control. Inside each tab of this control, there are several Decoration panels. However in one tab, decorations look like on the picture below (3D, gray /white border):

Image may be NSFW.
Clik here to view.
Border1.png

...but on the second tab (of the same Tab control) Decoration panels look like this (flat and with blue outline/border color):

Image may be NSFW.
Clik here to view.
Border2.png

No matter if I create them in CVI UI editor from mouse menu (Right Mouse Click >Decoration>Recessed box) or I copy a decoration from one tab to another, so it seems like this effect is not connected to Decoration panel setting itself.

 

Decoration Panel doesen't seem to have any atributes that allows control border color setting, so this might be due to some settings of higer-level contol (Tab control?) but I can't find there any applicable attribut either.

This seems like a mystery to me why decorations inside two different tabs of the same Tab control have different look...

Any sugestions are welcome!

FileSelectPopup doesn't show mapped network drives

Hello, I'm using CVI 2019 in Windows 10 and, when I use FileSelectPopup function, I cannot select the mapped network drives because they are not listed in the popup. Here below a screen shot of what happens using File Explorer and FileSelectPopup in the same computer.

Image may be NSFW.
Clik here to view.
FileExplorer.JPG
File Explorer
Image may be NSFW.
Clik here to view.
FileSelectPopup.JPG
FileSelectPopup

Until two months ago I was using CVI 2013 and Windows 7 and I never saw this behavior: FileSelectPopup and File Explorer always gave the same results.

Anybody already experienced this problem? Is there any flag I should select in my source code or IDE?

 

Best regards

Sergio

What is the default sample rate of NI-9220

What is the default sample rate of NI-9220 (using CVI).

if I don't use this function:  DAQmxCfgSampClkTiming();

 

 

What is the Difference between LabVIEW and LabVIEW CVI, and What are the Compilation stages of LabVIEW & LabVIEW CVI .

Viewing all 5351 articles
Browse latest View live


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