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

Exit from a thread in a loop

$
0
0

 

                Hello,

                I want to exit from a thread in a 'for' loop with 1024 repetitions. For example I want to exit in 500th  repetition from the thread. I used some functions related with thread.  My code is the following:

 

static int CVICALLBACK GraphLoop (void *functionData)     // This is my thread function.
{
FILE *fp;

fp=fopen(fileName,"a");
fprintf(fp,"\n\n Input Number Amplitude Upper Level Lower Level Status\n\n");
for(i=0;i<1024;i++)
{
hpe363xa_queryOutputVolt3631 (vi, 1, &sonuc);
lowerlevel[i]=-3;
upperlevel[i]=3;

amplitude[i] = sonuc;
if (amplitude[i] > upperlevel[i] || amplitude[i] < lowerlevel[i])
{
status[i]='F';
}
else
{
status[i]='P';
}

fprintf(fp," %d %9.5f %9.5f %9.5f %c\n",inputNumber[i], amplitude[i], upperlevel[i], lowerlevel[i], status[i]);

inputNumber[i]=i+1;

plot_handle = PlotXY (testler, TESTLER_GRAPH, inputNumber, amplitude, i+1, VAL_INTEGER, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_DOT, 1, VAL_RED);

}
fclose(fp);
return 0;
}


int CVICALLBACK CBBasla (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:

if (k==1)
{
k=0;
SetCtrlAttribute (testler, TESTLER_BASLA, ATTR_DISABLE_PANEL_THEME, 1);
CmtNewThreadPool (8, &poolHandle);
CmtScheduleThreadPoolFunction (poolHandle, GraphLoop, NULL, &GraphLoopId);
//CmtWaitForThreadPoolFunctionCompletion (DEFAULT_THREAD_POOL_HANDLE, GraphLoopId, OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
//CmtReleaseThreadPoolFunctionID (DEFAULT_THREAD_POOL_HANDLE, GraphLoopId);
SetCtrlAttribute (testler, TESTLER_BASLA, ATTR_DISABLE_PANEL_THEME, 0);
k=1;
}
else
{
};

break;
case EVENT_RIGHT_CLICK:

break;
}
return 0;
}

 

int CVICALLBACK CBTestleriKapat (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:

CmtWaitForThreadPoolFunctionCompletion (poolHandle,GraphLoopId, 0);
CmtReleaseThreadPoolFunctionID (poolHandle,GraphLoopId);
GraphLoopId = 0;

DiscardPanel(testler);
break;
case EVENT_RIGHT_CLICK:

break;
}
return 0;
}

 

 

             In this code, what can I use to exit the thread?


PlotWaveForm and AutoPowerSpectrum

$
0
0

I have an input signal (sine wave) of a couple hundred MHz, and I want to get the frequency components using AutoPowerSpectrum. My issue is that when plotting the result of AutoPowerSpectrum, I cannot get the correct frequency using the default parameters. So I use df as xincrement and I get closer to the correct value but still off by a factor of 1000 (and some change). So I guess my question is how can I use xInitial and xIncrement to get the correct frequency values when using AutoPowerSpectrum function.

 

Thanks.

Verify if CVI RTE 2013 SP 1 is installed?

$
0
0

The Properties for cvirte.dll shows version 13.0.0.632 dated 6/26/2013.  How can I determine if this is CVI RTE 2013 with or without a service pack?  NI's literature states that CVI RTE 2013 is supported on Windows XP 32 bit, and CVI RTE 2013 SP 1 requires Windows XP SP3.  Thanks.

Is CVI RTE 2013 (no service pack) supported on Windows XP SP2?

$
0
0

Please note the links below and description of the supported operating systems for CVI RTE 2013 and CVI RTE 2013 SP1.  The description for CVI RTE 2013 is "XP 32-bit" and the description for CVI RTE 2013 SP1 is "XP (SP3)".  Does this mean that CVI RTE 2013 (no service pack) is supported on all 32 bit versions of XP including XP (no service pack), XP SP1, and XP SP2?  Thanks.

 

http://www.ni.com/download/labwindowscvi-run-time-engine-2013/4105/en/

LabWindows/CVI Run-Time Engine 2013 - Windows 8/7/Vista/XP 32-bit/Server 2008 R2 64-bit/Server 2003 R2 32-bit

 

