Subscribe: LabWindows/CVI
http://forums.ni.com/rss/board?board.id=180
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
char  checksum  code  control  cvi  event  float  function  int  labwindows cvi  labwindows  network variable  program  rtd 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: LabWindows/CVI

LabWindows/CVI topics



LabWindows/CVI topics



Published: Fri, 22 Sep 2017 08:23:25 GMT2017-09-22T08:23:25Z

 



How to prevent console from coming to the foreground after a printf ?

Thu, 21 Sep 2017 13:52:24 GMT2017-09-21T13:52:24Z

Hello, hello,

I don't know if this is specific to programs compiled with CVI or if this happens with any program that writes to the console, but it's very annoying. If I have a program that writes to stdout (or stderr) in a standard Windows console (so, compiled with [Build][Target Settings][Create Console Application] ), every printf brings the console to the foreground.

 

How can I keep the console in the background ?

 

Thanks




missing ividmm.h

Tue, 19 Sep 2017 17:47:34 GMT2017-09-19T17:47:34Z

Hi,

I am trying to learn how to communicate with instruments using GPIB. I learn by seeing how someone else did it and go from there. I have an HP3478A Multi-meter which is the instrument that I have example code for. It came from NI when I downloaded and installed the VISA driver for it. Well, I followed the instructions on how to use it and when I compiled it, LabWindows complains that I do not have the ividmm.h file. I checked the includes for the example file and it definitely needs that file to compile. When I made my project, I chose to use the C file and not the LIB or the FP for that instrument so I can understand how to write code for that instrument. I will try and see if those will compile, but I doubt they will. Where can I get that H file, or do I need to install some more code for VISA or IVI. I just don't know what to do next. Thanks.




udp command line

Tue, 19 Sep 2017 15:10:24 GMT2017-09-19T15:10:24Z

Hello,

 

I'm trying go get UDP work on command line application but it seems not working!

I was only able to get it work when using User interface application.

 

Is it normal?

 

Thanks




Cannot undefine macros in cvicc

Tue, 19 Sep 2017 11:43:28 GMT2017-09-19T11:43:28Z

Hello all,

in cvicc (CVI compiler for Linux), there's an option -DDEFINE to define a macro, but no equivalent -U to undefine it. It would be useful because the macros defined in [Options][Build Options][Compiler defines] are indeed used by cvicc when compiling on Linux. If I need a project-level macro defined on Windows but not on Linux, I don't know how to remove it except by parsing it out of the prj file before compilation.




How to distinguish between several RTD measurement values

Mon, 18 Sep 2017 09:56:02 GMT2017-09-18T09:56:02Z

Hi, 

I’m using PXIe-4357 with 5xPT100 RTDs, with its A,B,C constants, in CVI2015 environment.

When I read RTD measurements, how do I know to which RTD it actually belongs?

Is it related to initialization order? Or amount of tasks that I run? Should I initialize separate task and samples storage for each RTD?

In example:

Initialization:

            DAQmxCreateAIRTDChan (glHnRTDTask1, “RTD/ai0:2”, "RTD1,RTD2,RTD3", glRtdMinTemp, glRtdMaxTemp,

                                                                                                            DAQmx_Val_DegC, rtdType, DAQmx_Val_2Wire,

                                                                                                            DAQmx_Val_Internal, RTD_EXITATION_CURRENT_AMPS, RTD_ZERO_DEG_RESISTANCE_OHM);

Run the task – etc… 

 

Read:

DAQmxReadAnalogF64 (glHnRTDTask1, RTD_SAMPLES_PER_CHN, 10.0, DAQmx_Val_GroupByChannel, glPtrRtdData,    RTD_SAMPLES_PER_CHN*glNumChannels, &numRead, NULL);

 

My samples stored in glPtrRtdData – if I use the constant DAQmx_Val_GroupByChannel – will my samples be stored respectively with ai0 to ai2 – first 10 values for ai0 in indexes 0:9, than ai1 in indexes 10:19 then ai2 in 20:29?

 

2nd Question:

In initialization command there is a possibility to give virtual names to physical channels -  if “RTD/ai0:ai3” are physical channels, “RTD1,RTD2,RTD3” are virtual names.

Function help says I can use those virtual names – but I can’t find how.

 

Thanks for the support




Detecting a button release with a touch screen

Mon, 18 Sep 2017 09:02:08 GMT2017-09-18T09:02:08Z

