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

PlotStripChart with continuous sampling DAQmx and multiple channels

$
0
0

I have modified the DAQmx sample code sychAI-AO.cws slightly to offer more output wavforms. I can read simultaneously on one channel no problem. Then when I try two channels I read in an array of N (N>>2, a lot of PlotStripChart examples have N=2 with 2 traces so it updates one point at a time... I don't want that.)  samples. 0 to N/2-1 is what AO1 (output channel 1) writes out, and N/2 to N-1 is what AO2 writes out. Now if I set the number of traces to 2 and try to plot them on a stripchart I get the entire array 0 to N-1 on both traces. 

 

How do I plot an array of say 10000 samples on 2 traces with the array grouped by channel?

 

Thank you


Create dll for use in Labview

$
0
0

Hi guys,

 

Basically I have got the library file (.c & .h) which the main.c. will be using.   

How can i create a dll file from Labwindows 2013 that can be use in Labview?

 

Thanks.

changing default value of Numeric box permanently

$
0
0

i want to change default value of my numeric control permanently when changed by the user , for example my numeric control is displaying 44.555 when my  user interface starts. As 44.555 is default value for the numeric control but if i change the value to 45.444 then i want the default value to be 45.444 so that when i load my user interface again then numeric control displays 45.444. in short i want to update the default value of my control when loaded.

i have already studied

http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/uiref/cvinumeric_attributes/

http://zone.ni.com/reference/en-XX/help/370051AC-01/cvi/uiref/cvisetctrlattribute/

LabWindows training courses

$
0
0

If this (rather commercial) post is innapropriate for the forum, just let me know and delete it, I'll understand.

 

This being said, 2 weeks ago I gave CVI training courses to a bunch of engineers. Yeah, new CVI programmers !

 

I can do it again, either in private or public settings, and I can do it in English, French and Italian. Obviously this is based in Europe...

 

The duration of the course is 3 or 4 days but I can adjust on request. I can provide the course outline on request (very similar to the official NI course request anyway, but I use my own examples and exercises).

DisplayImageFile() does not change dimensions of picture control

$
0
0

Hi

 

I'm setting image of a picture control with DisplayImageFile() + setting the control attribute ATTR_FIT_MODE=VAL_SIZE_TO_IMAGE. The image size is bigger then the control size and I want the control to resize to the image size.

 

It works fine except when I query the control dimensions with GetCtrlAttribute(panel,control,ATTR_HEIGHT,&height), I get the original size(before calling DisplayImageFile())...

 

It seems I miss something basic...

 

Environment: LAB Windows CVI 2012 , Windows 7

 

Thanks in advance

Ramy

Blowfish encryption implementation

$
0
0

Managed to encrypt/decrypt strings using the rather succint  blowfish algorythm but have an issue that for whatever reason cannot overcome and understand.

The encryption algorithm uses 64 bit blocks, in a way that two letters in the cleartext are assigned to subsequent unsigned long integer enc...

see below:

int blowfish_encrypt_buffer(blowfish_context_t *ctx,char *cleartext,unsigned int bufferlen,unsigned long *enc){
    unsigned int i;
       for(i = 0; i < bufferlen; i+=2){
        enc[i]   = cleartext[i];
        enc[i+1] = cleartext[i+1];
        blowfish_encryptblock(ctx, &enc[i], &enc[i+1]);
     }

 return i;  
}

the output is the enc array that is i element long.

So far so good. If I use enc to decrypt, it works just fine:

 

int blowfish_decrypt_buffer(blowfish_context_t *ctx,unsigned long *cryptext,unsigned int bufferlen,char *cleartext){
  unsigned int i=0;
 
     for(i = 0; i < bufferlen; i+=2)    {
         blowfish_decryptblock(ctx, &cryptext[i], &cryptext[i+1]);
         cleartext[i] = cryptext[i];
         cleartext[i+1] = cryptext[i+1];
     }   
     cleartext[bufferlen] = '\0'; 
  return i;  
}

 

Now if I want to store the encrypted data -an array of unsigned longs, in a string, it looks handy to use hexadecimal string:

Running this loop and visualizing the string is nice:

for(int i=0;i<len;i++){
                sprintf(line,"%x",enc[i]);
                SetCtrlVal(bpanel,BPANEL_CRYPTEXT,line);
 }

it looks like this string here: 6441696d2d6e615073736f7764723231033...

 

The problem is that when I want to reveerse this, I cannot sscanf the the string into unsigned longs as it came from. Could not find the fortmatting parametes or other way to do it even if my life depends on it.  :-(

L.

 

TDMS_DefragmentFile blocks some PC's

$
0
0

Hello

I've a problem with the TDMS_DefragmentFile function.

If I use this function then the windows 7 pc blocks while the function is running.

This problem is not on all windows 7 pc's on some pc's it works properly.

I've used the same file on different pc's.

 

LabWindows 2013 SP 2

TDMS file format 2.0

 

event for menu closing?

$
0
0

Is there a way I can detect when a user closes a menu or menu popup?  I would like to shut down other timers in a single-threaded app when the user opens a menu.  But then I need to know when to restart all the timers.

 


SMS over wifi?

$
0
0

Is it possible to send SMS messages to mobile phone over WIFI (not through a modem) using LabWindows?

 

Thanks,

 

Peter

How to program counter using and external trigger?

$
0
0

I'm using a USB-6221. I want to count TTL pulses coming from an external device. I want to start/stop counting using an external signal (trigger?).

 

The following function statements seem logical to me, but they don't work. Can you help?

 

DAQmxCreateTask ("pulseCnt", &cntTask);
DAQmxCreateCICountEdgesChan (cntTask, "Dev1/ctr0", "", DAQmx_Val_Rising, 0, DAQmx_Val_CountUp);

 

// The following statement gives this error, "Specified property is not supported by the device or is not applicable to the task".

// Property: "DAQmx_StartTrig_type"

 

DAQmxCfgDigEdgeStartTrig (cntTask, "/Dev1/PFI10", DAQmx_Val_Rising);   // start counting when the TTL count start/stop signal is high

 

DAQmxCfgDigEdgeRefTrig (cntTask, "/Dev1/PFI0", DAQmx_Val_Falling, 0);   // stop counting when TTL count start/stop signal is low.

DAQmxStartTask (cntTask);

 

How would I know if my device is capable of doing what I described above? What function calls should I use?

 

Do I need a statement to connect an internal clock to the counter? What statement specifies that?

 

How do find out where to physically connect the input signal to the USB-6221?

 

Sorry to ask these seemingly elementary questions but I don't understand in detail how counters work and I can't seem to find a good explaination. Documentation is either too simple or too complicated.

 

thanks!

 

 

Install 2 variants of the same prog

$
0
0

Hello all,

I have a project B, branched from a project A. They are both with ongoing development. Both in different directories, all code duplicated in each directories (and verified that there isn't any criss-crossing). Projects and target executables have different names.

Now I create a distributions for each. I install B first. Then I try to install A on the same machine, but it refuses, saying that there's already a newer version. It's not completely wrong, but since the names and directories (as well as target directories) are different, how come it believes that the two installers are for the same program ?!?

In [Target settings] the version numbers for A are lower than for B, as it should be.

In [Edit installer][General] the version number is set to auto-increment and B is higher than A but why should it matter if both names and output dirs are different ?!?

 

If I install A, then B, A disapears from C:\Program Files\. Why is that ?

 

I grepped the .prj and .cds files and see no dir or target names in common.

Request SQL contains keyword "LIKE"

$
0
0

Hi,

 

I want to select 'Id' from 'table' where chaine begins with 'BR' the request is like this : SELECT Id FROM table  WHERE chaine  LIKE 'BR%', it works when i run it in MS Access but when i include it in Labwindows CVI it generate an error ( unknown specifier).

 

I'm searching for the equivalent of the caracter % .

 

Note:

Hardware Environment: PC DELL  intel(R) Core(TM) 2DUO CPU

Software Environment : Labwindows CVI  2010

 

 

 

User Account Problem for accessing my application

$
0
0

I wrote a program using lab window/cvi 5.5 and installed in window 7 pc using admin account and its working fine while I am going to switch user and working in other user account its asking admin password....I do not want to give admin access to other user how to solve this issue?

 

 

thank you in advance

viWrite sends incorrect data

$
0
0

I have a test set application written using LabWindows 2013 SP1 that sends data over a USB connection to a radar system.  The application sends data using viWrite to a serial port connection on a radar system.  This application worked fine on three of our old test set systems. 

 

We recently bought new computers to develop more test sets.  When I try running our program on the new systems, I'm finding that the data transmitted in the USB message send is being garbled.  Random sections of the message are being overwritten with garbage. 

 

The new systems have a different BIOS, but all the computers are running Windows 7 Ultimate or Enterprise service pack 1 (64-bit), all are Intel I7s, and all have the same LabWindows version.

 

Attached are lists of the software installed on one of the original systems (PLATE 3) and one of the new ones (PLATE 5).  Is there anything installed that might be interfering with the USB message send?  Or anything else that might cause this problem?

Help on shared libraries from Labview to Labwindows

$
0
0

Hello,

 

My problem is: I have a spectrometer HR 4000 from Ocean Optics. I want to control it from labwindows and, from that, integrate it to other labwindows program.

I have .vi from NI to control the spectrometer from labview:

http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=7833BD4A31DA1274E04400144FB7D21D

The .vi works perfectly with the spectrometer.

Then, I build a shared libraries with the usual procedure with the .vi I need. I have now a .h, .lib and .dll.

.h is given at the end.

What I do is:

 

I use the viFindRsrc function to have a char of my instrument.

The function from the labview needs a VISA ressource name.

From this subject: http://forums.ni.com/t5/LabVIEW/How-to-pass-Visa-Resoure-Name-parameter-to-labview-dll-in/td-p/2498400

I know that I need to put a string control to a VISA ressource name.

What I did: I use that program:

http://digital.ni.com/public.nsf/allkb/4737E4A5E44A81D38625698500576617

 

I rebuilt the shared libraries with this program and the other .vi I need to control the spectrometer.

Then I call StrToVISAIo first, and the reste after.

What I have is:

 


                

uintptr_t VISAResourceNameOut;
Cluster SpectralWaveform;
int32 elmtCount=32000;
AllocateDoubleArray1 (elmtCount);
AllocateDoubleArray (elmtCount);

StrToVisaIO(instrDescriptor, &VISAResourceNameOut);
OceanOptics20004000_Initialize(&VISAResourceNameOut, &VISAResourceNameOut);

OceanOptics20004000_ReadSpectralWaveform(&VISAResourceNameOut, &VISAResourceNameOut, &SpectralWaveform);
OceanOptics20004000_Close(&VISAResourceNameOut);         

 

 

 

Where instrDescriptor is a char I get with  viFindRsrc, that's not the problem.

Everything compile fine, but, when I want to know what's in SpectralWaveform, I get:

SpectralWaveform.elt1 and SpectralWaveform.elt2 are unitilialized.

 

Here is the full .h

#include "extcode.h"
#pragma pack(push)
#pragma pack(1)


#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
	int32_t dimSize;
	double elt[1];
} DoubleArrayBase;
typedef DoubleArrayBase **DoubleArray;
typedef struct {
	int32_t dimSize;
	double Numeric[1];
} DoubleArray1Base;
typedef DoubleArray1Base **DoubleArray1;
typedef struct {
	DoubleArray elt1;
	DoubleArray1 elt2;
} Cluster;

/*!
 * StrToVisaIO
 */
void __cdecl StrToVisaIO(char String[], uintptr_t *VISAResourceName);
/*!
 * Establishes communication with the instrument and optionally performs an 
 * instrument identification query and/or an instrument reset.  It also places 
 * the instrument in a default state needed for other instrument driver 
 * operations.  Therefore, call this VI before calling other instrument driver 
 * VIs for this instrument.  Generally, you need to call the Initialize VI 
 * only once at the beginning of an application.
 */
int32_t __cdecl OceanOptics20004000_Initialize(uintptr_t *VISAResourceName, 
	uintptr_t *VISAResourceNameOut);
/*!
 * Performs an instrument error query before terminating the software 
 * connection to the instrument.
 */
int32_t __cdecl OceanOptics20004000_Close(uintptr_t *VISAResourceName);
/*!
 * Configures the integration time of the spectrometer. The integration time 
 * is the amount of time that the device collects light before digitizing it 
 * and sending it out over the USB.  The longer the integration time, the more 
 * light it may collect. 
 */
int32_t __cdecl OceanOptics20004000_ConfigureIntegrationTime(
	uintptr_t *VISAResourceName, uint32_t IntegrationTime6000, 
	uintptr_t *VISAResourceNameOut);
/*!
 * Displays the spectrum vs wavelength in a waveform graph.
 * 
 * <b>Note:</b>  Do not put this VI in a loop if performance is a concern.  
 * Please see the <b>Ocean Optics 2000 4000 Acquire Continuous Waveform</b> 
 * example for an example of how to do continuous acquisition.
 * 
 * 
 */
int32_t __cdecl OceanOptics20004000_ReadSpectralWaveform(
	uintptr_t *VISAResourceName, uintptr_t *VISAResourceNameOut, 
	Cluster *SpectralWaveform);
/*!
 * Returns the intrument status information. Information included are number 
 * of pixels, intergration time, packets in spectra, packet count, USB speed 
 * and Lamp status.
 * 
 * <B>Note:</b>
 * Not supported by USB2000 and HR2000
 */
int32_t __cdecl OceanOptics20004000_QueryStatus(uintptr_t *VISAResourceName, 
	uint16_t *USBSpeed, LVBoolean *LampStatus, uint8_t *PacketCount, 
	uint8_t *PacketsInSpectra, uint32_t *IntegrationTime, 
	uintptr_t *VISAResourceNameOut, uint16_t *NumberOfPixels);

MgErr __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module);

/*
* Memory Allocation/Resize/Deallocation APIs for type 'DoubleArray'
*/
DoubleArray __cdecl AllocateDoubleArray (int32 elmtCount);
MgErr __cdecl ResizeDoubleArray (DoubleArray *hdlPtr, int32 elmtCount);
MgErr __cdecl DeAllocateDoubleArray (DoubleArray *hdlPtr);

/*
* Memory Allocation/Resize/Deallocation APIs for type 'DoubleArray1'
*/
DoubleArray1 __cdecl AllocateDoubleArray1 (int32 elmtCount);
MgErr __cdecl ResizeDoubleArray1 (DoubleArray1 *hdlPtr, int32 elmtCount);
MgErr __cdecl DeAllocateDoubleArray1 (DoubleArray1 *hdlPtr);

#ifdef __cplusplus
} // extern "C"
#endif

