Subscribe: LabWindows/CVI
http://forums.ni.com/rss/board?board.id=180
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
application  cvi  data  int  labwindows  scanner  scannerhandle  scannerobj scannerhandle  scannerobj  status  thread  time 
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: Wed, 22 Nov 2017 18:52:37 GMT2017-11-22T18:52:37Z

 



background calculation by moving average

Wed, 22 Nov 2017 17:13:17 GMT2017-11-22T17:13:17Z

Hi,

 

Let me tell you my application for  Image capture by Ximea Camera.

 

The background captured should be the moving average of the intensities  and change the value of the next background depending on the intensities of the following images .

 

Let me problem statement in the word doc named camera.docx.

 

I am unable to proceed for a moving array or shift register .

Could you please look my answer. and suggest a solution?

 

Thanks  a Lot

 




Multichannel Oscope Measurements to LabWindows

Tue, 21 Nov 2017 19:09:34 GMT2017-11-21T19:09:34Z

I am currently wanting to use my DSO-X4104A to measure 3x sinusoidal signals simultaneously.  I want to measure these three signals over a couple of seconds, save all the data for each channel and pass it off into LabWindows via USB with VISA commands.  Then, take all the data points and calculate information relative to each signal.  The only problem is, I have no idea how to do this.

 

I guess the first question I have is to know "where" or "what" stores data in the oscope for multiple channel readings with respect to the same time interval.  Is there common terminology or something I should look for in the programming manual of my oscope?

 

The other question is whether or not LabWindows will be able to read this "data block" and then tell the oscope, "Ok I've got what I want, now clear this data and lets measure some more stuff again."

 

I also don't need a terribly high amount of data points as the signals are all 400Hz and will be used in calculating phase information. 

 

Thanks,

Alex




Handle a time event correctly when Daylight saving time change

Tue, 21 Nov 2017 09:56:47 GMT2017-11-21T09:56:47Z

hello everyone, maybe someone already have a solution to my problem.

in my software i want that the user put an hour and when i reach that hour i have to do something, let's keep it more general possible.

 

so i have  put a numeric cell with hour and another with minute and comparing it with the actual time, but what happen when we reach the DST change time?

 

let's assume that the user put 02:30 AM (locatime) and the hour increase, i jump from 2:00 AM to 3:00 AM without doing the event.

in the other case, if the hour go back from 3:00 AM to 2:00 AM i do the event 2 time in the same day

 

i can write in the description to work with UTC time but it's not simple for the user, any suggestion?

 

i have done some test with this function 

 

MakeDateTime doens't care about DST
29/10/2017 1:59:59 = 3718231199
29/10/2017 2:00:00 = 3718231200
29/10/2017 2:01:00 = 3718231260
29/10/2017 2:30:00 = 3718233000
29/10/2017 3:00:00 = 3718234800
29/10/2017 3:01:00 = 3718234860

 

29/10/2017 2:00:00 DST
time 3718224000 utc
GetCurrentDateTime 3718231200 localtime

 

29/10/2017 2:59:00 DST
time 3718227540 utc
GetCurrentDateTime 3718234740 localtime

 

29/10/2017 2:00:00
time 3718227600 utc
GetCurrentDateTime 3718231200 localtime jump back to the same with DST

 

thank you




Help using ConnectToTCPServer function for connecting to a printer

Mon, 20 Nov 2017 18:51:37 GMT2017-11-20T18:51:37Z

Hello,

I am attempting to communicate to a printer using the following function:

 

int ConnectToTCPServer (unsigned int *conversationHandle, unsigned int portNumber, char serverHostName[], tcpFuncPtr callbackFunction, void *callbackData, unsigned int timeOut);

 

For the serverHostName, I am using the IP address of the printer. However, I am confused as to what number to put for the port number. How do I obtain this information?

 

Thanks! 




Debug output slow

Fri, 17 Nov 2017 08:15:12 GMT2017-11-17T08:15:12Z