I'm trying to convert my hardware command panel of a machine into a virtual one with a touch screen panel. I'm using LW2017 and W10PRO.

I need to send  1 when the operator press and keep pressed the button, and 0 as soon as he release the button.

The only event i detect with my button callback and with my panel callback as well is EVENT_MOUSE_POINTER_MOVE. So, I'm using this to set to 1.

Then, to set safely to 0 I'm using a OR with:

EVENT_LEFT_CLICK_UP,

EVENT_RIGHT_CLICK_UP,

EVENT_LOST_FOCUS,

EVENT_CLOSE,

EVENT_DISCARD

in both callbacks, control and panel.

My problem is: depending how the operator release the button, sometimes the events CLICK UP (LEFT if the touch is short, RIGHT if the touch is long) did'nt declare at all, and the last event is again EVENT_MOUSE_POINTER_MOVE, so my code send again 1 and it remains forever.

There is some way to detect no touching at all on a touch screen?

EnableExtendedMouseEvents() can be helpful, or it is obsolete? the documentation is not clear about.

 

Some Suggestions? thankYou in advance.

 




How to use void pointer in function

Sun, 17 Sep 2017 21:45:24 GMT2017-09-17T21:45:24Z

I am trying to convert float/int/str information to string and store in an array.  Can I use a single function to do that?  I am getting errors under Labwindows 

82, 34 error: invalid operands to binary expression ('float *' and 'float')

I think I didn't use void pointer correctly, but why?  Thanks ahead.

 

main{

TestReport(Test_Description, 0.2,&MeasureValue,0.4, TESTREPORT_FORMAT_FLOAT,"Volt");

}

 

int TestReport(char description[], float Lowlimit, void *Result, float Highlimit, char datatype,
char unit[])
{

char TempTest[256];

 

strcat(Test_Report_Text, description); //report item header
switch (datatype){
case TESTREPORT_FORMAT_INT:
if (((int *)Result > (int)Lowlimit)&&((int *)Result < (int)Highlimit)) strcat(TempTest, "Pass");
strcat(TempTest, "*Fail");
break;
case TESTREPORT_FORMAT_FLOAT:
if (((float *)Result > Lowlimit)&&((float *)Result < Highlimit)) strcat(TempTest, "Pass");
strcat(TempTest, "*Fail");
break;
case TESTREPORT_FORMAT_STR:
break;
}
strcat(Test_Report_Text, TempTest);
return 0;
}

 




Can't set the same network variable twice

Sat, 16 Sep 2017 23:53:19 GMT2017-09-16T23:53:19Z

I am trying to share information between a labwindows program and a labview program.  I have network variable containing an array of unsigned char. I created the variable in the labview project and deploy upon application execution.  I can set the the network variable in labwindows fine once and the labview program reads it ok but when i loop through the same code a second time setting the network variable with the same data it does not get set and garbage is received.  I can't figure our where the disconnect is happening.  After setting the network variable in labwindows I read it back and the data is there both times.  And if I create an array at the beginning of the labview program and and set the network variable there instead of labwindows it work fine both times.  Also, I can't see the values of the network variable array in NI Distributed System Manager.  Is that normal?




LabWindows CVI 2015 SP1 on Windows 10 Pro - High CPU Usage

Fri, 15 Sep 2017 10:12:24 GMT2017-09-15T10:12:24Z

Hello,

 

I have a fresh installation of Windows 10 Professional 64bit on my Laptop. I have installed LabWindows CVI 2015 SP1 and the following NI software also.

 

(image)

 

I have observed that my CVI applications consumes high CPU when run in both debug or release mode. So i thought of doing some bench marking. I ran the simple.cws (National Instruments\CVI2015\samples\utility\Threading\Simple\Simple.cws) example from the example finder, which is a program to demonstrate multi threading in LabWindows CVI. The program has two threads running at rate of 0.5s and 10ms respectively. It was found that this program would consume around 38% cpu. Is it normal ? Can someone try to test it on your pc with windows 10 64bit. Below is the screenshot showing cpu usage.

(image)

Has anyone faced similar issue or does anyone know of a solution?.




[XNET][CVI2015] Get the time/flag when writing a CAN periodic frame

Fri, 15 Sep 2017 08:58:20 GMT2017-09-15T08:58:20Z

Hello, 

 