#pragma pack(pop)

 Everything compile fine, and when I run it, I have no error.

 

So whether I'm not giving it the good VISA ressource name (maybe I should change the string inside the .vi, but not sure how to do that), whether something with the pointer is quite wrong (see the prototype function in the .h). Maybe I need to initialize SpectralWaveform.elt1 and SpectralWaveform.elt2 corrrectly. But not sure how to do this either, with this struct.

 

What I want at the end is to display the spectrum.

 

Any idea ?

 

Best Regards,

Geoffrey.
            
           


ServerTCPRead timeout error

$
0
0

Hello,

            Currently I am facing ServerTCPRead timeout error but the handle between Server and Client is positive . Once the time out exist I need to disconnect my client and connect . Is any chanche I can overcome timeout error -11 

 

 

Thanks in Advance

problème avec CmtGetLock

$
0
0

Bonjour,

 

Je rencontre un problème dans mon application finale qui est integrée sous teststand. J'utilise actuellement CVI 2013. Mon IHM comportent des boutons qui font appellent à des callbacks. En parrallèle, mon appli contient 2 timers qui arrivent à échéance toute les 200ms et 100ms. Dans l'un de ces timers la boucle ci-dessous est présente :

 

        do
        {
            SetCtrlVal (handle, IHM_LED,TRUE);  //allumage de la led
            etat = CmtGetLock(Mutex_Log);
            DELAY_MS(5.0);  // attente de 5ms
            Loop ++;
        } while((etat !=0)&&(Loop < NBLOOPS_Log));
        SetCtrlVal (handle, IHM_LED,FALSE); //extinction de la led

        ....... 

        .......

       etat = CmtReleaseLock(Mutex_Log);

 

 

