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

timed confirmpopup

$
0
0

The following code for a timed confirmpopup used to work as code module in Teststand-3.1/Windows XP. When porting this to Teststand-2013/Windows-7 it doesn't work anymore.  The faked keystroke seems to go to nirvana and doesn't reach the confirm popup.  How to get this working again ?

int CVICALLBACK waitcallback (int reserved, int theTimerId, int event,
                                 void *callbackData, int eventData1,
                                 int eventData2)
{
	if (event != EVENT_TIMER_TICK) return 0;

	// Time elapsed: send ESC to the active panel
	FakeKeystroke (VAL_ESC_VKEY);

	return 0;
}

void __declspec(dllexport) fl_query_repair(tTestData * testData, tTestError * testError)
{
	ErrMsg errMsg = {'\0'};
    ERRORINFO errorInfo;
	double waittime = 5;
	int timer,response,status,error = 0; 
	 
	char  msgstr1[1024]= {0},resstr[256];
   
	timer = NewAsyncTimer (waittime, 1, 1, waitcallback, 0);
	
	response = ConfirmPopup ("Repair", "Is this a repair ?");
	
	if (response) strcpy ( resstr, "Repair") ;
		else  strcpy ( resstr, "Serial Prod"); 
	
	status = TS_PropertySetValString (testData->seqContextCVI, &errorInfo,
										  "Step.Limits.String ", 0, resstr);	
	testData->replaceStringFuncPtr(&testData->stringMeasurement,resstr);
Error:     
    // If an error occurred, set the error flag to cause a run-time error in TestStand.
    if (error < 0)
        {
        testError->errorFlag = TRUE;
        //OPTIONALLY SET THE ERROR CODE AND STRING
        testError->errorCode = error;
        testData->replaceStringFuncPtr(&testError->errorMessage, errMsg);
        }
    return;   		
}

ECG labview wireless xbee s1 plus adarduino uno

$
0
0
Hi
My group and I are currently doing a project which requires the transmission
of wireless ECG signal
to labview. The components which we decided to use complete the task are:
2 x Xbee (Zigbee S1) modules,
1 x Arduino uno
1 Xbee module attached to the Arduino had been programmed with Arduino
. However, due to our
lack of understanding of how Arduino functions, we are unsure if the co
ding for the interface is valid
for transmitting the Analog ECG signal wirelessly to the other Xbee mod
ule connected (USB cable) to
the computer and later displayed onto waveform using labview
.
The coding used is as follow:
 
#include "LabVIEWInterface.h"
int dato =0;
const int analogInPin = A0;
int sensorValue = 0;
void setup()
{
Serial.begin
(9
600);
}
void loop()
{
sensorValue = analogRead(analogInPin);
Serial.println(sensorValue);
delay(1);
checkForCommand();
{
dato = analogRead(0);
String cadena ="S0>";
String cadena1 = cadena + dato;
Serial.println (cadena1);
delay (10);
}
if(acqMode==1)
{
sampleContinously();
}
}
 
We have construst the labview that attached, but we are unclear which works for the coding
as stated earlier in the post.
 
We hope to get some enlightenment.
 
Thank you.

Convert double to string with commas?

$
0
0

I have an app where a user inputs a value, calculations are performed, and it spits out the desired result in a Numeric control as a double variable.

 

Output values can range from the hundreds to the hundreds of millions.

 

I'd like to convert the final result to a string using the format or scan functions (easy enough), but I also want to add commas or spaces so output numbers can look like 123,456,789 or 10,234 instead of 123456789 and 10234 for the end-user's ease of recognition.

 

I can envision a way to do it, but it involves a lot of tedious code. Anyone have a suggestion for a simple way?

 

It seems some of the most basic housekeeping in CVI is its biggest time-sucker, for me anyway.

 

Scott in Ohio

 

Serial Communication works randomly

$
0
0

Hey Guys,

At the moment we are developing a software for an automised testbed of a satellite. For this task, we are using LabWindows 2015.
We are trying to communicate via COM-Port.

Actually we are using the following C-Code, recreated from one of your examples:

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

