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

Sending Arrays of Hex numbers to a serial port

$
0
0

I was wondering if anyone could give some help as to how I could send an Array of hex numbers to a Serial Port. I have the array data type as unsigned char, which is correct in this instance.

 

However using the ComWrt( function, the buffer is required to be data type char.

 

How is it possible to change from an unsigned char data type to char? and ultimately will this solve my problem and allow me to send packets to the serial port?

 

Thank in advance.

 


LabWindows CVI Pre/Global Include

$
0
0

Hi,

 

I am looking for a way to have the compiler tack on an include statement for a global header file, the equivalent of manually putting #include "some_file.h" in all of my source files, which I don't want to do since this code is common and used among a log of projects so I'm trying not to clutter it or change it's source code since it already functions well for all other programs it's used in.

 

Code repositories which I am inheriting use functions, such as fabsf() and powf(), but it appears I only have access to the double versions: fabs() and pow().

 

It would make the code too cluttered to surround all uses of the math function variants which I don't have access too to use the other version:

 

#if defined(_THEIR_CODE_)
/*...*/fabsf(some_variable)/*...*/
#elif defined(_MY_CODE_)
/*...*/fabs(some_variable)/*...*/
#endif

Instead, I have made a file, lets call it compatibility.h, which includes macros which define these to use the double version:

#define atan2f(arg, args...) atan2(arg, #args)
#define sqrtf(arg, args...) sqrt(arg, #args)
#define fabsf(arg, args...) fabs(arg, #args)
#define powf(arg, args...) pow(arg, #args)

Now again I cannot clutter up the code adding a macro to check if it's my version and then #include "compatibility.h", instead I need to have the compile/build process automatically include this file in all of my source code (referred to as "global include" or "pre include" in other contexts)

 

From everything I've looked at I have not found a solution to this.

 

LabWindows CVI 2017 uses Clang 3.3 so I have been also looking to see if there is a command line option I could provide which would allow me to specify a pre/global include but haven't found that either.

 

 

Thanks!

SHB and DAQmx

$
0
0

I develop in CVI, thus posting this here.

 

Has anyone successfully implemented a stand-alone Win10Ent SHB with DAQmx and data acquisition hardware.

dsadsadsa

Where is the UI browser in classic view ?

$
0
0

Hello, hello,

I never use the integrated view as I like to have windows of code and UI next to each others. But I just discovered that the integrated view has a user interface browser and i cannot find it in the classic view. Where is it ?

 

Corollary to this question: how do I edit a control array in classic view ? I don't see any indicator that there's even a control array anywhere in the interface.

Embed a website not compatible with internet explorer into application

$
0
0

Hi,

I've always used activex control of Internet Explorer to embed a website into my program,

however the website I have to embed this time is not compatible with Internet Explorer but only with Chrome, Firefox, Safari and Edge.

How can I do to show the website without using Internet Explorer?

I've already tried firefox ActiveX control http://www.iol.ie/~locka/mozilla/mozilla.htm but I cannot make it work.

Hey LabVIEW ever thought about putting the TOOLS pallet in the TOOLS tab?

Are datasockets obsolete or deprecated ?

$
0
0

Hello, hello,

title says it all. I was reviewing the list of stuff I don't know about CVI and I seemed to recall that datasockets were replaced by network variables at a certain stage. Am I correct in that assumption ?

Thanks


Where to find the nicompute.lib, nicompute.h

$
0
0

I am upgrading a CVI project from 32 bit to 64 bit, and in the existing 32 bit project the nicompute.lib and nicomute.h files are being used.

I am unable to find those files in 64 bit, even i installed the NI GPU Analysis toolkit but still couldn't find the respective files for 64 bit.

 

Where to locate these files, which toolkit or add-on do i need to install?

 

parsing ASCII as hex from a buffer

$
0
0

 

<rant> Good grief, working with strings in C is just painful </rant>

I'm looking for an efficient way to extract ASCII-encoded bytes from a character buffer.  For instance, I have the following MODBUS data packet received from a slave instrument (hex format):

 

3A 30 31 30 33 30 32 30 32 42 45 33 41 0D 0A

This instrument and my driver are working in the ASCII domain, so this actually looks like:

 

:01030202BE3A\r\n

 

Now the trick here is that certain groups of bytes must be "lumped" together to be understood.  For instance, here is how I will need to parse these into the appropriate elements of the protocol:

 

element	byte width	data type
:	1		char
01 	2		char
03 	2		char
02 	2		char
02BE  	4		short 
3A 	2		char
\r	1		char
\n	1		char

Not really a big deal, but I'd like to avoid "hard-coding" some of these widths, particularly when dealing with variable output register data.

 

I had planned to use sscanf to parse these out of the string, but I discovered that you can't use variable width specifiers ( %*X ) like you can with sprintf.

 

For instance, here's what I do to build my ASCII MODBUS queries:

 

sprintf(query, 
"%c%s%0*X%s",
MODBUS_MSG_Header, // :
qryPayload, // string
MODBUS_MSG_LRC_LEN, // 2
Modbus_CalcLRC(qryPayload), // lLRC
MODBUS_MSG_Trailer); // CR LF

 

Then I looked into using the CVI formatio.h Scan function.  It has has something close:

 

s = "ffff";
Scan (s, "%s>%x[b2]", &a); /* result: a = 65535

But it doesn't appear that I can handle adjacent characters in an array with no whitespace.

 

 

Am I (probably) overlooking something simple here?

edge counting with USB-6229, sampsPerChanRead=0 at first iteration

$
0
0

Hi everyone!

I am using a USB-6229 M-series DAQ card for photon counting.

Counter 0 is used to produce a train of pulses at 40 Hz, which is the gate of counter 1. The source of counter 1 is the signal coming from a photodetector. In other words, I have implemented a code for buffered edge counting with an external clock in continuous sample mode. Both counters begin to work at the same time, once they have received the same trigger, a digital output (I used the Start Trigger for counter 0 and the Arm Start Trigger for counter 1). Then, counter 1 will list the counts read every 25 ms. The function that actually reads the samples is

int32 DAQmxReadCounterU32 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, uInt32 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

where sampsPerChanRead is the actual number of samples read from each channel.

Everything works fine, but I cannot understand why the first iteration of the loop always gives sampsPerChanRead = 0, as it can be inferred running the code in debugging configuration. Only the second time that DAQmxReadCounterU32 has been run, sampsPerChanRead is different from zero. Why during the first iteration no sample is read? Which could be the cause? Could the counter arm play a role?

Thank you for your help.

Regards,

Giulia

DAQmx generate and read clock pulses

$
0
0

I am using

DAQmxCreateTask ("", &CE_Handle);
DAQmxCreateCOPulseChanTime (CE_Handle, "/6612/ctr0", "", DAQmx_Val_Seconds, DAQmx_Val_High, 0.01, 0.000015, 0.01);
DAQmxCfgImplicitTiming(CE_Handle, DAQmx_Val_ContSamps, 0);
DAQmxStartTask(CE_Handle)

to have my 6612 DAQ card output a pulse every 10mS

 

I now want a function which will block until one of these pulses occurs, can I read this clock line even though it is generating pulses? is there a DAQmx function which will wait for an edge?

[CVI2015] CopyFile copy the file but still empty

$
0
0

Hello, 

 

I have coded some line to zip files into one archive file (.zip) then I wanted to copy it to another folder. 

The problem is when I use CopyFile, the new copy file is created, but still at 0 Kb even if I checked the source file and it is not empty...

So randomly, I got few empty files, with no error (CopyFile return 0).

 

I'm not using windows API. 

The destination folder where I need to copy the file is on remote (drive). 

 

Can someone tell me why I got this ? 

 

Thanks,  

CVI/Labwindows IDE's ActiveX Not Registered

$
0
0

After our IT group reimaged our Windows 7 workstations, Labwindows 2013 is unable to load or create new distributions (.cds). This problem is seen on all of our existing projects and entirely new projects without any code/front panels/etc. When the Manage Distributions window is opened, the new distribution button is selected, the Edit Installer window appears and then the windows are closed without changing any of the options the  "ActiveX Control registered on this computer" popup appears.

 

Does anyone know if an .ocx's needs to be registered for the Labwindows IDE to work?

Obtaining pre-trigger data from triggered aquisition

$
0
0

I am trying to program an application to capture x samples before a trigger and y samples after a trigger.

I am looking at example programs using the DAQmx functions.

The "Acq-IntClk-AnlgStart.c" example captures a block of data occurring after a trigger event happens.  What is the best method to capture and read x samples prior to the trigger event in addition to the block of data after the trigger event?

 

Thanks


Migrating CVI code from windows XP to windows 7

$
0
0

I have an application related to DDE server that runs on Labview CVI in windows XP

I need to make it run on windows 7

So, what all things i need to be focused on to change the CVI code to make it run on windows 7

 

Any kind of help would be appreciated

 

Thank you

http://drozdietblog.com/vascular-x-ca/

$
0
0

Vascular X 

is imperative to be vocal about the men’s concern with the goal that individuals who are experiencing it can likewise discuss up and get assistance from the different items that are available. It is imperative for the complement to be strong and secure for the client. Because of hormonal effect, it motivates the clients to think much better and has the better psychological potential as the entirety. In this way, it is a total bundle. You can appreciate the sex-related advantages that it has alongside encountering substantially

http://drozdietblog.com/vascular-x-ca/

Numbers from Array to Panel

$
0
0

Hello,

I'm new in labWindows. I don't know how to show every values from array in Panel. I always get only one number. Im sorry for my ugly code. Please, help me. Smiley Happy

 

int CVICALLBACK binary (int panel, int control, int event,
						void *callbackData, int eventData1, int eventData2)
{ switch (event)
	{
		case EVENT_COMMIT:
			GetCtrlVal(panelHandle,PANEL_wynik,tablica3);
			sscanf(tablica3, "%d", &t);
			int i=0;
			while(t) 
			{
				tabInt[i++]=t%2;
				t=t/2;
			}
			for(int j=i-1; j>=0; j--)
			{
				g =	tabInt[j];
				sprintf(tablica3, "%ld", g);
			}
			SetCtrlVal(panelHandle, PANEL_wynik, tablica3);
			break;
	}
	return 0;
}

 

UDP error in Release configuration

$
0
0

Hi,

 

I am using CVI2017. I have an application that opens a multicast UPD port for address 230.55.98.11. It works perfect when CVI configured to DEBUG mode. When I switch to RELEASE mode, I am getting an error "HOST NOT FOUND"...

abstract functions in dll

$
0
0

Hello,

 

I have a dll that opens a UDP port to a server and handle all the communication.

I have a function that is triggered once I am getting a data from the UDP port. This function is abstract, I have only definition of it in the dll, but the implementation is outside, in the main application.

 

If I am using a lib instead of a dll, everything is fine. But if I am using a released dll, I can't compile it at all..

 

I am getting an error

error: Undefined symbol '_UDPChatCallback' referenced in "c:\CVI\Drivers\AlTerm\cvibuild.alterm\Debug\alterm.obj".

Viewing all 5353 articles
Browse latest View live


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