Le problème est que si :

   - PAS d'appui sur les boutons => fonctionnement correct.

   - clic court ou double clic => fonctionnement correct.

   - clic long  => fonctionnement correct les timers continuent à tourner.

   - clic ou double clic très rapide (pas systematiquement) => le programme reste bloqué sur CmtGetLock et donc mon IHM reste figée, les timers sont arretés.

 

Mes boutons sont gerés par une callback, mes timers par 2 callback, n'y a t-il pas un problème sur la gestion des evenements ?

Je débute dans labwindows et je ne maitrise pas bien les commandes CmtxxxLock, mais cette boucle était déjà existante dans un projet precedent et ne semblait pas poser problème.

 

Merci par avance pour vos contributions.

Wordreport Class Not Register

$
0
0

I am using Wordreport.fp and Excelreport.fp out of the CVI2013\tooslib\activex directory.  When I run my application on the target machine I get an error "Wordreport Class Not Register".  So that means the ActiveX component has not been loaded.

 

Where do I find the ActiveX component?  How do I get it loaded onto the target machine?  Do I have to load Microsoft Office?

out of bound indicator controls

$
0
0

Hi

I need a control which indicate the value range need to within 2 ~ 5V for example. I need

one (or two) controls to indicate it either out of upper bound or low bound, which controls