I wonder if there is some way to speed up the debug output in LabWindows.

When a program is debugged in LabWindows all the debug output is routed to the Debug Window, so we see strings from our own DebugPrintf() statements, and strings from OutputDebugString() from any other DLL linked by our process.

This string output is SLOW, and the slow down affects even separate threads in our experience.
For example, I have here a program with several threads that manage CAN networking.


As soon as I open, in the UI thread, a FileSelectPopupEx the underlying comdlg32.dll starts to emit a lot of debug messages (Win 10 pro 1709) and all communication background fails in unpredictable ways. 
This could be helpful if my intention was to develop some time independent handshake, but this isn't the case.
The text rows in the debug window appears slowly, as they come from a serial terminal of past age, and I can't believe this is the best it can be done to show those messages: for sure it's missing some queuing - or whatever buffering - between process and debugger.

As preventive measure, I've routed all my own debug messages to a custom XDebugPrinf() that sends messages via UDP to the simplest server you can imagine, but this of course does not work for system DLLs.
I'm stuck in nondebuggable code sections, and for the first time in past years I'm facing something I cannot workaround.
Very frustrating.
If only I could tell CVI "please ignore OutputDebugString"...

 




Connection lost detection with external TCPServer.

Thu, 16 Nov 2017 12:53:38 GMT2017-11-16T12:53:38Z

Hello,

 

I am using external scanner with TCPServer. My question is how to detect lost connection with my scanner when e.g. battery drains out?

 

For connection I am using ConnectToTCPServer and TCPCallback function as callback.

 

I was thinking about some kind of polling e.g. ping to check if server is available.

 

How to do in proper way?

 

BR

M

 

 

 

 

 

 




Use of ProcessSystemEvents() in a Dedicated Data Logging Thread

Tue, 14 Nov 2017 20:31:51 GMT2017-11-14T20:31:51Z

In my application, I have moved data logging (writing text data to hard disk) into its own thread.  Things are working fine, but I wanted to ask about using ProcessSystemEvents() and Delay().

 

Below is my code.  I hope my bracket style doesn't confuse anyone.  I've omitted error handling for the sake of readability in this example. 

 

The thread runs and receives data asynchronously, and writes the data to disk.  It does no GUI updates, but I may later add an a panel with text box for displaying logged data in real time.  But at the present, there are no GUI updates.

 

Notice how I've used Delay().  Is this necessary?  If so, is my usage sufficient?

 

And what about ProcessSystemEvents()?  Should my code call it? 

 

And I assume that if I add a GUI to the thread, I must call ProcessSystemEvents() periodically?  Yes?

 

Thanks in advance.

 

int CVICALLBACK thread_fcn(void* init_data) {
   char         log_file_path_and_name[MAX_PATHNAME_LEN+1];
   Cmd          cmd;
   CmtTSQHandle tsq_handle;
   FILE*        fp;
   tsq_handle = *(CmtTSQHandle*) init_data;   
while (1) { if (CmtReadTSQData(tsq_handle, &cmd, 1, TSQ_INFINITE_TIMEOUT, 0) == 1) { switch (cmd.id) { case BEGIN_TEST: strcpy(log_file_path_and_name, cmd.data.log_file_path_and_name); fp = fopen(log_file_path_and_name, "w"); break; case LOG_TEXT: fprintf(fp, cmd.data.text); break; case END_TEST: fclose(fp); break; case TERMINATE: return 0; } } Delay(0.01); } return 0; }



Missing DLL for ndOpenDiagnostic().

Mon, 13 Nov 2017 12:23:34 GMT2017-11-13T12:23:34Z

I am getting a status = -8005 response from the ndOpenDiagnostic() function.

-8005 means - A DLL required for communication with the ECU could not be loaded. Probably this library is not installed. What DLL am i missing?

 

Using the following:

NI-9860 LIN interface device (XNET device)

LabWindows 2015, Automotive Diagnostic Command Set  15.0,  CAN  14.0 , XNET 16.0

Code:

