Quantcast
Channel: All LabVIEW posts
Viewing all 202062 articles
Browse latest View live

Re: Visa Serial interface problem

$
0
0

Zahran88 wrote:

I am trying to read an array of string using the code as attached. I have an error with "scan from string" block every time I run the program. you can find sample of my data to be sent by my hardware to Labview as below

 

D10112.31D10212.31D10312.31D10412.31D10512.31D10612.31D10712.31\r\nCapture.PNG

 


Your code depends on the whole message being read at once, which I can guarantee you isn't happening the way you set up the serial read.  I wish NI would deprecate the example that uses Bytes at Port, because you are their latest victim.  You have termination characters, so make use of them by specifying that in your serial port setup!  And then get rid of the Bytes at Port.  Since you can only specify a single character to be the termination character, I would use the linefeed as the termination character so you read the entire message and then use Trim Whitespace to get rid of the carriage return.  Make sure that bytes to read is bigger than the biggest message you'll ever see.  LabVIEW is smart enough to only allocate what it needs.


Re: Find if string contains valid float

$
0
0

So how does the received string look like when you get an error?

 

To analyze the problem, that's where you need to start. Could it be that sometimes you receive incomplete strings or have frame shifts where the numbers are spread over multiple reads? Why not define a termination character (e.g. ?) for the communication?

How fast does the data arrive at the serial port? Waiting 1s between reads seems like a long time.

 

I assume that you are aware that your "VISA close" can never execute.

 

To identify the problem: As a first step log the received strings into an array, wait until the problem happens, stop the program (where is your stop button???) and then analyze the strings. It should be obvious and is probably one of the above mentioned issues. 

Labview 2017 Co-simulation Multisim VI

$
0
0

I am trying to build a hybrid power system with wind and solar power in Labview 2017. I have completed the Wind Turbine part of the system but I have some troubles with the PV. I built a circuit in Multisim 14.1 and I am trying to run co-simulation between the two programs. In Multisim I have already set the Labview terminal inputs and outputs. But when I go to use the Multisim Design VI, it is no where to be found. Was it erased from this version of Labview and replaced with something else? If not please let me know what have to do to get this to work.

 

Thanks

Re: LabVIEW PID controlled PWM output

$
0
0

Sorry, my fault :-)

 

Here you are

 

BR,Jan

Re: Find if string contains valid float

$
0
0

I have two suggestions.

  1. Most VISA devices sending Ascii Strings send a Termination Character (typically \n, as in \r\n) at the end of the string.  I recommend initializing your VISA with Enable Termination Character set to True, and the appropriate (default = \n) character wired in.  Then do a VISA Read with, say, 1024 characters -- if your device is sending a string of 38 (terminated by \n), the read will stop when the \n is received.
  2. I like to process String data using Scan from String.  In your case, you expect data in the form $%f;%f? (and maybe other things).  If you use this as the format specification, the one Scan from String function will parse your string, return two Dbls that you can call Voltage and Current, and will return with the Error Line "clear" unless the String did not conform to the format.  This one function replaces a half-dozen functions in your code and immediately gives you the Dbl values for your graph.
  3. [OK, so I have three points to make ...]  You should also take a look at the inverse of Scan from String, namely Format Into String, (in my opinion) does a better, clearer job of combining multiple pieces of data into a String for writing, say, to a CSV file than Concatenate.  If you want the TimeStamp as two strings, you'll need to use the functions (as you have) from the Time Palette, but then you could input the Date String, Time String, Voltage (Dbl), and Current (Dbl) using a format of %s,%s,%f,%f.  Finally, if you save all of your strings in a 1D array, you don't need the \r\n separator at the end.  Finally, to get your header "on top", just add it to the front of the array of data strings using Build Array.

Bob Schor

Re: LabVIEW PID controlled PWM output

$
0
0

Hi JanBarton,

 

Thanks for your time. Can you please help me out to understand the logic because am new to this.

Problem Moving PPLs to LV2017

$
0
0

i have a large (1700+ VIs) application I'm producing.

 

It works fine in LV2013.

 

in moving to LV2013, I've hit a few snags.

 

One of them, involving PPLs that are used by other PPLs, is solved by discovering that LabVIEW 2017 fixed an issue that I had to work around in LV2013..  Previous problem and solution

 

Now I have another problem.

 

The app is build of several parts.

HOST.exe - this is the main part, running on Windows.

