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

Numeric meter digital display color?

$
0
0

I have a numeric meter control in my project.  I have the "digital display" visible.  Is it possible to change the font color of just the digital display, without chaning the font color of the meter tick numbers?

 

Background color works nicely, without affecting the rest of the control:

 

SetCtrlAttribute(panel,control,ATTR_TEXT_BGCOLOR,VAL_RED);

 

But a ATTR_TEXT_COLOR change will also turn the rest of the meter font that color.


CVI Distibution with Database Functions

$
0
0

I am working with CVI2012.  I have an application that uses the SQL toolkit.  I made a distribution and installed it on a target machine (Windows 7 with the CVI2012 runtime engine).  However when I install the application on another target (also a Windows 7 machine and also with the CVI2012 runtime engine) I cannot not initialize the database.  The application fails on a call to DBInit(DB_INIT_MULTITHREADED).  I get an error of -100: DB_FAILED_TO_LOAD_DLL.   (I am using  SQL Anywhere 11.)  I know that the ODBC configuration is the same on both targets and I can access the DB manually through Interactive SQL.     

 

I am baffled by this.  After some searching I found that the file "cvidb32.dll" was not in the system32 directory so I copied that over.  Still no joy.  (I would also expect this to be installed when I installed the RTE.  I did not have to manually copy this file on to the computer where the application does work.)  I have checked the forums here have not found a solutionl.  One post discussed running sqldistsupp.exe after the installer.  I tried this and got an error "Driver's ConfigDSN, ConfigDriver or ConfigTranslator failed in function SQLConfigDataSource".  Another post suggested simply adding CVISQLShared.msm to the installer.  I tried this but it did not fixt the problem.  I also tried downloading the SQL Distribution Toolkit help and it turns out the file has no content under the help topics.

 

Clearly something is missing but I don't know what.  I tried running Dependency Walker to find the missing DLL but it did not show anything was missing. 

 

Thoughts?

 

Thanks.

Right Y-axis Hash on Stripchart

$
0
0

I am running a continuous stripchart. Moved from Left Y-axis to right.  There is hash on the zero line, comes and goes.  See the attached images. 

 

Is this a bug in the Stripchart control, or am I setting it up incorrectly.  The exaxt same settings worked perfectly when I was using Left Y-axis.

 

CVI 2013SP1, WinXP and Win7

string array from .net wrapper function

$
0
0

I am using a wrapper function created by the .net controller for a C# dll.  A function of the dll has a string array argument in C#.  The function prototype of the wrapper function for this string array turns out to demand a

 

char ***array

 

for this parameter.  This seems to be different from what CVI Help's sample code demonstrates i.e.

 

// in C#