#define MasterRequestFrame  ""  // "" takes the default value "MasterReq"

#define SlaveResponseFrame   ""  // "" takes the default value "SlaveResp"

TD1 DiagStruct = {0,0,0,0,0,0};

WriteData[0] =  0x62;          

WriteData[1] =  0x03;      

WriteData[2] =  0x22;      

WriteData[3] =  0x01;                       

WriteData[4] =   0x00;       

WriteData[5] =   0xFF;                      

WriteData[6] =   0xFF;     

WriteData[7] =   0xFF;                                                                                   

status = ndOpenDiagnostic (“LIN1@nixnet: ADCS_LIN_database”, 10417, 0x62, MasterRequestFrame, SlaveResponseFrame, &DiagStruct);

  status2 = ndDiagnosticService (&DiagStruct, 1, &WriteData, word_size, &ReadData, size_word);




Popup menus for any controls

Thu, 09 Nov 2017 16:28:58 GMT2017-11-09T16:28:58Z

Hi all,

I recently discovered the possibility of having popup menus on right-click. But it seems to be only possible with trees and tables. Why is that ? Why can't the attribute ATTR_ENABLE_POPUP_MENU be enabled for any type of control ?

BTW, the example code treemenu.prj seems to be gone from CVI 2017.

Alternatives ?




ConnectToTCPServer callback in different .c file not working.

Thu, 09 Nov 2017 14:25:09 GMT2017-11-09T14:25:09Z