http://www.ni.com/download/labwindowscvi-run-time-engine-2013-sp1/4561/en/

LabWindows/CVI Run-Time Engine 2013 SP1 - Windows 8/7/Vista/XP (SP3) 32-bit/Server 2008 R2 64-bit/Server 2003 R2 32-bit

implicitly declaring C library function

$
0
0

Hello,

 

I am currently working on a project where a program has been entirely written for Lab WIndowsCVI 2010 and the program worked.

 

Now we have done an upgrade of Labwindows CVI 2010 to Labwindows CVI 2013 and the program that before worked now give me these errors:

 

 main.c - 5 errors
  108, 13    error: implicitly declaring C library function 'index' with type 'char *(const char *, int)'
  108, 29    error: non-object type 'char *(const char *, int)' is not assignable
  109, 54    error: cannot increment value of type 'char *(const char *, int)'
  300, 27    error: non-object type 'char *(const char *, int)' is not assignable
  1162, 14   error: non-object type 'char *(const char *, int)' is not assignable
Build failed.

 

It looks I have a variable called index and this variable is maybe declared as a table like that : ssize_t index[]

in a file h.

 

My questions are:

 

-> How can I know where my variable is declared? Is there a shortcut for that? The program is very long there are many files .c and .h.

-> Is there an option in LabWindows CVI 2013 to make a compatible conversion of the written program from Labwindows CVI 2010 to Labwindows CVI 2013 ?

 

Thanks for your help,

regards,

Fabien

 

 

 

Can I pan/zoom without ctrl+Shift in cvi ? I want to use a button in panel and mouse.

$
0
0

I want to use a button and+ mouse. How can I do this ?? Help me

Flush a telnet input buffer

$
0
0

Hello,

 

Any way to flush elnet input buffer ?

I use a InetTelnetRead to flush input buffer before sending a new command, but long time this function requires a long time :smileysad:

Any function like TelnetClearRXBuffeur and TelnetClearTXBuffeur ?

 

Thanks

Flush a telnet input buffer

$
0
0

Hello,

 

Any way to flush elnet input buffer ?

I use a InetTelnetRead to flush input buffer before sending a new command, but long time this function requires a long time :smileysad:

Any function like TelnetClearRXBuffeur and TelnetClearTXBuffeur ?

 

Thanks


I need to measure the frequency of a signal on Pin 39 (PFI 15) of a PXIe-6361 module.

$
0
0

I need to measure the frequency of a signal on pin 39 (PFI 15) of a PXIe-6361 module.  All of the digital I/O pins are already assigned and in use.  The signal frequency range is 50KHz to 500KHz.  I have tried all of the sample programs for DAQmx Counter/Timer frequency measurement.  If I modify them to use my hardware, I get run-time errors with conflicts with resources already assigned.

 

Reinstalled CVI 2009 and now the RTE not found when creating distribution

$
0
0

I had CVI 2009 and CVIRTE 2013 on my development system and I need to create a distribution with CVIRTE 2009 (customer request).  I removed CVI (add/remove) and deleted all CVTRTE 2013 files from the system.  After reinstalling CVI 2009 I get an error when I try to build a distribution with the standard RTE (The standard RTE component could not be found).  I downloaded and installed CVIRTE 2009 but component still not found.  How can I get CVI to recognize that the RTE is present?

Reading Teststand Limits value in CVI using Teststand API

$
0
0

I am trying to read the Numeric limit test Limit values in CVI using 'TS_PropertyGetValNumber' function. It gives with the precsion of 15. ScreenHunter_01 Apr. 29 10.32.gifScreenHunter_02 Apr. 29 10.33.gifScreenHunter_03 Apr. 29 10.34.gif

Values returned  lowLimit as 9.300000000000001 and highlimit as 10.300000000000001 instead of 9.3 and 10.3. lowLimit and HighLimit decalred as double since function''TS_PropertyGetValNumber' accepts return value as double only.

 

How to get the exact values which we setted in teststand? 

 

 

 

 

TCP wait on response

$
0
0

I have an instrument on a remote PC. I have TCP server running on that PC. The server can control the instrument and that works. I used NI CVI to create the TCP server and the instrument control interface. The TCP client is on a separate controller PC. The TCP client is a DLL that an application uses to communicate with the remote instrument PC. I used NI CVI for the DLL also. I can get TCP messages to control the instrument. However, I see no way to wait for a response in the client. The client would need to be multithreaded.

 

