11-30-2017 03:22 PM
Hello, this is my first time using LabVIEW and I am encountering some issues with my VI.
My objective is to do the following:
1) Acquire an AC signal with LabVIEW
2) Multiply the AC signal by a constant
3) Output the signal
Here is what I am using:
Hardware: NI USB-6343
Software: LabVIEW 10.0 32-bit version
My VI can be seen in the photo below. I acquire a signal from a function generator with DAQ Assistant and display the signal on Waveform Chart. Simultaneously I take the same signal and multiply it by 2 and then display the amplified signal on Waveform Chart 2. The amplified signal is then output with DAQ Assistant2.
As an example I acquire a 1 V amplitude waveform at a frequency of 1 Hz from a function generator and amplify it with my LabVIEW VI. The raw signal is seen in WaveformChart and the amplified (2x) signal is seen in Waveform Chart 2 of the picture below.
Everything is working fine up to this point, but when I output the amplified signal - which should be 2 V 1 Hz wave - and read it with an oscilloscope, the frequency of the signal is right, but amplitude of the signal is incorrect. Take a look at the picture of the oscilloscope reading below.
The vertical grid lines represent 1 V each and the horizontal grid lines represent 1 second each. When reading the output signal with an oscilloscope, I am getting a 0.4 V wave at 1 Hz when it should be a 2 V wave at 1 Hz. Also, more perplexing that when I change the frequency of the signal coming from the function generator, it changes the amplitude of the signal as read by the oscilloscope, but doesn't change the amplitude in the Waveform Charts. I adjusted the frequency of the signal coming from the function generator to 2 Hz. In the image below, the oscilloscope reads the amplified signal as 0.8 V wave at 2 Hz.
I have the signal coming into the DAQ from the function generator connected to (AI 0+) and (AI 0-) and the signal going out from the DAQ to the oscilloscope connected to (AO 0) and (AO GND)
I would appreciate any feedback If anyone knows what might be causing these issues.
Thanks!
11-30-2017 10:01 PM
Attach a VI. It is very difficult to troubleshoot screenshots, and even more difficult to troubleshoot screen photographs. There is a lot of code and settings behind those Express VI's we can't see.
The other concern is that the LabVIEW code may be perfectly fine, but the problem is in the settings of the frequency generator and/or oscilloscope. And we can't troubleshoot those.
12-01-2017 10:45 AM
Hi mtrapuzz,
As RavensFan said, please attach your actual code so we may see how the Express VIs are configured.
What does the scope read going into the DAQ device? Try connecting the Oscilloscope to the function generator to see what it reads.
Best
12-04-2017 07:06 AM
One problem with using Express VIs is that the "details" are hidden unless you have access to the actual code (which you have thus far not provided to us). Dynamic Data Wires also have a similar failing in "hiding details". Both systems make it really easy for novice LabVIEW Users to connect to equipment, acquire data, and look at it, but then when they want to do something simple (like multiply it by two), "What You See Is Not What You Want", or WYSINWYG. That is probably at the root of your problem here.
I recommend that you do a Web Search for "Learn 10 Functions in NI-DAQmx", read the excellent White Paper (which can also be found in NI's excellent DAQ Tutorial Series), and get rid of both Express VIs and all of the Dynamic Wires. I guarantee that if you multiply an Array of Dbls (or a Waveform, however you choose to acquire your data) by 2, you will get twice the output.
Bob Schor
12-04-2017 01:50 PM
Check your scope settings.
Can the DAQ board output 50 Ohms, is your scope set to AC coupling 50 Ohms, or something weird like that? Put the scope to 1 MOhm Dc coupling, see what you get.
mcduff
12-05-2017 10:33 PM - edited 12-05-2017 10:34 PM
I think I figured out the issue I was having with the A/C signal. I was messing with some of the settings in the DAQ Assistants for acquiring data.
One additional question I had is if I wanted LabVIEW to read in an rather large array of numbers, that I perhaps store in an Excel spreadsheet, what would be the best way to go about doing this? I haven't done anything similar to this yet...
12-06-2017 12:52 AM
You can do one of these:
1. Use write to spreadsheet
2 Use write text file with tab delimiter (File name must be .csv)
3 Use write to TDMS and then use TDM Excel add in to convert it to excel.
If you want to get detailed time for each data i recommend the 3rd option.
If you just want simple logger i recommend option 2.
12-06-2017 01:20 AM
point number 2====> text format .xls not .csv
12-06-2017 11:14 AM
Hi mtrapuzz,
1. What was the solution to original issue with the amplitude reduction?
Please let us know and mark it as solution.
2. I would recommend following this tutorial on how to read data in from a spreadsheet file:
How Can I Import Spreadsheet Files Into LabVIEW
http://digital.ni.com/public.nsf/allkb/C944B961B59516208625755A005955F2
Best,
12-06-2017 04:14 PM
Alex didn't give you the full title of the reference he gave you -- it is "How can I import Spreadsheet Files into LabVIEW using the CSV Format?". An important thing to note is that files in the .CSV format are, in fact, "Comma-separated Values" files, which Excel can read, but which are not "native to Excel", and should (in my opinion) not be called "Excel Files" (NI uses the term "Spreadsheet File" which is more correct, but often misleading ...).
If you want to read native Excel files (.xls and .xlsx), you can either use ActiveX (tricky), third-party offerings (which, I suspect, "hide" the ActiveX from you) or use NI's Report Generation Toolkit, which is now bundled with the Professional distribution of LabVIEW. I use the RGT when I need to read/write Excel files, and it works well for me.
Bob Schor