/*****The connect-function*****/

    DisableBreakOnLibraryErrors();
    ComNumber = 3;
    //Connecting the Sensor - ComNumer = 3
    ErrorCode = OpenComConfig(ComNumber, "" , 9600, 0, 8, 1, 512, 512);
    
    EnableBreakOnLibraryErrors ();
                                       
        if(ErrorCode == 0){
        SetCtrlVal(maintabHandle, Humidity_HumidityStatusString, "Successfully connected");
        SetCtrlVal(maintabHandle, Humidity_HumidityState, 1);
        SetXMode (ComNumber, 0);
        SetCTSMode (ComNumber, 0);
        SetComTime (ComNumber, 5);
    }else{
        SetCtrlVal(maintabHandle, Humidity_HumidityStatusString, "Can not connect to Sensor");
        SetCtrlVal(maintabHandle, Humidity_HumidityState, 0);
    }

/*****The Send-function*****/

    
    int send_byte;
    GetCtrlVal (maintabHandle, Humidity_HumidityByte1, &send_byte);
        ErrorCode = ComWrtByte (ComNumber, send_byte);
    printf("Send Bytes: %d", ErrorCode);
    Delay(0.1);
            
    GetCtrlVal (maintabHandle, Humidity_HumidityByte2, &send_byte);
        ErrorCode = ComWrtByte (ComNumber, send_byte);
    printf("Send Bytes: %d", ErrorCode);
    Delay(0.1);
            
    GetCtrlVal (maintabHandle, Humidity_HumidityByte3, &send_byte);
        ErrorCode = ComWrtByte (ComNumber, send_byte);
    printf("Send Bytes: %d", ErrorCode);
    Delay(0.1); 
            
    GetCtrlVal (maintabHandle, Humidity_HumidityByte4, &send_byte);
        ErrorCode = ComWrtByte (ComNumber, send_byte);
    printf("Send Bytes: %d", ErrorCode);
    Delay(0.1);
            
    GetCtrlVal (maintabHandle, Humidity_HumidityByte5, &send_byte);
        ErrorCode = ComWrtByte (ComNumber, send_byte);
    printf("Send Bytes: %d", ErrorCode);
    Delay(0.1);


/*****The Read-function*****/
        
    char BufferRd[1000] = "";
    ErrorCode = ComRd(ComNumber, BufferRd, GetInQLen (ComNumber));
    SetCtrlAttribute(maintabHandle, Humidity_HumidityTempExtLbl, ATTR_CTRL_VAL, BufferRd);

/* Comment: The connect-, read- and the sendfunction are connected to buttons. Between every Sending Process the system waits for 100ms, so we can see how many
times the LED on our Devices blinks.
Most times, everthing works fine. We are connecting (ErrorCode 0), sending 5 Bytes of data (ComStat = ok, OutputQ is 0), our Devices are responding
and we can read these Data with the read-function. But sometimes it wont work at all. We are connecting (ErrorCode 0), send the Data, our Devices are blinking,
so that we thought they have received the data. But after that nothing happens... Seems like the program does not send the correct data... Iam a little
bit curious about the problem...*/


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


We are facing the following Problem: We are supervising the Serial-Communication through a serial sniffer. If we send the data packet, the sniffer
shows us the correct sended ASCII-Symbols and the devices displayed a Notification, that they have received a paket. Unfortunatly it seems, that sometimes the paket does not
contain the right Symbols. Our devices are not responding correctly. If we send the same data paket with a normal Hyper Terminal like "hTerm"
our Devices are responding correctly everytime. We even tried it without the serial sniffer, so that we can excluse this cause of defect.

Do you have any idea why the behave of our Devices is different (in a positiv way), when we are using the Hyper terminal?

We are using Labwindows CVI 2015 Full Development System v. 15.0.0 (408) , Windows 7....

Thank you for you support!

Regards
A

How to find the Estimating Transfer Functions and Process Models in labview

$
0
0

I have a level control project in labview 2014,

working fine in simulation and actual as well.

input output data obtained from the process should be estimated and validate.

(say it is best fit for process 85% or 95% which we can obtain in matlab Ident.)