ADDONS used by host - These are PPLs that the user can compile (in a separate LVPROJ).  They get "attached" to the host, by being in a certain folder and operating a command on the host.

PPLs used by host only - these are PPLs used by the host or by the addons, which provide data/code common to the host or to the addons.  For example, the system configuration data is stored in one of these, and either the host or an addon can register  and get notifications if the config has changed in a certain way.

 

RTHOST.rtexe - this is the main program on an RT box (PXI 8196 in my case, others are possible)

RT ADDONS - there are PPLS that the user can compile (in a separate LVPROJ).  They get "attached" to the RTHOST, at the same time as the corresponding addon gets attached to the windows host.

PPLS used by RTHOST ONLY - these are PPLs used on the RT box to share data/code between the RTHOST and the RT Addons. Similar to the Windows host above.

 

COMMON PPLS - these are functions common to both the Windows host and the RT host.  Common utilities such as circular buffer management, formatting text strings, TCP Transceivers, etc.  Generic stuff.

 

Altogether there are 25-30 PPLs built by my process.

 

I haven't worked on the RT side in LV2017 yet, because I've had so much trouble with the host side.

 

In LV 2013, as long as I followed two simple rules, I had no trouble building anything:

1--- Dependencies go only BACKWARD.  If B depends on A then A has to be built first.   No problem.

2--- if a PPL has something that is Windows-Only (like a function dealing with menus), then you cannot use that PPL on the RT side.  If a PPL has RT-ONLY content you cannot use ANYTHING in that PPL from Windows.  That's because LabVIEW must load an entire PPL at a time - if anything is broken, the PPL is unusable.

 

To make that happen, I separated PPLs into the groups above.  I "certified" that certain ones are RT-safe, and that means that they are usable on BOTH Windows and RT.

 

As part of the "certification" process, I built the dual-use PPLs using the RT side of my projects.  (Since I have far more Windows-only stuff than RT-only stuff).

 

In LV2013, the dual-use ones were perfectly capable of being used AS IS, on either side of the fence.  The same PPL was deployed in both locations and worked fine.

 

But now, in LV2017, the same build process complains.   Some of the PPLs built on the RT side of a project get complained about.  LabVIEW reports that they are missing dependencies, yet refuses to tell me what they are.  

 

A visual exam shows that nothing in this PPL depends on anything outside of it.  A list of VI DEPENDENCIES shows that nothing in this PPL depends on anything outside of it.  Yet still, LabVIEW complains that it cannot find some "external dependency".

 

Note that the VIs will all load correctly in the DevSys.  It will compile without error.  yet you cannot load it anywhere.

 

If I move the LVLIB from the RT side to the MY COMPUTER side of the project, it will compile correctly and NOT complain about such things.  

Not ALL VIs within one of these will load broken.  I haven't discovered a common answer among the broken ones.  In one PPL, only one VI is complained about.  In another, there are three.

 

It's almost as if there are linkages behind the scenes that are different between RT and the host, and these show up differently between LV2013 and LV2017.

 

I have the host part compiling completely now, having moved some of these from RT to the MY COMPUTER side. My guess is the RT side will screw up when I tackle that.

 

So, is there a better plan to do what I am doing?  Should I turn on some new option I haven't figured out?

 

Should I (can I) build two versions (RT and MY COMPUTER) using the same source library?

 

Ideas?

 

Multi column list box tips

$
0
0

I have a multi-column list box which shows an identifier in the first column, a brief description in the second, and a file name in the third.  What I'd like to do is be able to show a unique tip (Mouse hover) for each cell in the list box.  For example, if they hover over the identifier, I want to show the user a tip containing the test comment associated with that identifier.  Hover over the description, and the tip shows the entire description (Rather than an abbreviated one).  Hover over the filename, and they see the full path.

 

Is there a standard approach to this or will I need to do gyrations with the mouse move event, control bounds, etc?

 

Thanks,

 

XL600


Re: Multi column list box tips

$
0
0

There MIGHT be a better way, but there is a COORDINATES TO ROW COLUMN node that you can invoke to turn the mouse coordinate into a row/column address.  Use that address to set the tooltip text for the entire tree.

 

 

Re: Multi column list box tips

$
0
0

xl600 wrote:

I have a multi-column list box which shows an identifier in the first column, a brief description in the second, and a file name in the third.  What I'd like to do is be able to show a unique tip (Mouse hover) for each cell in the list box.  For example, if they hover over the identifier, I want to show the user a tip containing the test comment associated with that identifier.  Hover over the description, and the tip shows the entire description (Rather than an abbreviated one).  Hover over the filename, and they see the full path.

 