I would like a function in the DLL to send an operation via ClientTCPWrite to the server. The server would control the instrument and respond via a message back to the client. This would be mostly for error and status. I want the function in the client to return a response to the calling application. The TCP interface uses callbacks, so I am waiting for the server to send a response and initiate a callback in the client. The function would need to wait for a callback (likely on a different thread) and a semiphore or something would inidicate a response from the server. This would finish execution of the client function called by the application. The application would block waiting for the return.

 

I have looked at the NI CVI docemntation. However, I do not understand how to get the TCP callbacks on to a separate thread. Can someone point me to documentation to do this? Just calling a response function in the application has the same issue. I would need to poll for the response and wait (pause) to allow callback processing. There must be a way to used a multithreaded model. Thanks.

How to iterate through files in a directory in real time?

$
0
0

I have a program where users can write RPN equations into txt files so that the number and type of equations are completely customizable at run time.  I need to be able to iterate through .txt files in an Equations folder to load the equations into memory.  How can I do this in real time?

 

I know I could make the files eq 1.txt through eq 2.txt and iterate through until one doesn't exist, but my standard method has been to name the filename the same as the equation name.  Either way works.

 

Thank you.

unable to display hex array in textbox of .uri

$
0
0

i have to send hex frame on RS-232 , i have sucessfully send/recieve char string from my uri but the issue is that textbox only displays characters so by GetCtrlVal or SetCtrlVal i can only get and set characters but unfortunately i am unable to do same with Hex formate data,for example i want to send hex array of 20 0xAA , 0xAB , 0x10 , 0x00, 0xAE , 0xFF ...... , SSO WHEN I ASSIGN such array to textbox i can see different shapes but not my hex data, i have used other tools to varify that my data is correct but unfortunatly Lab Windows is unable to help me with this, converting whole array of 20 to string and then displaying is also another option but i am stll unable to do so.

please help me, looking forward for your reply,

regards

Ahsan

DMA FIFO - random values?

$
0
0

iHi all,

 

Apologies if this is in the wrong board ... not sure where it should go! Just to state upfront, I can't share VIs due to IP issues etc ... sigh.

 

Basically I have an sbRio 9626 and software running on the FPGA to interface with external analogue-to-digital converters. This is done using a state machine (single cycle timed loop with a case structure inside so it transitions between cases each tick of the FPGA clock). Inside one of the cases (states) I have a little routine which takes data from an ADC and places it in a target-to-host DMA FIFO buffer. In fact, there are 4 DMA FIFO buffers sending various information along with the sample value. This is then read by software on the RT Host and processed to produce an array of values which I then send to the PC using a shared network variable.

 

What I wanted to check was that the data being sent from FPGA to RT Host (and to PC) is contiguous (i.e. I have my FIFO lengths right). I modified the FPGA code to use a counter instead of the sampled data so the FIFOs should simply send numbers in a sequence (1, 2, 3, 4, etc). I then examine that sequence to ensure it's correct and no data has been overwritten.

 

What I find is that FIFOs 2, 3, and 4 are fine. FIFO 1 sends data that is continuous but every now and then I seem to get a random glitch. This glitch does *not*  appear to be due to FIFO lengths but seems to be an error in the data transfer. For example, I'll get something like 1, 2, 3, x, 5, 6, 7, y with x and y seemingly random values. The positions of x and y in the sequence are also seemingly random - they don't occur at the same point each time. The code writing to FIFO 1 is *exactly* the same as the others - in fact, it's the same dataset being written.

 

Anyone seen anything like this before? I'm trying to determine whether it's due to the target to host FIFOs or some problem with the network shared variable. Any suggestions as to what I might check? It almost looks as though there's EMI spikes on the transfer ... not suggesting that's the case but it gives an idea of what I'm seeing. I'm using Labview 2013 and BIOS on the sbRio is up-to-date. I do have another sbRio which I will try later to see if the problem is specific to one particular board. 


word report : checkbox

$
0
0

Hi,

 


I have a question about the Word report generation with LabWindows CVI.
I want to check or uncheck some checkboxes with CVI.
I did not find a function in CVI library (Word Report) that changes checkboxes value.
Is it possible to do it (in a simple way)? If this is not the case I will arrange to remove the check boxes.

 