I need to get the time when frame is really written in the CAN bus. 

Example : I have a cyclic CAN frame in the bus with 20ms as period.

when I call the write function to update data of this frame, how can I get the exact time when this frame will be really updated in the bus the next iteration. 

Cycle1(t)..............CallWriteFct......................Cycle2(t+20ms)

I need to get the value of time (or a flag update) when Cycle2 arrives.

 

Is there a function to do that ? 

 

Regards,  




Installation asking for ComponentWorks 3D Graph

Fri, 15 Sep 2017 02:49:45 GMT2017-09-15T02:49:45Z

Greetings:

I'm in a strange situation in that I have old software (LabWindows/CVI 8.5) that I'm working at getting my software to a point that we can justify purchasing the latest to continue with development for production. I've had to reinstall the software in a VM as computer hardware advances. Installation seemed to go well, but now every time I start LabWindows, it runs an installation asking for the "NI Measurement Studio ComponentWorks 3D Graph" disk. I can cancel several times and get to LabWindows, but this happens every time. Anyone have any idea how to stop this? I've looked in Remove Programs for ComponentWorks but don't see it. Is this part of LabWindows/CVI, or a separate piece of software that I somehow started the installation of?

 

Thanks in advance




edit an on-board wave in pxi-6541 with nihsdio

Thu, 14 Sep 2017 21:41:53 GMT2017-09-14T21:41:53Z

I want to edit an loaded on-board wave.  I can do that with niHSDIO_SetNamedWaveformNextWritePosition() and niHSDIO_WriteNamedWaveformU32().  I can only get this to work if edit starts on an even 32b address and I have to write the full-width 32 channels of the 6541.

 

I'd like to start the edit at an arbitrary address and edit only selected channels (i.e. mask off channels to not be disturbed).  Or as an alternate I could accomplish this if I could read the on-board wave content back in to memory.

 

Is there any hope?




How to move to next input box from one box by pressing an enter key only

Thu, 14 Sep 2017 14:21:48 GMT2017-09-14T14:21:48Z

Hello,

I use 4 string Controls to input 4 serial number of 4 boards individually,but it must press Tab key to next input box.  I need to press an enter key to move to next input box only. I don't know how to do. Please see the attached file for my question specification

 

 

Thank.




TCP Client Reconnect Issue

Thu, 14 Sep 2017 01:41:52 GMT2017-09-14T01:41:52Z

Hi,

 

I am writing a GUI application in LabWindows that connects to a TCP/IP Server on a RT Target (PXIe). I have no issues if I connect on startup in the main function. However, I have a TCP check function that is called via async timer that checks the status of the connection every 10s, and reconnects if needed.  When reconnected via this callback, I seem to have issues with the TCP Callback not being called when data is sent from the server to this client. It seems to register successfully and I cant send data to the server, but the callback never gets invoked when receiving data. I'm not too experienced with callbacks/threading, so go easy on me if it's something obvious.

 

Here is sample code fragments to get an idea of what I'm doing essentially:

 

int main (int argc, char *argv[])
{

    ...

    ConnectToTCPServerEx (&gDataConnection, TARGET_PORT, TARGET_ADDRESS, TCPDataCallback, 0, 5000, TCP_ANY_LOCAL_PORT);

    NewAsyncTimer(10,-1,1,TCPIPCheckCallBack,0);

    ...

}

 

int CVICALLBACK TCPIPCheckCallBack(int reserved, int timerId, int event, void *callbackData, int eventData1, int eventData2)
{

    ...

    if (!gTCPConnected)
        (ConnectToTCPServerEx (&gDataConnection, TARGET_PORT, TARGET_ADDRESS, TCPDataCallback, 0, 5000, TCP_ANY_LOCAL_PORT);

    ...

}

 




RS232 communication

Wed, 13 Sep 2017 12:47:38 GMT2017-09-13T12:47:38Z

Hi all I want to read a code communication to C51 by RS232,if define constant send as : char dataBuffer[10]={0x02,0xFD}; ComWrt(2,dataBuffer,strlen(dataBuffer)); ComWrtByte(comport, 0x02); ComWrtByte(comport, 0xFD); It's OK . Now I want to use Numberic Control write anyone such(02FD,02FB,0xF7)can identify as define constant(0x02,0xFD),how to converter it .Thanks for your help any!




How to know a RING's Control_ID Which in the TAB control

Wed, 13 Sep 2017 02:26:24 GMT2017-09-13T02:26:24Z

    I am a trio in CVI,I want to get a RING's value using GetCtrlVal(PANEL,PANEL_RING',&ringvaule);but  CVI report that  "51, 31 Undeclared identifier 'PANEL_BINARYSWITCH_2'".and the Ring Control is in the TAB Control ,the TAB Control is in the PANEL.I doubt I wrote the wrong Control_ID,anyone can give me some advices?Thanks!