Is there any code or sample labview program from which i can validate or estimate in labview?

Attached images for reference

Thanks

block or swallow events properly?

$
0
0

Hi,

i have Troubles with control events. My program is using graph cursor as X/Y axis control. When i click "into the graph", the mouse cursor is snapped to the graph cursor. I can "navigate" with mouse movements and the cursor position is continuously updated.
I need also switch between coarse and fine movement and i do it by cliclking the left mouse button again. The right mouse button should release the cursor and jump out of the graph, but this does not work properly.
The switching fine/coarse by left click produces further EVENTS and it activates the graph control again => i am locked in. I have tried to count those left click and swallow their events by calling GetUserEvent(..), but it does not work.. return(1) brings nothing as well..
Any hints, how to do it properly?

 

thank you

 


The code has roughly following structure:


int CVICALLBACK graph (...)
{
   ..
   ..

   if(event == EVENT_VAL_CHANGED)
   {
      case GRAPH_WINDOW:

      navigating_function(GRAPH_WINDOW);
      break;

      ..
      ..
   }

   return 0;
}


navigating_function(& graph_control)
{

   do
   {
        GetCursorPosition (x, y);

        if( GetAsyncKeyState(VK_LBUTTON))
        {
              change_to_fine_or_coarse();
              ++count_left_click;
        }

        x = x + step;
        y = y + step;

        .. updating graph_control;

       

        right = GetAsyncKeyState(VK_RBUTTON);

       

        }while( !right && EVENT_RIGHT_CLICK);

 

        for(count_left_click; count_left_click > 0; count_left_click--) GetUserEvent (0, &dummy, &dummy);

}

 

Separate Task for DAQmx for 2 devices?

$
0
0

Hi all,

 

Im new to CVI.

Lets say I have a DAQ USB 6343 and I create a simulated USB 6341 device.

When I click on start button, it will acquire all analog i/p for both devices and display on the indicator.

 

For 1 device, it works well. But when I try to create a separate taskhandle to acquire analog i/p for the simulated device, I got an error:

 

NON-FATAL RUN-TIME ERROR:   "DAQ.c", line 433, col 18, thread id 0x00001E98:   Function DAQmxReadAnalogF64: (return value == -200278 [0xfffcf1aa]). Attempted to read a sample beyond the final sample acquired. The acquisition has stopped, therefore the sample specified by the combination of position and offset will never be available.  Specify a position and offset which selects a sample up to, but not beyond, the final sample acquired. The final sample acquired can be determined by querying the total samples acquired after an acquisition has stopped. Attempted to Read Sample: 100 Property: DAQmx_Read_RelativeTo Corresponding Value: DAQmx_Val_CurrReadPos Property: DAQmx_Read_Offset Corresponding Value: 0  Task Name: DAQTaskInProject6341  Status Code: -200278

 

For first task:

         DAQmxReadAnalogF64 (taskHandleAI, samplesToReadPerChannel, 10.0,
         DAQmx_Val_GroupByChannel, data,
         numChannels*samplesToReadPerChannel, &actualSamplesRead, 0);

 

For second task:

         DAQmxReadAnalogF64 (taskHandleAI6341, samplesToReadPerChannel, 10.0,
         DAQmx_Val_GroupByChannel, data6341,
         numChannels6341*samplesToReadPerChannel, &actualSamplesRead6341, 0);

 

Can anyone enlighten me what is the correct way to do this? 

nidaqmx not found

$
0
0

Hi:

 

I'm having problems with NIDAQmx.h

 

This is the sequence of what I've done so far:

 

- Install Windows 7 Professional

- Install CVI 10

- Install NI-DAQmx 15

- Plug the card (NI USB 6218)

 

When I try to run a project I've run in other computer (with same configuration, except NIDAQmx is 14.5.1) I get a pop-up "The include file NIDAQmx.h was not found. Do you want to look for it?"

I've pointed CVI to c:\Program Files <x86>\National Instruments\NI-DAQmx Base\Include\NIDAQmxBase.h and then I get  the "Missing Prototype (Require function prototype build option is enabled.) warning....

 

What I've done wrong?

How can I fix it?

 

