Quantcast
Channel: LabVIEW topics
Viewing all 69669 articles
Browse latest View live

Live editing multiple graphs

$
0
0

Hi all,

I have some issues with editing data. I have a program that reads a text file with data, does calculations to the data, and then displays it in a graph. There are 6 columns of data, so I want 6 different graphs. For every graph there are two things that needs to be done: calculating the mean and an offset. Now I want to edit data live, different for every graph. I want to be able to replace certain data points with NaN values. So lets say in a graph there is one data point that is abnormally high, I want to move two cursors to set the x-values, and to set an y-value, and then I want it to replace all the data points between the two x's and above the y with a NaN value. I also want this to work the other way around, so to replace values lower than a certain Y-value. I need the program to remember these alterations, and then be able to do the same for multiple points in that graph. I also need to be able to do this separately for every graph.

The problems I encounter are these:

- Remembering the alterations that are done. When I set a new area, the already altered area goes back to the original.

- Setting the cursors as coordinates. I know how to ask for the cursor coordinates with a property node, but I have trouble with passing that data.

- Doing this program for every graph. The final product will consist of approximately 30 graphs, so I was wondering if there is a way to do the above, without copying the program 30 times (or for now, 6 times).

Sorry if these questions are stupid, I'm still learning, and I get better at this every day Smiley Happy

I've attached my program (yes, the real program now Smiley Tongue) I've also attached the data that I use to read.

I know this is a lot, but some tips are very welcome.

Thanks in advance!!


Way to speed up loop execution time with live serial outputs?

$
0
0

Hi, I'm a new LabVIEW user trying to control a linear actuator with an analogue voltage being supplied from a DAQ connected to LabVIEW. The whole program is too large to show in a single screen but I attached a sample that shows a very basic version of my serial setup within a loop. In the actual program there are case structures, various other outputs, calculation, and string conversions also within the same loop.

 

Currently each loop takes about 0.1 seconds to execute leading to choppy actuator motion which is not suitable for my application. While troubleshooting I made a version of the program that performs all of the same operations but doesn't include a live serial output and it runs smoothly with each loop taking about 0.007s to execute. This leads me to believe the delay is caused either by the way I have written my code to interact with the serial connection or by the serial connection itself.

 

Is there a way to speed up the loop execution/serial connection or is the problem with my hardware?

separate SubVI tables?

$
0
0

Everything is working on my MainVI how I would like except for the table. Every table connected to a SubVI shows all data and not just the data from the single SubVI.

Thanks

How do I use the Call Library Function Node to get this structure?

$
0
0

Overview:

I am trying to create TCP IPv6 communication for my sbRIO9607, running Linux RT, in LabVIEW. I am programming in the C language in the Eclipse IDE for my tests.

 

Complete:

I got some C code to compile and run on my sbRIO using Eclipse. The sever code and client code both run and exchange data through the localhost. I've attached my programs to this thread.

 

Code:

For the first part of the server code (see complete file in attached zip), I have:

 

// START C CODE

 

// Includes

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

#include <string.h>

 

#include <sys/types.h>

#include <sys/socket.h>

#include <netinet/in.h>

#include <netdb.h>

 

#include <arpa/inet.h>

 

// Main

int main(void) {

// INPUTS

int portno = 3344;

 

// Declare Vars

char buffer[256]; // Can recieve 256 characters of information

int sockfd, newsockfd, tempVar;

socklen_t clilen;

struct sockaddr_in6 serv_addr, cli_addr;

int n;

char client_addr_ipv6[100];

 

// Start Msg

printf("\nIPv6 TCP Server Started...\n");

 

// Sockets Layer Call: socket()

sockfd = socket(AF_INET6, SOCK_STREAM, 0); // Returns int sockfd on success; Returns int -1 on error;

// printf("\nAF_INET6 = %i\n\nSOCK_STREAM = %i\n",AF_INET6, SOCK_STREAM); // int AF_INET6 = 10; int SOCK_STREAM = 1;

 

// socket() Error Catch

if (sockfd < 0) {

perror("\nServer: Socket Open Error\n");

exit(1);

} else {

printf("\nServer Socket Open Success --- Sockfd = %i\n", sockfd);

}

 

// Parse Addr

bzero((char *) &serv_addr, sizeof(serv_addr)); // Sets aside memory for serv_addr structure (sizeof() returns uint16 number of bytes) (8 bit = 1 byte)

serv_addr.sin6_flowinfo = 0;

serv_addr.sin6_family = AF_INET6; // AF_INET6 = 10;

serv_addr.sin6_addr = in6addr_any;

serv_addr.sin6_port = htons(portno); // Convert the port number to network byte order

 

// Sockets Layer Call: bind()

tempVar = bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr));

 