shall I use? (And I don't need display the real value is, only knows it's OK or fault(out of bound)).

 

(I'm using CVI 2015).

 

Thanks

write to excel file

$
0
0

hello,

 

i'm a begginer in Labwindows CVI so excuse me for the poor code.

 

i've noticed there are a lot of answers for writing to excel file but my problem is not similar.

i read numbers from a sensor into an array and i want to copy them in real time to excel file.

the problem is that i dont know how to extend the range of the rows in the excel automaticly without manually enter the row's number (for example "A1:A10")

here is a part of the program:

 

double val[]={8.7,9.2,1} ; // example of array of numbers

ExcelRpt_WriteData (rawDataWorkSheetHandle, A1,ExRConst_dataDouble, 1, 1,&val[0]);

ExcelRpt_WriteData (rawDataWorkSheetHandle, A2,ExRConst_dataDouble, 1, 1,&val[1]);

ExcelRpt_WriteData (rawDataWorkSheetHandle, A3,ExRConst_dataDouble, 1, 1,&val[2]);

 

i've tried to use these type of writing:

A[i]

A[i+1];

A[i+2];

 

but it didnt work.

i asume there is a more useful way to do it but i dont know how.

 

i appreciate all the help i can get!

Viewing all 5339 articles
Browse latest View live


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