Thanks,

 

Jose


Generating LuaVIEW scripts from LabVIEW

$
0
0

Hi, How does one generate LuaVIEW scripts from LabVIEW

select value inside numeric

$
0
0

For convenience, I'd like the behavior of my numeric controls to auto select the entire value when I click the control.  So when it gets focus, the value should be selected.

 

I'm not seeing a way of doing this.  Any ideas?  The increment buttons on a numeric will select it, but these datatypes I have set to float.  So incrementing doesn't make much sense.  In my case, I have the user punching in values with the keyboard.  It would be nice to not have to first select the 0.000 already present before data entry.

 

Thoughts?

What do you use the callbackData for ?

$
0
0

OK, this is a dumb question, but generally speaking, what do you use the callbackData for ?

Yes, I know I can use:

    SetCtrlAttribute (panel, control, ATTR_CALLBACK_DATA, &SomeStaticData);

And recover its value inside the callback function with:
    typeofmydata Val=*(typeofmydata*)callbackData;

But except sometimes in the case of deferred callbacks, I don't see a use for it.

SQL Toolkit 2.2/2.3 installation failed

$
0
0

Hello,

 

I'm trying to install SQL Toolkit on my computer under Windows 10 but each time I tried the installation, it is blocked at 0%.

I tried to install with Windows under safe mode and I got this messages:

 

-SQL Toolkit 2.3: Error TARGETDIR is undefined, the Directory table seems malformed. Aborting...

 

-SQL Toolkit 2.2: The NI Labwindows/CVI SQL Toolkit 2.2 installation has failed with the following error: Unable toaccess the serviceWindows Installer.This can happen if the Windows Installer is not correctly installed.

 

I contacted Windows Answer Desk and my Windows Installer seems work correctly...

 

Thank you for your help.

"warning: illegal character encoding in string literal"

$
0
0

I'm running CVI 2015, v15 (408).

 

On some old projects wherein I put extended ASCII characters into string controls, I'm now getting the above warnings.  Any idea where I can quiet some of these warnings?

How to change report path from CVI

$
0
0

Hi everyone,

 

I am a beginner trying to develop an application that runs sequence files and stores the report in a specific directory. The sequence file and the report directory are passed as arguments.

 

How can I set the report path from LabWindows using the TestStand API?

 

It is not an alternativ to set the report path from the configuration dialog, beacuse it has to be dynamic.

 

Thank you in advance

Addi

DBConnect - NON-FATAL RUN-TIME ERROR: Function DBConnect: (return value == -10 [0xfffffff6]). Native error code -2147217843 0x80040e4d Microsoft JET Database Engine:

$
0
0

Hello,

 

I'm trying to open and read a table of database access (2007) protected by a password. I'm using Labwindows/CVI2012.

 

The problem is that I'm getting this error in "DBConnect" function : 

DBConnect - NON-FATAL RUN-TIME ERROR:  Function DBConnect: (return value == -10 [0xfffffff6]). Native error code -2147217843 0x80040e4d Microsoft JET Database Engine:  

Can not start your application. The workgroup information file is missing or opened exclusively by another user.

 

 

 

My code is really simple : I'm calling the "ConnectBase" function using my "Index" parameter (wich is 3 in my case)

 