// END C CODE

 

Question:

1. How do I wrap the code in bold so that I can call it from LabVIEW to get a pointer to the structure into LabVIEW that I can pass to the bind() and the sizeof() functions? If possible, can I create the .so from Eclipse or do I need another software/IDE?

 

Thanks.

DAQ assistant. Sending signals to 2 different terminals

$
0
0

If you want to send digital signals  ( let's say like a Boolean switch) to cDaq-9174 (NI 9485 ). We are using 2 separate terminals. Do we need to create 2 Daq assistants in our codes 2 send separate signals to each terminals? can we create an array of Boolean and connect each to separate terminals

problem using standard bus to program watlow Ez-Zone

$
0
0

Hello,

I'm using Watlow EZ-ZONE RM control module and connect it to usb-rs485. I'm trying to use its labview driver ( can be download from  http://www.watlow.com/products/controllers/software/ez-zone-labview-driver-software ) for std-bus communication.In its example it can read the A1 and A2 how can i add A3 and A4. Also the parameter IDs are in the excel file attached but there is no 4001 value for that which was used in its example.

How can i read the values from the 4 analog inputs?

 

Thanks 

 

Master Spreadsheet for specific file format

$
0
0

Hello Everyone, 

I have made a vi which can break down a file names and put the parameters in spreadsheet. This is for the company that I am working on and the VI is made to handle thousands of data file. I made the VI but it only works for specific set of files. For example the file name is Ring-1.300V_MZI1-0V_MZI2-0V.csv. 

the vi will break down in following way: 

Filename                                                   Ring             MZI1              MZI2

Ring-1.300V_MZI1-0V_MZI2-0V             1.300v             0V                 0V

I have bunch of files of this same category and the vi will take the list of file names and put the them in a spreadsheet. But I can only do it In this file name not for others. I have attached 2 sets of files and my VI. I was working on 1st set of files, i don't know how to make the 2nd setor any other file set work in the Vi. If somebody can show me then that would be great! Thank you. 

 

Help me be less of a Labview noob: what's the proper way to deal with tons of variables?

$
0
0

You guys have helped me learn a ton about labview over the years. For example, you guys showed me the light of using state diagrams rather than convoluted hellscapes of for loops, flat sequences, and case structures, and my code is neater as a result.

 

However, I'm aware that my code is still awful and would make most of you hurl if you saw it (the problem is partly that I'm usually under some pressure to get results in the near future, and learning the proper technique would take me too long compared to doing the messier thing I currently know how to do).

 

The thing I think I should learn how to fix now (that I'm sure I'm doing incorrectly) is handling all the variables in my program. I usually have maaaany variables I set via the front panel. I end up having these awful networks of wires and reference values like this:

 

LVvars1.PNGLVvars2.PNG

(please be gentle with me, I know it's god awful.)

 

What's the proper thing to do here? I'm dimly aware of clusters, is that the right solution? Or is there something even more elegant? Any tutorials on this I could read would be greatly appreciated, thank you.


GE Oil & Gas or Baker Hughes Folks

$
0
0

Just a quick note. Any users that are part of the new BHGE please send me a private message.

 

Thanks, Mike...

LV2017 bug using Plot.LineStyle ?

$
0
0

Hello,

 

See the snippet below. I just discovered it today. I can manually set the plot style to value "1" (long dashed lines). But if I programmatically either set its value to "1", or even just read it using property nodes, the real style switches to value "2"!

LV 2017 32 bit.

 

graphs_test1.png

 

Edit: very strange. Try it, set the style of the Graph to the second option (value 1, long dashed lines). After this if I call the Lava Code Capture tool from the Tools menu, it will show the Graph FP with plot in style value "2"!!!

 

EDit: just to show the FP before I run the VI:

 

style1.png

 

Multiple Loop Stop

$
0
0

I currently have two while loops, one configured with a boolean T/F button for stop and the other stop is dependent upon reaching a for loop count of n-samples or greater. I was wondering how to make either loop stop at the same time the other loop stops. I've looked into notifiers, queues and also local variables but my only constraint is that I want the stop button to remain "Latch When Released" if possible unless there is a way to rest the button after each program run. Let me know if you have any questions. 

 

Thank you

DataTaker communication

$
0
0

Hello everyone,

 

I am trying to communicate with a DataTaker 831 device over TCP to log some pressure channels. To initially check and verify the communication I have been trying to connect with NI's Measurement and Automation Explorer (MAX) but I can't seem to get the correct communication. The DataTaker has a program that when running will send information every 10 seconds over Ethernet. To start the program I need to send "G" to the DataTaker. Once the DataTaker receives the "G" command a LED will indicate that it is running. If I use the web interface of the DataTaker I can start the program just fine, but I can't seem to get it to start when using MAX. I have tried both "G" and "G\n" but both cases the DataTaker does not start it's program.

I have also tried to just query the channel data using the LabView drivers from DataTaker but it always times out waiting for a response.

 

DataTaker Communication 1.PNG

Best Way to Export Data to Excel

$
0
0

Okay so I know this is a somewhat frequented topic but I can't find the exact answer I'm looking for. My goal is to export five different columns of data to an Excel file. I can do that currently but what I'm lacking is the proper labeling for each column of data. How exactly do you create those header labels? 

How to set FPGA global variable value from host PC

$
0
0

Hi all,

 

I have a VI running on an FPGA target in which I am using global variables to avoid having front-panel arrays (and thus reduce resource utilization).  

fpga_vi.png

The global variables are 1D arrays of FXP numbers that are static during the run of the FPGA VI, but should be able to be programmatically updated by transferring data from the host PC.  

LVproject.png

I can't figure out how to send the programmatically generated values from the host PC to the FPGA VI's global variables.

 

Since it's just a one-time data transfer of a relatively small amount of data (~200 elements across ~40 arrays), a Read/Write control seems like the tool for the job.  But, the Read/Write Control with the FPGA VI as the reference can only access the frontpanel elements, not the global variables that do not appear on the frontpanel.  (In the below pic, C_row and C_row 2 are global variables that do not appear on the frontpanel.)

fpga_refnum.png

If I instead use a reference to the global variable, I get an error on the host PC saying that the VI associated with the global variable is not compiled, but it doesn't seem like elements can't be compiled or have a build specification created.  (The FPGA VI is currently successfully compiled.)

gv_refnum.png

How can I do a "one-time update" to send data on the host VI to the FPGA global variables without creating frontpanel elements?

 

Select VIs attached.

 

Thanks in advance!

Clear Error Bar Graph

$
0
0

Hi,

I'm relatively new to LabVIEW, so apologies in advance if the error is obvious.  I'm trying to do a small statistical VI to show how the standard error evolves (see attached).  Largely seems to be working apart from the error bar graph does not clear when I press play again (or even select clear graph by right clicking) and simply appends to the previous run?  I presume I'm misusing it in some way?

Thanks.


SPI Initialization with Labview

$
0
0

Hello-

 

I am attempting to communicate with my microSD card via SPI protocol. I am using a NI sbRIO 9637 with a mounted SD adapter (here's a link to the adapter itself). LabVIEW has a pre-built FPGA communication protocol for SPI. However, I do not have it purchased. Therefore, I must complete the protocol from scratch. I am currently not receiving the expected response from the card after sending the standard first command (CMD0). Instead of recieving the x01, I am recieving xFF. I have fit all the preliminary critera (~400kHz CLK frequency, 3.3Vdd). I will attach my vi and any help would be immensly appreciated as I am unable to get the card to communicate with me.

 

Thanks

Error - 1073807339 Cannot write CAN message to water pump for automotive application

$
0
0

Hello,

 

I am trying to read and write a CAN message to a water pump but am only able to read messages and not write messages. I am using a NI USB-8473 device to communicate with a pump. I have the components wired according to the attached image, and I have based my VI off of the LabVIEW examples. 

 

I have a fixed baudrate of 250k based on the manufacturers specifications. I have self-tested the NI USB-8473 in NI MAX, it has passed, and I am using CAN0 in my VI and in MAX.

 

When I try to run the vi, I can successfully read messages from the pump. However when I try to send a message to the pump it does not respond.

 

I am not sure where to go from here. Is there anything vital that my vi is missing, or is there any troubleshooting steps that I should attempt?

 

Thank you,

 

Mitchell

 

 

 

NI sbRIO 9631 + encoder, timing chart to FPGA program

$
0
0

Hello ,
Sorry for my English
That is the problem.

An Input (In) signal comes from an encoder, so its period changes according to the speed of rotation.
diagram chartdiagram chartD1, d2, d3 and d4 are output signals see timing diagram.
Timing chartTiming chartT1, t2, t3 and t4 is the duration of activation of the signals. D1, d2, d3 and d4.
D1 is activated at each IN period.
D2 is activated at each 2 IN period.
D3 is activated at each 7 IN period.
D4 is activated at each 36 IN period.

I have an NI sbRIO 9631 card, I am a beginner.
My NI sbRIO 9631My NI sbRIO 9631I realized part of the program, as I did not encode it with me I could not carry out test.
InterfaceInterfaceProgramProgramthe questions:
1) how to make the counter of the encoder?  (i make counter for button)
2) how to realize DELAY of d1, d2, d3 and d4?
3) The start button is virtual, the best is to put it phisic.?