Is there a standard approach to this or will I need to do gyrations with the mouse move event, control bounds, etc?

 

Thanks,

 

XL600


 I think you will have to code that yourself.

 

 

 

9522486a07ef45aa9f53f601dd43880c

 

 

 

Ben 

Improving current step sequencer vi

$
0
0

Hello,

 

I have made a sort of step sequencer which will be used to trigger lasers on and off in different sequences which can be preconfigured. The vi will run each segment for as long as the user wants through a numeric control. This is used as part of an experiment where the lasers when fired will excite a material which is then captured by a camera. The camera can output ttl pulses for each frame it takes. at the moment this VI is used through inputing the time in ms that is equivalent to each frame taken but due to different internal clocks of the camera and pc this gets out of syncrhonisation after a while so I am thinking of controlling the sequence with number of frames rather than time passed. I will attach my VI and would like to know if anyone have any ideas how I can use a TTL input from a camera to control my step sequencer. If this doesn't make much sense please ask and I'll clarify whatever you need.

 

 

Regards,

Jaafar Harari

 

PS. the force quit button isn't working as its supposed to atm so ignore it please

Re: New VI - default window size

$
0
0

Thanks for the info George.

I've created a template (new_vi.vit) and a VI named lv_new_vi.vi and placed it under the directory mentioned, but it doesn't seem to invoke it when I use File-> New VI or Ctrl+N.

I've restarted LabVIEW as well.

 

Solved:

The lv_new_vi.vi must have an I32 indicator named "return value" wired to the top right connector.

0 for no error

1 for error

 

https://lavag.org/topic/11373-lv_new_vivi-conpane/

2017-07-24_17-10-38.png

VI attached (saved for 2009)

Re: New VI - default window size

Re: Multi column list box tips

$
0
0

Hey, thanks!  That was a simple mod using that invoke node!

 

But what I noticed was that the tip strip, while being changed, won't appear unless the mouse is actually moved out of the control entirely and then back in.  Is there a way to reset that so the tip strip can be re-displayed without leaving the control?

 

Thanks!

 

XL600

Re: New VI - default window size


Re: How to correctly plot FFT

$
0
0

I can only offer you some advice and questions

 

  1. The data you submitted has a time column whose values repeated for 0 to about 9 seconds. Is this data really continuous or are they any gaps in it? If there are gaps the analysis is much harder.
  2. If I assume your data is continuous, no gaps, then the time series and FFT Magnitude look like the following

     FFT_10A.png

     I see some small peaks that may be what you are looking for, but maybe not.

     

  3. Depending on how you designed your filter it may be unstable and act like an oscillator/amplifier and actually amplify the noise and the bandpass frequencies, thus looking like you have a signal.

     

     mcduff

     

Re: New VI - default window size

$
0
0

That looks useful. I'll give that a try as well.

 

Thanks

 

Edit: Quick Drop takes a ridiculous amount of time to populate the list initially, so I'll have to give that a miss or assign it to a menu.

Synchronize DAQ Analog Input & Digital Output (NI USB-6361)

$
0
0

I would like to synchronize a continuous digital output with an analog input on a NI USB-6361 DAQ. I want to press a button and have the digital output send a square wave at 47 Hz and have the analog input begin sampling at the same rate. I have referenced the following link http://digital.ni.com/public.nsf/allkb/EBD603683446EC13862575B3006A63A2, but I am still unsure how to implement this with a NI-DAQmx express VI.

 

I have attached a working copy of my VI.

 

Thank you,

Mackenzie

Re: How to correctly plot FFT

$
0
0

The data is read in from another VI. The way the program operates is the magnetic field is modulated at a frequency of 0.1 Hz. The voltage and current readings are read by iterating a for loop so that 70 points are taken at each iteration of the for loop, then the next iteration starts and another 70 points are taken over about 10 seconds. At the end of each iteration, that iteration's 70 points are just appended onto the end of the array. So i believe yes the data is continuous. 

 

I have spoken with some other people and decided i need more accurate data to observe the peak i want, so i will be running more tests in order to obtain that data and re-running my post analysis. I'll check in if i make any progress. I will also check to see if the filter i designed is oscillating or amplifying my signl.

 

Once again, thank you so much mcduff you were a ton of help

Re: Multi column list box tips

Viewing all 202062 articles
Browse latest View live


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