Regular Expressions in LabWindows/CVI

Tue, 12 Sep 2017 19:40:13 GMT2017-09-12T19:40:13Z

The regular expression instrument included in CVI appears to be fairly primitive. The range of options listed in CVI2017 help for  RegExpr_FindPatternInText  is just a small subset of common capabilities (for instance https://www.cheatography.com/davechild/cheat-sheets/regular-expressions/ or http://www.rexegg.com/regex-quickstart.html).

 

Are there any alternative options? Preferably at low cost, because justifying any spend to my boss after the CVI maintenance fee will be difficult.

 

Are there any plans to upgrade the native CVI regular expression parser?

 




How to update A,B,C constants for Callendar-Van Dusen equation?

Tue, 12 Sep 2017 05:58:16 GMT2017-09-12T05:58:16Z

Hi,

I'm developing a temperature measurements procedure in CVI with PT100 RTD and PXIe-4357. 

Please see the image attached.

How do I enter those A,B,C constants? What function should I use?

I'm using CVI2015 sp1 and CVI NI-DAQmx Library.

 

Best Regards,

Art




Question regarding to tree control CVI

Sun, 10 Sep 2017 20:53:02 GMT2017-09-10T20:53:02Z

I am trying to use the GetTreeItemAttribute CVI function and get the check box state information from a tree and store in a array, but the compiler just gives me errors showing 

NON-FATAL RUN-TIME ERROR: "Test.c", line 92, col 17, thread id 8188: Function GetTreeItemAttribute: (return value == -10 [0xfffffff6]). The control is not the type expected by the function。

the source code looks like following:

 

int panelID = 0;  

int i;
int Mark_State;

char Flag[MAXNUMBER];

 

nullChk (InitCVIRTE (0, argv, 0));
errChk (panelID = LoadPanel (0, "test.uir", PANEL));

 

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

       GetTreeItemAttribute (panelID, TABTEST_TREE, i, ATTR_MARK_STATE, &Mark_State);
       Flag[i] = Mark_State;
}

 

If possible, can somebody help me to take a look and see what is wrong with my code?

 

Thank you




C Math is Blowing My Mind. Odd Behavior on Checksum Calculation

Fri, 08 Sep 2017 16:22:27 GMT2017-09-08T16:22:27Z

*****

UPDATE:  Problem was resolved by changing sendBytes from char to unsigned char.  I would still like to know why the CheckSum addition would drop 256 when adding a char value of 136 which is actually stored as -110 or something similar.

*****

 

I am trying to do a checksum calculation and someone very odd is happening.  This message is adding a parameter list by name to a server.  The more parameters I add, the larger the messed.  When I add 26 it works.  When I go to 27 it fails the CheckSum.  I ran the same code in VB and it worked so I output the CheckSum value at each calculation interval and this POS is dropping the first byte's contribution of 256.

 

My first code kept the entire calculation on one line with a += operator.  As I noticed the error I broke it down into smaller chunks.  It exibits the same behavior.  The first two values of the array are 1 and 136.  In the first iteration of the loop below CheckSum will be 256 on line 3.  Then after running line 4 it DELETES the 256 and sets CheckSum to 136.  Every future iteration calculates correctly and the difference at the end of an almost 3.9 million summation is precisely 256.  To further baffle me, I removed one named parameter from the list to determine the difference.  The first value is sendBytes is 1, and the second is 118.  In this case it DOES NOT drop the 1 * 256 = 256!!!!.  Just to make sure you guys believe me I have added a sequence of screen shots tracing through execution.  Why is this happening?

 

	for (Count = 0; Count < (IndexCount / 2); Count++)
	{
    	    CheckSum = CheckSum + (sendBytes[Count * 2] * 256); 
	    CheckSum = CheckSum + (sendBytes[Count * 2 + 1]);
	    DebugPrintf("%ld\r\n", CheckSum);
	}