4) At startup set all output to 0.
I have attached Illustrations to explain all this

thank you.

Nifpga.dll - resources leak - unload problem

$
0
0

Hello All,

 

This post is some kind bug report.

I'm not sure if this place is a best place to report my problem. If not, please move to correct section.

 

At the beginning, we have project that we use NI PCIe-7852R, to control some external devices like scanners etc. So we have prepared FPGA firmware that works fine. Our fpga is controlled/configured/setup from PC. It means that we can setup some user-defined values. This part works fine as well.

 

So, in our system configuration looks like this:

- NI LabView(fpga) generates firmware fpga.lvbitx

- Using C API generator we create headers, for this firmware

- Using C API, we create c++ wrapper

- Using C++ wrapper we port this functionality to python.

- User use python to setup NI fpga.

 

Ok, everything looks correct, and works for first look. Problems starts when we finishing work with fpga, and when we start releasing resources. (of course our project is bigger than python which controls ni fpga, but it doesn't matter). We notices that  when we start using NI C(fpga) API, then our other library are not unloaded correctly. Destructors on our libraries are not called. It look's like python terminate working without releasing our libraries. To cut off from our application I prepared small Visual Studio application that you "can reproduce" this issue.

 

In attached file you can find source codes, that you need to compile.

Code is very simple, it contains only 4 line with logic, so it is as simple as it can be.

There is also bit file(fpga.lvbitx), just for upload and test application.

 

How to reproduce problem?

- please make sure that you have PCIe NI-7852R board on you PC

- open solution and compile program

- run program NiFpgaDtor.exe - everything looks good.

- next download Application Verifier(x64).

- run application verifier and add "NiFpgaDtor.exe" file

- click save

- close application verifier

- run again application verifier and check if NiFpgaDotr.exe was added correctly.

- run program NiFpga.exe again. Now you noticed crash, because application throw exception about leak.

 

Additional information is, when we only load nifpga.dll and unload without using resources, there is no problem. Problem start when we use NiFpga_Open(...)/NiFpga_Close() functions.

 

Version of NiFpga.dll that we use is 17.0.0.49152.

OS: Windows 10 x64.

 

Could anyone from National Instruments work with it and confirm that there is problem on NI side?

I'm glad to help you to find solution, or test your fixed version.

 

Best regards,

Bartek

 

 

please help me with Labview & USB-7856R

$
0
0

I'm now trying to connect PC and USB-7856R using Labview.

 

But I'm totally new to both Labview and USB-7856R.

 

I'm wondering how we can transfer digital data from USB-7856R to PC and save it automatically.

 

What function I should use at labview which will help me do this?

<process>
1. transfer data from USB-7856R to computer

2. save the data with Labview

3. make 1,2 process automatic.

 

(or please explain some examples which can help me figure out the program(or the sites to refer))

Thank you Smiley Happy

 

 

Viewing all 69669 articles
Browse latest View live


Latest Images

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