ConnectBase(int iIndex, char * BaseName)
{
    int error=0,i=0;
    //char tcTestCheminDB[MAX_PATH_LENGTH]="";		//DB Globale
	char tcDBGlobalPath[MAX_PATH_LENGTH]="";		//DB Globale
	char tcDBProjPath[MAX_PATH_LENGTH]="";	//DB Projet
	char tcReportText[200];
	(1000 * sizeof(char));
	switch(iIndex)
	{
	 case 0:
	 case 1:
	 case 2:
	 case 3:
	//HA Modification 05/11/2015
	 sprintf(Connection_DB_Texem_Local,"");  	 

	 GetDatabasePath (BaseName, tcReportText, tcDBProjPath, 0);
	 
	 strcat (Connection_DB_Texem_Local, "Provider=Microsoft.Jet.OLEDB.4.0;Password=JEmxa07<;Data Source="); 
	 for (i = 0 ; i < strlen(tcDBProjPath) ; i ++)
	 {
	  if (tcDBProjPath[i] == 92)
	  {
	   strcat (Connection_DB_Texem_Local,"\\");
	  }
	  else
	  {
	    Connection_DB_Texem_Local[strlen(Connection_DB_Texem_Local) + 1] = 0;
		Connection_DB_Texem_Local[strlen(Connection_DB_Texem_Local)] = tcDBProjPath[i];
	  }	
	 }
	  strcat (Connection_DB_Texem_Local,";Mode=ReadWrite;Persist Security Info=False;"); 

     //Use simple Thread
     ErrChk_DB(DBInit (DB_INIT_MULTITHREADED));
   
		
     //Connect to the DB     
     // ErrChk_DB(tiConnectionHandle[iIndex] = DBConnect (CONNEXION_BASE));
	 if(tiConnectionHandle[iIndex]>0)
	 {
	  DisConnectBase(iIndex);
      ErrChk_DB(tiConnectionHandle[iIndex] = DBConnect (Connection_DB_Texem_Local));
	 }
	 else
	 {
	   //DisConnectBase(iIndex);ErrChk_DB(tiConnectionHandle[iIndex] = DBConnect (Connection_DB_Texem_Local));
	 }
	 break;
	}
    return 1;
Error:    
    return error;
}

The error is happening in the red line. 

 

 

 

Any idea please to solve that ? 

 

 


Problem with multiline tooltip

$
0
0

I love tooltips (although I have many open wishes, see here, here,herehere, here and hereSmiley Happy) but now I have found a problem if one is using a tooltip that consists of more than one line and its control is located close to the bottom of the screen.

 

Tooltips are smart enough to move to the left if the tooltip text is too long to fit on the screen. However, the similar condition for a vertical move has been overlooked, so if the control is close to the bottom of the screen and the tooltip text consists of several lines it may happen that the lower lines are not displayed.

 

OK if panel / control is at the right end of the screen:

 

tt1.pngtt2.png

 

Not OK if the panel / control is at the bottom of the screen:

 

tt3.png

tt4.png

 

How to Generate a Finite number of Pulses with a Digital Trigger

$
0
0

Hi!

 

I need to generate an N number of pulses based when I receive a storbe from my rate table. As I had my code before I was only generating 1 pulse and it was working fine, but now i tried to change it to be a variable number of pulses and now it gives me a Run-time error (-50103) saying that the specified resource is reseved when I try to start task gCTR5taskHandle which measures the time between rate table pulses (period counter). Could someone tell me how to fix it???

 

Anyw help would be much appreciated. ..Here's a snippet of the relevant code.

 

// Setup CTR-0 as DATA REQUEST CLOCK. Free Running Clock.

   DAQmxErrChk(DAQmxCreateTask("",&gCTR0taskHandle)); // I create my task

 

/*I want to create the data request based on the rate table strobe. So, I create a channel which will generate a pulse on counter 0 with the _test_data_req (1024Hz) frequency. Instead of the _test_data_req variable the parameter Value used to be 1e6, now is 1024Hz set via the configuration file.*/

  DAQmxErrChk(DAQmxCreateCOPulseChanFreq(gCTR0taskHandle, "/Dev1/ctr0","",DAQmx_Val_Hz,DAQmx_Val_Low, DELAY,_test_data_req ,DUTY)); 

   DAQmxErrChk(DAQmxCfgDigEdgeStartTrig(gCTR0taskHandle,  "/Dev1/PFI19",DAQmx_Val_Falling )); //I want to trigger the generation of the pulses by the falling edge of the rate table strobe (available in PFI19)

   DAQmxErrChk(DAQmxSetTrigAttribute(gCTR0taskHandle,DAQmx_StartTrig_Retriggerable,1)); //It’s retriggerable based on if the task is running and if the strobe is obtained

/*The number of pulses I want to generate each time the strobe is obtained used to be 1, but now we need to generate 32 pulses (32 data requests) per each RT strobe(now defined through the configuration file)*/

   DAQmxErrChk(DAQmxCfgImplicitTiming(gCTR0taskHandle, DAQmx_Val_FiniteSamps, _test_int_num));

 

 

 

