How to acquire from various AI channels simultaneously with a different range for each one?
In LabView I have found some examples but in C there isn't seem to be any.
How to acquire from various AI channels simultaneously with a different range for each one?
In LabView I have found some examples but in C there isn't seem to be any.
I am programming a real time application and I have a PXI 8512 card. My first order of business is to get 5-byte messages from transducers that are broadcasting at 10 Hz on known message IDs. There are no CAN/XNET samples in my "realtime" CVI sample folder. I have found some in the nixnet folder but they are Windows based so I have to hack a lot of stuff out of them.
Thank you.
I have an issue with a dll that was previously working in both released and in debug mode. Now if I create a released .exe it functions. If I run it in debug mode the call to the dll function never returns. eventually whatever is occurring behind the scense prevents the released.exe from working also. I do not know if I accidenatally changed a setting in the cvi compiler that broke the code. Is there a way to default cvi2010 settings?
Hi all!
I am trying to pass a pointer to an array of pointers from my main application to a DLL through a static library. Everything seems to work up to the point where the DLL function is called, and once the DLL tries to pull in the reference to the array, it instead pulls in the value of the first element of the array, which messes everything up inside the DLL. My sample code is below:
FROM THE MAIN FUNCTION:
void CVICALLBACK CB_INSTRUMENT_CONFIG (int menuBar, int menuItem, void *callbackData, int panel)
{
char MAX_COUNT_str[MAX_COUNT/1024];
char parentPanelHandle_str[MAX_COUNT/1024];
snprintf (MAX_COUNT_str, sizeof (MAX_COUNT_str), "%i", MAX_COUNT);
snprintf (parentPanelHandle_str, sizeof (parentPanelHandle_str), "%i", parentPanelHandle);
char *argv[] = {WorkingDir, MAX_COUNT_str, apiRTFileName, parentPanelHandle_str};
DLL_LOAD_FUNCTION (LibDir, "Instrument Configuration.dll", "InitUIForDLL", argv);
}
FROM THE STATIC LIBRARY FUNCTION "DLL_LOAD_FUNCTION":
int DLL_LOAD_FUNCTION (char* LibDir, char* LibName, char* FuncName, char *argv[])
{
typedef int (*MYPROC)(char**);
HINSTANCE hinstLib; //Handle to the DLL
MYPROC ProcAddress; //Pointer to the function
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
char LibPathandName[512] = "\n";
int returnValue;
char UserMsg[512];
snprintf (LibPathandName, sizeof (LibPathandName), "%s\\%s", LibDir, LibName);
hinstLib = LoadLibrary(LibPathandName);
if (hinstLib != NULL)
{
ProcAddress = (MYPROC) GetProcAddress(hinstLib, FuncName);
if (fRunTimeLinkSuccess = (ProcAddress != NULL))
{
returnValue = (ProcAddress)(argv);
fFreeResult = FreeLibrary(hinstLib);
}
else
{
snprintf (UserMsg, sizeof (UserMsg), "Unable to get Address of Function \"%s\" from Library file \"%s\".\n\nCheck name of function and prototype in header file.", FuncName, LibName);
MessagePopup("ERROR!", UserMsg);
}
}
else
{
snprintf (UserMsg, sizeof (UserMsg), "Unable to locate Library file \"%s\" in:\n%s", LibName, LibDir);
MessagePopup("ERROR!", UserMsg);
}
return 0;
}
FROM THE DLL "Instrument Configuration.dll":
int InitUIForDLL (char *arginv[])
{
MAX_COUNT_LOCAL = atoi(arginv[1]);
char apiRTFileName [MAX_COUNT_LOCAL/16];
strncpy (WorkingDir_LOCAL, arginv, sizeof (WorkingDir_LOCAL));
strncpy (apiRTFileName, arginv, sizeof (apiRTFileName));
.
.
.
}
When I run this code, arginv in "Instrument Configuration.dll" ends up being the first pointer value in the argv array. I've tried adding references and de-references all over the place to no avail. What am I doing wrong?
(Disclaimer: I have basically learned C all by doing, examples, and help files, so I am by no means good at it )
Hi
I am currently working for a project which will run on a Raspberry PI with an arm processor. It is under Linux and I shall create the code with the CodeBlocks IDE.
I am now wondering if it is possible to create the software under CVI and run it under Debian Linux? If yes, is it possible to run it on a Raspberry that I can use CVI for this project? Raspberry PI runs under Raspbian which is a Debian Distribution of Linux.
So the question is, does CVI run under Debian Linux?
thx
Oliver
i have to get data from two joysticks and display it , unfortunatle till now i am unable to make any progress, i have read about VISA , calling .dll and stuff but till now i dont have any idea what to do. i have found good labview example but my target is to use labwindows , kindly help me in this regard i shall be really thankful to you , your help will be highly appriciated , please give me some direction that how to read data from joystick and display it or send it on serial port ,
thanks in advance
ahsan
Hello everyone:
my job contains some mutex selections,and I try to make them into radio button groups.
I opened a new panel and tried the RadioBG_XXXX functions,it worked fine.But when I supposed to put that panel into tab by using InsertPanelAsTabPage,radios came out,while mutex-selection effects negated.
Someone got me an idea pls?
code works:
int panelHandle = LoadPanel (0, "test_sele.uir", Sele); int ctraryHandle = NewCtrlArray (panelHandle); RadioBG_CreateFromControlArray (ctraryHandle); RadioBG_AddOption (ctraryHandle, "Radio 1", -1, 15, 15); RadioBG_AddOption (ctraryHandle, "Radio 2", -1, 30, 15); RadioBG_AddOption (ctraryHandle, "Radio 3", -1, 45, 15);
code doesn't work:
int panelHandle = LoadPanel (0, "test_sele.uir", Sele);
DeleteTabPage (mainPanelHandle, Main_Tab, 0, -1); InsertPanelAsTabPage (mainPanelHandle, Main_Tab, -1, panelHandle); int tpHandle = 0; GetPanelHandleFromTabPage (mainPanelHandle, Main_Tab, 0, &tpHandle); int ctraryHandle = NewCtrlArray (tpHandle); RadioBG_CreateFromControlArray (ctraryHandle); RadioBG_AddOption (ctraryHandle, "Radio 1", -1, 15, 15); RadioBG_AddOption (ctraryHandle, "Radio 2", -1, 30, 15); RadioBG_AddOption (ctraryHandle, "Radio 3", -1, 45, 15);
In my CVI 2009 project I have a Distribution kit setup with my company's logo in the 'Welcome background image'. The image is a .bmp file size 500x350. My problem is when I run the distribution install file and the Welcome page comes up the image looks grainy, actually really crappy. Bringing the original bmp up in either Photoshop, Paint and/or windows viewer it looks fine.
This also is the case in my banner bitmap, 500x70, on the rest of the install wizard pages.
Any suggestions on how to get my image to look more 'sharp' in the welcome page?
Thanks
I have a CVI 2010 distribution kit for my applaication that includes a C# application. I need the NI can drivers, 488 and etc. for the c# app included under Files in the Edit Installer dialog. I include these drivers under Drivers & Components, such as NI-488.2.3.0, NI-CAN 2.7.4, NI-DAQmx Core Runtime 9.8 and so on.
When I distribute the installer to say a bare win7 machine everthing install correctly but when I run my C# application I get an error that states the 'NationalInstruments.common.dll version 130.0.35.190 can no be found'. In my C# application, which I build under Visual Studio 2010, I refereence NationalInstruments.common.dll to C:\Windows\assembly\GAC_MSIL\NationalInstruments.Common\13.0.35.190__18cbae0f9955702a\NationalInstruments.Common.dll.
How would I get the client's machine to have the correct NationalInstruments.common.dll so my c# app will run? Is there a way to add it via the CVI's Edit installer under drivers & Components? What National Instruments package installs the NationalInstruments.Common.dll on my C# dev machine?
Thank you.
I am tryting to create a distribution kit for an application which i created which communicates through NIDAQ hardware. once i install the application in the computer its showing some error with the import wizrd for NI DAQ. Please find trhe error report here.
Date: 5/12/2015 12:07:15 PM
MAX version: 5.3.3
Importing...
========
NI-DAQmx 9.5:
cDAQ-9178: "cDAQ2"
NI 9223: "cDAQ2Mod1"
NI 9223: "cDAQ2Mod3"
NI 9213: "cDAQ2Mod5"
cDAQ-9178: "cDAQ1"
-229750
Internal Software Error occurred in MIG software. Please contact National Instruments Support.
*** Import FAILED ***
NI-DAQmx 9.5: error code 0x80004005
Windows Explorer in Windows 7 automatically looks into .zip archives. When I use FileSelectPopupEx, and tell it to start in the archive, it correctly lists all the files in the archive. When I try to select one of them, it returns with return code 2 ("New File Selected"), and there is no returned value in the pathName parameter.
Has anyone else encountered this behaviour? I need to look in a lot of zipped archives, and I thought this would save me some time. Or are there any utility libraries for handling zip archives and extracting files from them?
I am tryiing to buid a installation kit in CVI LAbwindows which uses NIXNET card to communicate with a hardware unit. What are the drivers needed to build the application. I have NIMAX 5.5, labwindows 2012. When i try to select the manage distribuutions> Advanced settings> and try enabling the import automatically, its not getting enabled. So i export it manually specifying the drivers and COM ports. Its sucessfully build. Then i tried installing the setup file in the same laptop. INstalled successfully, restarted the laptop, get the message saying import wizard with NI MAX failed automatically. DO it manually. that also failed and got an error report. What am i doing wrong. Is it because some drivers are not installed ?
Errpr report
Date: 5/12/2015 12:07:15 PM
User: kfarkas_2
MAX version: 5.3.3
Importing...
========
NI-DAQmx 9.5:
cDAQ-9178: "cDAQ2"
NI 9223: "cDAQ2Mod1"
NI 9223: "cDAQ2Mod3"
NI 9213: "cDAQ2Mod5"
cDAQ-9178: "cDAQ1"
-229750
Internal Software Error occurred in MIG software. Please contact National Instruments Support.
*** Import FAILED ***
NI-DAQmx 9.5: error code 0x80004005
I previously had an implementation issue while trying to produce Bode plots for hardware my team has designed. I have now successfully been able to produce the expected data, with one issue. Some of the phase data points are the reciprocal of what is expected. I will explain the process used...
The hardware I am connecting to allows me to inject signals on channels, as well as stream these channels to my PC application for analysis. The function I am trying to replicate is a frequency sweep, as follows:
- commanding the hardware to override a channel (the stimulus) with a sine wave of given frequency, f
- stream the stimulus channel as well as its response channel for a given number of cycles, P
- perform analysis ("transfer function") on both stimulus and response channels' streamed data
- log the frequency (f) with the corresponding calculated magnitude and phase for use to produce a Bode Plot
- increase frequency (f) and repeat steps
This code sample is the "analysis" performed:
int i, MaxMagIdx, DontCareIdx; double *TimeInMag,
*DontCareArr, TransferReal, TransferImg, TransferMag, TransferPhase, DontCare, AdjFreq; NIComplexNumber *TimeSweepIn, *TimeSweepOut, *FFTSweepIn, *FFTSweepOut; TimeSweepIn = malloc(gSweepCountMax * sizeof(NIComplexNumber)); TimeSweepOut = malloc(gSweepCountMax * sizeof(NIComplexNumber)); FFTSweepIn = malloc(gSweepCountMax * sizeof(NIComplexNumber)); FFTSweepOut = malloc(gSweepCountMax * sizeof(NIComplexNumber)); TimeInMag = malloc(gSweepCountMax * sizeof(double)); DontCareArr = malloc(gSweepCountMax * sizeof(double)); int InputSigIndex; unsigned char OverrideMsg[L_ADC_OVERRIDE_RQ] = {0}; for (i=0;i<gSweepCountMax;i++) { TimeSweepIn[i].real = gSweepInArr[i]; TimeSweepOut[i].real = gSweepOutArr[i]; TimeSweepIn[i].imaginary = 0.0; TimeSweepOut[i].imaginary = 0.0; } CxFFTEx (TimeSweepIn, gSweepCountMax, gSweepCountMax, NULL, FALSE, FFTSweepIn); CxFFTEx (TimeSweepOut, gSweepCountMax, gSweepCountMax, NULL, FALSE, FFTSweepOut); for (i=0;i<gSweepCountMax;i++) { ToPolar (FFTSweepIn[i].real, FFTSweepIn[i].imaginary, &TimeInMag[i], &DontCareArr[i]); } MaxMin1D (TimeInMag, gSweepCountMax, &DontCare, &MaxMagIdx, &DontCare, &DontCareIdx); CxDiv (FFTSweepOut[MaxMagIdx].real, FFTSweepOut[MaxMagIdx].imaginary, FFTSweepIn[MaxMagIdx].real, FFTSweepIn[MaxMagIdx].imaginary,&TransferReal, &TransferImg); ToPolar (TransferReal, TransferImg, &TransferMag, &TransferPhase); TransferMag = 20 * log10 (TransferMag); TransferPhase = RadToDeg (TransferPhase); AdjFreq = (double)((unsigned long)(gSweepFreq*0x200000000/(double)50000000)) * 50000000/(double)0x200000000; fprintf(Logfile_Handle, "%lf\t%lf\t%lf\n", AdjFreq, TransferMag, TransferPhase); free(TimeSweepIn); free(TimeSweepOut); free(FFTSweepIn); free(FFTSweepOut); free(TimeInMag); free(DontCareArr);
It works nearly perfectly. The issue is that the calculated phase will sometimes be positive when it should be negative, and vice versa.
Here is a plot of the data produced:
This is what is expected:
Here are both overlayed:
The expected plot was produced by cheating the log file. I went in and all I did was change the incorrect points to/from negative values. I want to eliminate this step. As you can see, if the incorrect data is mirrored on the zero-line, it would be what we expect. This "expected" data matches what my co-worker's analyzer hardware (Venable device) produces when used on our device.
We believe that the issue is not with the complex math performed, but an issue in the FFT function, or the selection of the index to use on the array of data.
Dear all,
I sat all day here trying to figure out what is wrong with my Labwindows data acquisition systems. To be specific, I created multiple channel data acqusition (7 signals from 6 different instruments) using LabWindows 2013 on a Win7 OS. Five signals are taking at the same time, and another two needs to be done separately. To realize, I created two DAQmxCreateAIVoltage tasks. However, when running, it turns out the task created second did not give any data other than zeros. I switched the creating sequence of the two tasks. It turns out the task created second always do not give any signal.
My question is, it is allowed to create two data acquistion taskhandles at the same time in one single application? If not, is there a way to circumvent it?
Thank you for your suggestions in advance.
I want to use the complex numbers functions of C99 which according to this page http://digital.ni.com/public.nsf/allkb/73AEAD30C8AF681A86257BBB0054A26B should be possible. However, Labwindows can not find the complex.h header file in the #include <complex.h> statement.
How can I get this to work?
Hi everyone,
I have a problem with the CloseCom() function, which sometimes freezes my application when tries to close a COM port. All I can do is terminate the execution of the application through the STOP button, but this does not release the COM port, and the application window does not close. In turn, I am not able to use that serial port again without rebooting the machine.
I checked this in debug mode and the program flow gets stuck while executing the CloseCom() function, thus I don't know what is the real cause as I don't know how to check deeper. This happens in both debug and release configurations, for both 32 and 64 bits program versions. This happens only with FTDI cables, in particular we use the TTL-232R-5V-AJ ( http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm ) to communicate with external hardware. I can exclude it is a problem from a specific cable as I tried several ones, and all fail in the same way.
This is the code I use for closing the COM port:
int CVICALLBACK QuitCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: if(n_com)
if (hw_type) ComWrtByte (n_com, 0x41); else { ComWrtByte (n_com, COD_SCHEDA); ComWrtByte (n_com, COD_COMMAND_STOP ); ComWrtByte (n_com, COD_SCHEDA); } CloseCom (n_com); QuitUserInterface (0);
} break; } return 0; }
By looking at the following post:
it seems it could be a General Protection Fault problem (even if I don't get any error, the program just freezes) as I send bytes just before closing the COM port. Thus I tried to modify the code as follows:
int CVICALLBACK QuitCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: if(n_com) if (hw_type) ComWrtByte (n_com, 0x41); else { ComWrtByte (n_com, COD_SCHEDA); ComWrtByte (n_com, COD_COMMAND_STOP ); ComWrtByte (n_com, COD_SCHEDA); } FlushInQ(n_com); FlushOutQ(n_com); Delay(0.1); CloseCom (n_com); QuitUserInterface (0); } break; } return 0; } ----- OR ----- int CVICALLBACK QuitCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: if(n_com) if (hw_type) ComWrtByte (n_com, 0x41); else { ComWrtByte (n_com, COD_SCHEDA); ComWrtByte (n_com, COD_COMMAND_STOP ); ComWrtByte (n_com, COD_SCHEDA); } while(GetOutQLen(n_com)>0){}; CloseCom (n_com); QuitUserInterface (0); } break; } return 0; }
with no success. As I said, the problem seems to show up only with that cable type (other devices attached through their own serial/USB cables never fail). However, the same cable does not fail when used in other environments, such as MATLAB.
I am using LabWindows/CVI 2010 version 10.0.1 (434). I would like to avoid to update the system as this usually is a time consuming operation.
Please let me know if you need any other information
Thank you in advance
i have a program in which i have to aquire / send data from serial port which is time critical ie 10 ms , my quension is that what are my options, can i use threads or use asynctimer (that can have 16 independent threads). i understand how to use asyncronus timer but my question is that are there anyother ways of creating threads in labwindows and are they as effective as asyncronous timer, please guide me in detail.
thanks in advance
regards ahsan
I have a TCP connection to a device that sends its short message (< 100 characters) in chunks. Unfortunately these chunks seem to be random. I am having some difficulty tokenizing the data and getting it into five floats. Is there any way I can make this TCP callback fire only when a newline character is received, or a better method of putting the message together? I'm going to be dealing with much larger TCP messages for other devices, so it will be good to get this issue resolved on a small scale problem.
For whatever reason, my logic is allowing incomplete messages to be tokenized. The message leads with BARO and ends with \r\n.
receiveBuf[dataSize] = '\0';
if (strstr(receiveBuf,"\n") == NULL)
strcpy(Vaisala.Message, receiveBuf);
else
{
if ((strlen(Vaisala.Message) + strlen(receiveBuf) < 100) || (strstr(receiveBuf,"BARO") == NULL))
{
strcat(Vaisala.Message, receiveBuf);
Vaisala.Message[strlen(Vaisala.Message) - 2] = '\0';
token = strtok(Vaisala.Message, "\t");
token = strtok(NULL, "\t");
Vaisala.Barometric = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.DryBulb = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.WetBulb = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.Dewpoint = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.RH = atof(token);
}
else
memset(Vaisala.Message, '\0', 100);
status=flex_insert_program_label (PCI7344, IndexStoppedCheckStartMotion);
if(status) return status;
status = flex_read_var (PCI7344,MotionStart, 0);
if(status) return status;
status = flex_jump_label_on_condition (PCI7344, 0,NIMC_CONDITION_GREATER_THAN,
0x0, 0x0, NIMC_MATCH_ALL, StartMotion);
status = flex_jump_label_on_condition (PCI7344, 0,NIMC_CONDITION_TRUE, 0x0, 0x0,
NIMC_MATCH_ALL, StartCheckForIndex);
if(status) return status;
根据以上程序如何来解读跳转函数(flex_jump_label_on_condition(boardID, resource, condition, mustOn, mustOff,matchType, labelNumber)中的各个参数在执行跳转时的作用?
英文水平确实较差,资料上的解读确实难以深刻领悟,真切求助各位指点,谢谢!!!(希望是中文)
Dear Users of LabWindows,
I am using "StdDev" from "analysis.h" in a program.
I am using LabWindows 2012 and Win 7 64 Bit.
The program gives me a (right) calculation result on my development PC by using "StdDev".
On a PC with only the runtime I receive a different (wrong) calculation result.
What could be the problem?
I watched in the forum about half an hour to find some similar error but I only found hints for the two solutions below:
Actually I haven't tested these two possible solutions. I asking myself and this forum: Could this be the solution?
I am asking myself because in my actual project I get no error:
Could the above described error also be caused by different "Country Settings" of the Windows-System itself? This means "," instead of ".".
Best greetings to all who may help me.