Hello, I have problem with ConnectToTCPServer in my program. Basically i have files scanner.c and scanner.h where ConnectToTCPServer is covered as below:   int EstablishScannerConnection(int scannerHandle, char *ip, int port)  { int status=0; strcpy (scannerObj[scannerHandle].ip, ip);     // kopiuj ip scannerObj[scannerHandle].port = port;        // kopiuj port scannerObj[scannerHandle].connect = 0; status = ConnectToTCPServer(&scannerObj[scannerHandle].handle, scannerObj[scannerHandle].port, scannerObj[scannerHandle].ip, TCPCallback, 0, 2000);   if(status < 0) { scannerObj[scannerHandle].errorMsg = GetTCPErrorString(status); scannerObj[scannerHandle].error = status; if(scannerObj[scannerHandle].errorCallback) scannerObj[scannerHandle].errorCallback(); else ErrorMSG( scannerHandle ); } else scannerObj[scannerHandle].connect = 1; return scannerObj[scannerHandle].connect; }   also in this file i have got TCPcallback:     int CVICALLBACK TCPCallback (unsigned handle, int event, int error,  void *callbackData) { int status, i; // szukaj numeru uchwytu for (i=0; i< MAX_SCANNERS; i++) { if(handle == scannerObj[i].handle) break; } switch (event) { case TCP_DATAREADY: scannerObj[i].dataLen = 0; scannerObj[i].errorMsg = 0; status = ClientTCPRead (handle, scannerObj[i].data , sizeof(scannerObj[i].data), 1000); if ( status < 0) scannerObj[i].errorMsg = GetTCPErrorString(status); else scannerObj[i].dataLen = strlen(scannerObj[i].data); //scannerGetDataCB(i); if(scannerObj[i].getDataCallback) scannerObj[i].getDataCallback(handle); break; case TCP_DISCONNECT: CloseScannerConnection(i); char outputMsg[1024]="0"; Fmt (outputMsg, "Scanner#%d\n\nIP: %d:%d:%d:%d\n\n%s\n\nDisconnected ", i, scannerObj[i].ip[0], scannerObj[i].ip[1], scannerObj[i].ip[2], scannerObj[i].ip[3]); MessagePopup("Scanner", outputMsg); if(scannerObj[i].closeConnCallback) scannerObj[i].closeConnCallback(); break; } return 0; }   In main file I have:   #include "scanner.h"     int main (int argc, char *argv[]) { ... if(EstablishScannerConnection(SCANNER_OP130, SCANNER_OP130_IP, SCANNER_OP130_PORT))  {   SetCtrlVal (panelHandle, PANEL_LED_SCANNER, 1); } else {   SetCtrlVal (panelHandle, PANEL_LED_SCANNER, 0); } }   My problem is that I have got connection with TCPServer by my TCPCallback is not working - i do not have callback TCP_DATAREADY or any different when data is ready. When I put ConnectToTCPServer as below into main it is working (I have callback for TCP_DATAREADY, but  TCP_DISCONNECT is not working):   int main (int argc, char *argv[]) { ... if(ConnectToTCPServer(&scanerHandle, scannerObj[scanerHandle].port, scannerObj[scanerHandle].ip, TCPCallback, 0, 2000)==0) {   SetCtrlVal (panelHandle, PANEL_LED_SCANNER, 1); } else {   SetCtrlVal (panelHandle, PANEL_LED_SCANNER, 0); } }   I am using one thread, and ProcessSystemEvents(); in that thread: CmtScheduleThreadPoolFunction (DEFAULT_THREAD_POOL_HANDLE, ThreadMain, NULL, &threadMainHandle);   I will be appreciable to give me direction how to fix it.        [...]



error: Undefined symbol '___ImageBase' referenced in "c:\program files (x86)\national instruments\cvi2017\bin\msvc\cvistart.lib".

Thu, 09 Nov 2017 13:16:57 GMT2017-11-09T13:16:57Z

Dear All,

I am always getting this link error.

I suspect that the project I am trying to build was made in a previous CVI version.

Please help

 

Francesco

 




Carte d'acquisition compatible avec Labwindows CVI 2017

Thu, 09 Nov 2017 09:14:56 GMT2017-11-09T09:14:56Z

Bonjour,

Je suis à la recherche d'une carte d'acquisition qui serait compatible avec Labwindows CVI 2017, quelle type de carte dois je me procurer ?

 

Cordialement.




TDMS file read size

Wed, 08 Nov 2017 21:50:47 GMT2017-11-08T21:50:47Z

I'm experimenting with the TDMS library.  The compiler gave me a very important warning about data size in regards to...

 

int TDMS_GetNumDataValues (TDMSChannelHandle channel, unsigned __int64 *numberOfValues);

This gives me the number of values that are present in the channel.  It can be huge.

 

Yet the function to do the retrieval uses an integer datatype for number of values...

 

int TDMS_GetDataValuesEx (TDMSChannelHandle channel, unsigned __int64 indexOfFirstValueToGet, size_t numberOfValuesToGet, void *values);

Which kinda sucks as I have to do a bunch of memory management to get the values. 

 




Function niHSDIO_ConfigureDataPositionDelay() with respect to Ref Clock (CLKIN)

Wed, 08 Nov 2017 19:11:50 GMT2017-11-08T19:11:50Z

Can the function niHSDIO_ConfigureDataPositionDelay() be called/used with respect to the reference clock (CLK_IN)?




Application Crash - ntdll.dll

Tue, 07 Nov 2017 15:20:43 GMT2017-11-07T15:20:43Z

Dear NI,

 

I have a CVI application running on a WIN7 single board computer collecting data and doing some calculation continuously.  It runs well for a day then crashes with the following windows message.

 

Problem signature:
Problem Event Name: APPCRASH
Application Name: VCON.exe
Application Version: 4.0.0.0
Application Timestamp: 59961611
Fault Module Name: ntdll.dll
Fault Module Version: 6.1.7601.23864
Fault Module Timestamp: 595fa490
Exception Code: c0000005
Exception Offset: 0002e43e
OS Version: 6.1.7601.2.1.0.320.65
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

 

This same application works fine on my laptop with no crash.  I found a similar thread https://forums.ni.com/t5/LabWindows-CVI/ntdll-issue/m-p/3067859.  But the DEP security setting is essential Windows programs and services only.  Is there any other Windows settings to check?

 

Thanks,

JZ.




DDE Server and DDE Client Examples

Tue, 07 Nov 2017 12:38:59 GMT2017-11-07T12:38:59Z

I was looking for examples for how to do a DDE Server and a DDE Client in Labwindows CVI.  The few links I found were

dead links.  So, I worked up my own examples.  I have posted two zip files with code that seems to work.  I invite comments though if I got something wrong.  Hopefully this will help someone else out.  I built them with Version 2015 CVI.




Installation Error: NI Device Monitor folder

Mon, 06 Nov 2017 22:08:49 GMT2017-11-06T22:08:49Z

Installing CVI 2017 from the DVD set, from and Admin login account.  When installing the NI Device Drivers DVD 1, it gets to about 14% done, creates a folder "NI Device Drivers", which it then cannot access because the installer doe not have permission.  From my admin login I cannot open it, move it, change permissions, because I don't have permission.

 

Why does it do this?  How can it do this?

 

I have encountered this on more than one installation.  Unfortunately I don't recall what the solution was last time. 




A Using problem with Funtion imaqEasyAcquire()

Mon, 06 Nov 2017 07:01:34 GMT2017-11-06T07:01:34Z

Hi,everybody!

I want to acquire an iamge by function imaqEasyAcquire(),i use a basler camera and it can be see in NI-MAX,my code as follows:

#include "NIIMAQdx.h"
#include "ImageControl.h"
#include   
#include
#include "VISONTEST.h"

 

Image *myacquireiamge=NULL;  

 const char camerename[20]="cam1";

 

   myacquireiamge=imaqEasyAcquire(camerename);
   imaqDisplayImage(myacquireiamge,1,TRUE);

(image)

  When i run the code,it report :

NON-FATAL RUN-TIME ERROR:   "VISONTEST.c", line 237, col 28, thread id 0x0000225C:   Function imaqEasyAcquire: (errorCode == -1074397163 [0xbff60015]). The passed in interface or session is invalid.

 

 

If anyone can help me?Thaks so much!




NON-FATAL Error (GetFileTime and GetFileDate)

Sat, 04 Nov 2017 16:27:52 GMT2017-11-04T16:27:52Z

Hello ,

 

I want to include and display the date and time in the Title Panel of the project, but when I start the program I got an error NON-FATAL Error. Here is the code of mine. I would like to ask what is missing to my code. The utility.h already included in the header.

 

GetProjectDir(projdir);
 //sprintf(szTmp,"%s\\%s_dbg.exe",projdir,szSoftwareName);
 sprintf(szTmp,"%s\\%s_v1.1.exe",projdir,szSoftwareName);
 GetFileTime (szTmp, &hr, &min, &sec);
 GetFileDate (szTmp, &mon, &day, &yr);
 sprintf(szTmp,"%s  %d/%d/%d %d:%d:%d  %s %s",szSoftwareName,mon,day,yr,hr,min,sec,szAuthor,SW_Version);
 SetPanelAttribute (panelHandle_Cobot, ATTR_TITLE, szTmp);

 

NON-FATAL RUN-TIME ERROR: Function CVI_GetFileTime (return value ==-1)

 

 

 

 




Are NI based applications communicating with an instrument?

Thu, 02 Nov 2017 14:57:43 GMT2017-11-02T14:57:43Z

Hello,

 

I am writing an application in LabWindows/CVI that queries Keithley Switch/DMMs for the switch counts for all the relays on all of the cards installed in the instrument as a preventive maintenance strategy. The application will be installed on all test systems equipped with any of the Keithly Switch/DMMs. It will run as a scheduled task and add the max switch count from each card in each instrument to a central report that can be accessed to determine when the cards maybe approaching critical life cycle milestones.

 

My Issue:

How can I determine, within this application, if there is another application communicating with the instrument when the scheduled task starts? Other applications that might be ccommunicating with the instrument would be our test applications and they could be LabWindows, Labview, Teststand, or dotNET based applications. I don't think other application matters, but I am looking to avoid this PM application interfering/conflicting with a running test application.