public double[] MyArrayMethod(string[] array, ...

 

// in CVI 

char * array[]={"a", "b"};

MyArrayMethod(aHandle, array, ...

 

I tried it anyway and got an error message saying

 

Type error in argument 2 to `MyArrayMethod'; found 'pointer to pointer to char' expected 'pointer to pointer to pointer to char'.

 

How should I declare and initialize this variable to use the wrapper function?

 

Thanks

 

Modbus TCP server/slave implementation

$
0
0

Does anybody have experience to implement a modbus server or slave application? My computer needs to communicate with a PLC. The configuration is: computer is TCP server or slave, PLC is TCP client or master. Computer to write input registers for PLC to read. Computer read holding registers from PLC. Cannot find any labwindows examples.

 

Thanks a lot.

spc.fp and spc.h not found, How can I get these files

$
0
0

Hello

 

I get a project from my friend, I opened it and built it, then there was an error, spc.h file not found.

 

Then I double clicked on the file spc.fp , it told me that the spc.fp not found.

 

I have used everything to search them , but I got nothing

 

Does someone can help me to get these files? 

 

Thank you!

 

Clasu.

[need assistance] error LNK2019: unresolved external symbol _CVIXMLLoadDocument

$
0
0

I attempt to load an existing XML file and edit it with Microsoft Visual Studio 2008. Once I add the following function, I get the error LNK2019.

 

CVIXMLDocument doc = 0;

CVIXMLLoadDocument ("c:\\Temp\\AppTestCmd.xml", &doc); 

 

1>01_cpp_list.obj : error LNK2019: unresolved external symbol _CVIXMLLoadDocument@8 referenced in function _main
1>C:\sc\practice\01_cpp_list\Debug\01_cpp_list.exe : fatal error LNK1120: 1 unresolved externals

 

I try to add the files and lib mentioned in the following link, but they do not help.

http://forums.ni.com/t5/LabWindows-CVI/unresolved-external-symbol-MSXML-IXMLxxx/m-p/1127380/highlight/true#M46974

 

How can I fix it? Thanks!

 

Here is the code piece. I have only one file in my MSVS project.

============================================================

#include <iostream>

#include <cvixml.h>
#include <msxmldom.h>
#include <cvirte.h> // NI CVI
#include <userint.h> // NI CVI
#include <utility.h>

using namespace std;

 

int main ()
{
     CVIXMLDocument doc = 0;

     CVIXMLLoadDocument ("c:\\Temp\\AppTestCmd.xml", &doc);

     return 0;
}

 

Numeric control precision: display vs value

$
0
0

With a float or double numeric control there are (sort of) two values: that perceived by the user as restricted by the formatting and the true underlying value. This means the code can set a control's value to 12.345 and the control may display this as 12.3 if one decimal is to be shown. Fair enough. 

 

Now consider a case where the numeric up/down feature is enabled with an increment of 0.1.  The user clicks the "up" once and sees "12.4" in the control. Behind the scenes the value is now 12.445. 

 

Clearly in some cases this is appropriate, while in others it is not. It all depends whether the user intended to enter 12.4, or whether they intended to increment the existing value by 0.1. And there is a clearly an argument that if the difference between those matters, then the display should show those digits. 


I'm not saying anything is broken. I just have a mutli-platform issue where I'm trying to maintain parity in the behavior of the two systems (CVI and non-CVI based), so this detail is important to me now.

 
Does anyone have any tricks / techniques / experience to mitigate this issue? Have you ever tried to modify the increment/decrement buttons to jump to round values based on the display precision?

 
I'd appreciate any thoughts on the topic.

 

 

 

 


utility library error string function?

$
0
0

I've been working on an Error Handler library, culled mostly from these wonderful fora (Roberto!).  I can't seem to find an error code string generator for the functions in the Utiltiy Library though (in particular, functions like RenameFile, CopyFile, GetDir, SetDir, MakeDir, all the file i/o functions).

 

Most of those make mention to negative error types with some plain text explanations.  But there's no mention of a nice code-to-string converter function, as there is in other libraries.  For instance, for the RS232 library, there is GetRS232ErrorString.  For the Formatting & I/O library, there is GetFmtIOErrorString.

 

Am I not seeing it somewhere?  Inside the Utility library, there is a multithreading error code function called CmtGetErrorMessage.

How to Pass Array of Structures from lab Windows CVI to Labview using Network Variables.

$
0
0

Hi All,

I am working with the network variables concept between Labwindows CVI and Labview. I have Structures such as

typedef struct TestData
{
int ID;
char ChlName[50];
unsigned char Stat;
}TestData_t;

 

TestData_t stHwInfo[20];

 

Iam creating an array of structure. I want to pass this Structure Array to Labview Program from Labwindows. Can any one tell me what is the best way to work with this.

 

I was able to send a single structure data in the following way:
CNVData dataStruct;
CNVData data2[3];
TestData_t TestData;

 

TestData.ID =1;
TestData.ChlName =" DEV1\AO1";
TestData.Stat =1;

 

CNVCreateScalarDataValue(&data2[0], CNVInt8, TestData.ID);
CNVCreateScalarDataValue(&data2[1], CNVString, TestData.ChlName);
CNVCreateScalarDataValue(&data2[2], CNVBool, TestData.Stat);
CNVCreateStructDataValue(&dataStruct, data2, 3);

CNVWrite (writer2, dataStruct, 100);

 

My Labview program was able to read it the information.


Now I have an array of 20 Structures which I want to pass to the Labview Program using Network Variables at a time.


Thanks in advance
Ramesh

Compiler post-build actions

$
0
0

Hi,

 

I've created a post-build action in my project.

If I compile the project in LabWindows/CVI environment than everything is ok, project compiles and post-build action executes.

But if I start compilation from a command in a batch file stange thing happens:

the project compiles as it should but post-build action is not executed.

(the post-build action copies project's output to onother directory)

 

Does anyone know how to make compiler execute a post-build action when it started from a command in a batch file?

COM port empty queue in callback

$
0
0

I have a project that involves up to 16 DUTs that are being serially polled for testing, up to 100+ hours.  The testing fixture is a custom PCB.  It's serial channel is via an FTDI USB transceiver chip on the board.

 

In this system, I also have a barcode scanner for getting DUTs into the software.  It is attached to the PC via virtual COM port.

 

All of the above works very well, been in production for 1+ years.

 

However, I have noticed that while a handful of DUTs are actively being tested, using my barcode scanner to load other DUTs appears to not capture serial data.  It's as if the system is getting "bogged down."

 

The software is running on a Win 7 +3GHz machine.  The software is only one thread; I haven't tried multithreading yet.

 

I found this post which very closely resembles what I have tried and confirmed.  That person noticed that his COM callback would get triggered, but that by the time the callback did the ComRd, the data buffer was empty.  Same case for me; if I scan too fast while the system is busy doing other stuff, I can get triggering on my COM port, but the buffer is empty.

 

Here's another close forum topic.  I noticed in the help under the InstallComCallback topic:

 

The callback can get called when there are no bytes in the input queue, even though there were bytes at the time the message was posted. For example, calling ComRd multiple times in the callback can lead to this situation. For this reason, NI recommends that you always check the input queue size before performing any operation in the callback.

So I'm still unclear why that happens.  But regardless, simply checking the input queue is not really enough for me.  My barcoding is processed in a state machine.  There are several codes the user must scan in a certain order for things to work.  So if one or more of those scans fail to input, my software pops up a warning telling them that something went wrong.  So as you can imagine, it's very off-putting to the user to keep getting those warnings when they are following the correct order.

 

My work-around?  I tell the users to "slow down."  That sucks.

 

So am I a good candidate for multithreading?

Open MP question

$
0
0

Hello,

 

everything is fine, just a question out of curiosity: :smileyhappy:

 

using

 

#pragma omp for

 

before a for loop specifies that the iterations of the associated loop will be executed in parallel.

 

My question: Let's assume I have a loop with 10000 iterations and two threads will be generated; will thread one calculate the first 5000 iterations while the second starts at index 5000, or will they operate on odd/even indices, or is it random, or....

 

Thanks!

Callbacks from two controls "at once"

$
0
0

I need a bit of help with the basics of UI callbacks and threads.

 

Here is the scenario: There are two controls 

1. Numeric control with callback for EVENT_VAL_CHANGED

2. Button with callback for EVENT_COMMIT

 

RunUserInterface() is called once early in the program. User enters a value in the numeric control with the keyboard (just numbers), then they click on the button.

 

This fires the following events:

EVENT_VAL_CHANGED (numeric) --> numeric callback runs

EVENT_COMMIT (numeric)

EVENT_LEFT_CLICK (button)

EVENT_LEFT_CLICK_UP (button)

EVENT_COMMIT (button) --> button callback runs

EVENT_LOST_FOCUS (numeric (?))

EVENT_GOT_FOCUS (button)

 

Can parts of the button callback execute before the numeric callback completes?

 

Thanks!

can do we use the path with the file name as argument for panel function ExcelRpt_WorkbookOpen. thank you

$
0
0

can do we use the path with the file name as argument for panel function ExcelRpt_WorkbookOpen. thank you


where labwindowCVI save its excel file?

$
0
0

where labwindowCVI save its excel file?

Thank you

How can I use LabWindows/CVI do Roulette Wheel ?

$
0
0

未命名.jpg

This is LabVIEW's example.

I want use cvi to like it. (push  start button & picture will be whirl)

How do I create an image and Rotate it ?

 

 

ConnectToTCPServer Failure in Windows7

$
0
0
I am using "Measurement Studio Version 6.0, Labwindows/CVI" for my TcpIP Server and Client Program.
It works very well in the Windows XP circumstance using below functions. 
 
But the function ConnectToTCPServer fails with error message like below, whereas RegisterTCPServer works successfully at Windows XP and Windows 7 OS.
 
I tried ConnectToTCPServer function at three computer, which results in same error message.
 
I am looking for anyone like an angel who can help me. Thanks.
 
 
<server side>
RegisterTCPServer(6000, Server1Callback, 0);
 
<client side>
unsigned int handle;
ConnectToTCPServer (&handle, 6000, "172.29.24.182", ClientCallback,NULL, 5000);
 
<error message at client side>
Non-fatal run-time error
Library function error (return value == -2 [0xfffffffe]).
Unable to establish conneciton
 

Relative path

$
0
0

Hi,

I am trying to run a .bat file (i.e. “mybatfile.bat”) from the tools menu. At the moment I manage to do that by customizing the Tools Menu: Tools-->Customize-->Add then in the “Menu item name” box I use “RunBatFile” and in the “Program Name” box I use the “Browse” facility to navigate and select the “mybatfile.bat” file.  Everything work fine however, the content of the file “mybatfile.bat” differs from project to project and, instead of creating new menu items for each project I would like to create a .bat file for each project and get the relative path to it in the “Program Name” box.

Is there any way of doing that?

 

Thank you!

ZZippo

niDAQmx analog voltage output and impedance

$
0
0

Hi guys,

 

I am using 

Chassis:
NI PXIe-1073
Cards Component:
NI PXIe-6361 & BNC-2111 connector

I try to output an analog voltage square wave pulse in the range of [0,1] V that regulates a laser Cobalt Mambo. The amplitude of the analog signal should modulate the laser strength, where its maximum should be around 1V. The problem is that at 1V I manage to get roughly 40% of the total laser strength. I tested the laser with Axoclamp instrument generating again 1V and I reached the 100% of the total laser strength. I checked that the laser expect impedance of 50ohms. I measured the impedance on the Axonclamp and I got 45 ohm but the one from the NI instrument was ~32ohms. That was my only rationality behind why 1V in two different instruments does not generate the same laser strength. 

My question is during the analog voltage pulse generation is there a way to set the output impdance too?

Here is how I generate the voltage pulse:

 

TaskHandle  taskAnalogOut = 0;

DAQmxErrChk (DAQmxCreateTask("Analog",&taskAnalogOut));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskAnalogOut,"PXI1Slot2/ao0","",0.0,1.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskAnalogOut,"",1000,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,analog_samples));
DAQmxErrChk (DAQmxWriteAnalogF64(taskAnalogOut,analog_samples,0,10.0,DAQmx_Val_GroupByChannel,analog_data,NULL,NULL));

if(taskAnalogOut != 0)
        DAQmxErrChk (DAQmxStartTask(taskAnalogOut));

 Thank you in advance for any help, suggestions or remarks! 

Viewing all 5361 articles
Browse latest View live


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