Thanks,

 

Danaé P.

In XML files the symbol '

$
0
0

Hi!

 

I am doing a software app with LabWindows 2013 and I use XML files to store information. Sometimes, when I try to edit an XML file in LabWindows, I have a problem with it: the '<' symbol in some tags is missing. This happens very rarely, but it is a serious mistake, because I can't reopen the file. Does anyone know the reason? Has it ocurred to anyone else?

 

Thanks to all.

 

dxf import

$
0
0

Hi.

 

I am doing some work for a client who would laike to be able to import CAD drawings into some Labwindows CVI software I  am writing. It is a non-destructive testing application and my business is supplying ultrasonic instrumentation and a software package written in Labwindows. The ultrasonic transducer assembly will be position encoded and manually controlled and the client would like the path followed by the transducer assembly plotted on the CAD drawing of the structure being inspected.

 

I wrote a routine a few years ago that imports an STL file into Labwindows and displays the 3D image using the OGL library. It works  OK, but DXF or DWG import would be better. I gave up on writing code for DXF import because it is quite difficult. Is there any third party CAD import software that integrates with Labwindows? It does not need to be free, but it does need to be easy to use.

 

I  have searched the forum but could not find any posts on CAD import or DXF import.

 

Any help  would be appreciated.

 

Regards

John Norman

What is the unit for roundness measurement in CircularEdgeReport_struct?

$
0
0

Hi-

I thought that roundess was in % but it looks like I get higher than 100 for this value.  Can anyone tell me what the unit is for the roundess value in this structure?

 

Thanks in advance-

 

blue

calling a thread from a cvi code file to another code file

$
0
0

 

            Hello, 

            I want to call a thread from a labwindows/cvi code file to another labwindows/cvi code file. Namely, my thread function (GraphLoop) is in 'TestsModel.c' ; but I will call the thread in 'Tests.c' .  My code in 'Tests.c' is in the following;

 

 

 

 

int CVICALLBACK GraphLoop (void *functionData);

int GraphLoopId;

int callbackDataGraphLoop;

 

int CVICALLBACK CBBasla (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{

switch (event)
{
case EVENT_COMMIT:

CmtInstallThreadPoolCallback (poolHandle, EVENT_TP_THREAD_BEGIN, GraphLoop, callbackDataGraphLoop, GraphLoopId);


if (tiklandiE3631ACihazinaBaglan == 0 && tiklandi34401ACihazinaBaglan == 0) // 'E3631A Cihazına Bağlan' ve '34401A Cihazına Bağlan' tuşlarına basılmamışsa uyarı verir.
{
MessagePopup ("Uyarı", "Lütfen cihaz bağlantısını kontrol ediniz.");
}
else
{
if (tiklandiKaydet == 0)
{
MessagePopup ("Uyarı", "Lütfen ayarları kaydediniz.");
}
else
{
SetCtrlAttribute (Testler, PnlTestler_BASLA, ATTR_DIMMED, 1); // 'Başla' tuşunu pasif hale getirir.
SetCtrlAttribute (Testler, PnlTestler_BASLA, ATTR_DISABLE_PANEL_THEME, 1); // 'Başla' tuşunun etiketini pasif hale getirir.
SetCtrlAttribute (Testler, PnlTestler_BITIR, ATTR_DIMMED, 0); // 'Bitir' tuşunu aktif hale getirir.
SetCtrlAttribute (Testler, PnlTestler_BITIR, ATTR_DISABLE_PANEL_THEME, 0); // 'Bitir' tuşunun etiketini aktif hale getirir.

CmtNewThreadPool (DEFAULT_THREAD_POOL_HANDLE, &poolHandle); //Yeni bir thread oluşturur.
CmtScheduleThreadPoolFunction (poolHandle, GraphLoop, NULL, &GraphLoopId); // GrapLoop thread fonksiyonunu başlatır.
}
}

break;
case EVENT_RIGHT_CLICK:

break;
}
return 0;
}

 

 

          I take that errror after executing this code;

  error:Undefined symbol '_GraphLoop' referenced in "f:\Tests.obj"

 

         Please, can you help me for my question?

 

         Regards...

 

 

 

Viewing all 5361 articles
Browse latest View live


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