// Setup CTR-5 as TIMESTAMP STROBE timer

   DAQmxErrChk (DAQmxCreateTask("",&gCTR5taskHandle));

   DAQmxErrChk (DAQmxCreateCIPeriodChan(gCTR5taskHandle,"/Dev1/ctr1","",0.000001,25,DAQmx_Val_Seconds,DAQmx_Val_Falling,DAQmx_Val_LowFreq1Ctr,0.000001,4,"")); //This task I want to measure the period of the RT strobe ( the time between falling edges of the strobes)

   DAQmxErrChk(DAQmxSetChanAttribute(gCTR5taskHandle, "", DAQmx_CI_Period_Term, "/Dev1/PFI19", 1)); //My strobe for axis 1 comes in on PFI19

   DAQmxErrChk(DAQmxSetChanAttribute(gCTR5taskHandle, "", DAQmx_CI_CtrTimebaseSrc, "/Dev1/PFI0", 1));//My 10MHz clock comes in at PFI0

   DAQmxErrChk(DAQmxSetChanAttribute(gCTR5taskHandle, "", DAQmx_CI_CtrTimebaseRate, 1e7, 1));//My clock if 10MHz

   DAQmxErrChk(DAQmxSetChanAttribute(gCTR5taskHandle, "", DAQmx_CI_DupCountPrevent, TRUE));//This is set in the event where no clock ticks are measured between the RT strobe pulses, to use the internal 80MHz to measure the time (0) instead of having it give me a timeout(receiving an exception that no click pulses were detected between RT strobes

Tooltips do misinterpret "\r"

$
0
0

Hello,

 

if I use

 

printf ( "%s", "\t\t\tTest\r Text" );

 

the result is as expected:

 

Text                    Test

 

However, if I print the same text to a string for use as a tooltip the "\r" is interpreted as "\n":

 

                          Test

Text

 

It would be nice if this behavior could be improved, many thanks!

Enum typedef in .h file causes attempt to build VB include file to fail. "Invalid Visual Basic Parameter Type"

$
0
0

I'm trying to generate a Visual Basic Include (.bas) file from an .h that uses a typedef enum. This causes an error: Invalid Visual Basic Parameter Type: 'BmbEnum' Where BmbEnum is a type defined like so;

 

typedef enum BmbEnum{

Invalid,

GasPressure,

TiLan, Rotation,

Pack,

} BmbEnum;

 

The line in the .h that uses it looks like this

 

int __declspec(dllexport) __stdcall Module_Configure(short cbus_pin, BmbEnum bmbOption, char errorMsg[]);

 

I'm not sure what angle to approach this from. Before I had a variable type that wouldn't work so I just dropped in a compatible VB type. But since this is an enum I'm not sure. How would I adapt this to work? Thanks!

Run LabWindows/CVI DLL from Visual studio 2013 Express

$
0
0

Hello all,

 

I have an older LabWindows/CVI DLL which I call from VS 2013 express.

However, I want to be able to debug the DLL by setting breakpoints in e.g. the initialize.

 

This is what I've done:

 

In the LabWindows/CVI proj, specify the executable and command line to visual studio exe "D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\WDExpress.exe".

Run the  LabWindows/CVI proj, visual studio opens, select the VS proj, run it and go the to initilize DLL call (LabWindows/CVI DLL), which has breakpoints.

Now when the step in VS is executed the breakpoint in LabWindows/CVI is not hit and VS just moves to the next step.

 

Is there a reason why the breakpoint in the initialize function doesn't get hit?

 

When specifying in LabWindows/CVI the exe that the VS projects generates iso the VS exe, hits the breakpoints in LabWindows/CVI... 

So how can I set the LabWindows/CVI proj so it looks at the VS generated exe iso the VS exe itself?

 

LabWindows/CVI 2013 SP 2, Visual studio 2013 express, both proj debug mode. 

 

Thanks in advance.

 

brgds

 

Jeroen C

Viewing all 5339 articles
Browse latest View live


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