LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Observe and collect sine waves

Solved!
Go to solution

hello!

I've just started learning Labview. I'm having some problems. My device is NI USB-7856R. I want to input sinusoidal signal (1Khz,1.5V) from scb-68a.But there is nothing in the waveform. Can anyone help me?

Download All
0 Kudos
Message 1 of 16
(2,648 Views)

Hi Clel123,

 

Certainly it should be possible to acquire a sinusoidal signal with that module.

If you share the code you've written so far it might be possible to make some suggestions that would help you along.

 

From what you've written so far, it's difficult to even guess what the problem might be.

 

You could also take a look at the Examples in LabVIEW (Help > Find Examples...) for things related to either your specific hardware, or Analog Input more generally using R-series modules.


GCentral
0 Kudos
Message 2 of 16
(2,640 Views)

Wow!  I've been using LabVIEW (and NI DAQ Devices) for over a decade, and I've never encountered such a sophisticated device.  If you are just starting to learn LabVIEW, I hope you have some knowledgable colleagues around who can help you get started with this device!

 

What I would do if someone handed me such a device would be something like the following:

  1. What happens if I plug it into a USB Port and open up MAX?  Does MAX "see" it?
  2. If the answer to the above is "No", it is probably because I'm missing a Device Driver.  I'd go to NI (on the Web, or phone Tech Support) and figure out the appropriate Driver to install.
  3. Once MAX "sees" it, I'd run a few Test Panels and familiarize myself with its inputs, outputs, and appropriate setting.  I'd then use MAX to create a Task with these settings (i.e. the Channels I wanted to use for input (or output), the range settings and names for the Channels, the Timing I wanted to use, etc.  If you are inputting a sinusoid at 1 kHz, 1.5 v, I might set it up for ±5v, 10kHz sampling rate, continuous, 1000 samples.  Try the Task in MAX and see if it works.
  4. Once you know it works, open a new VI and drop down the following DAQmx functions:  Start Task, Read, Stop Task, Close.  Put a Constant on the Task In terminal of Start Task, expand the Drop Down, and choose the Task Name you just created in MAX.  Wire the Error Lines and Task Lines through to the Close.  Put a While Loop around the DAQmx Read, wire a Stop Control to the Stop terminal.  Put a Waveform Chart on the Front Panel.  Click the Polymorphic DAQmx Read and choose Analog, Single Channel, Multiple Samples, Waveform (Samples).  Wire the Samples Out to the Waveform Chart.
  5. Hook the input you configured up to your sinusoidal signal and run the program.  You should see a 1 kHz sinusoid.

Bob Schor

 

P.S. -- NI has some nice tutorials on DAQmx.  My favorite (which taught me a lot) was something like "Learn 10 Functions in NI-DAQmx and Handle 80 Percent of your Data Acqusition Applications".  If you do a Web search for "Learn 10 Functions in NI-DAQmx", you should find it (even if I didn't quite get the title correct).

0 Kudos
Message 3 of 16
(2,638 Views)

Thank you for your suggestion!  I have put up my VI picture.

Download All
0 Kudos
Message 4 of 16
(2,625 Views)

Hello, I can see my device (USB-7856R) with MAX, but right click only "rename", as shown in the picture.I know there is DAQ acquisition assistant VI, but I want to take the signal from the AI port and send it to PC VI.Thank you for your reply!

0 Kudos
Message 5 of 16
(2,619 Views)

A few potential problems stand out:

  • On the FPGA side, you have a coercion dot (red dot) at the FIFO input. I'd guess the Fixed Point configuration of the FIFO doesn't match the output of the AI datatype. You should change the FIFO datatype to match the AI output datatype
  • On the host side, you're pushing this into a DBL chart. Probably this is fine - it should convert correctly (I think). But if you fix the first point and you still don't see what you expect, consider trying with a Fixed Point indicator (just a single point, not a graph is fine) and see that you do get changing non-zero values.
  • Are there any errors on the host side?
  • I expect that you might have some timing problems, depending on the number of elements you're reading and the size of the FIFO, but whilst that could make your output not look sinusoidal, it wouldn't completely remove it. You'd just get chunks of a sinusoid probably.

GCentral
0 Kudos
Message 6 of 16
(2,610 Views)

It is challenging to work from pictures.  It would be much easier for us to help you if you sent the entire LabVIEW Project, with the Host VI and the FPGA code for your device, included.  If your Project and its files form the contents of a single Folder, then use "Send to:" to send it to be compressed, and attach the resulting .zip file.

 

While I don't have your device to test your code, I do have a RIO device sitting here that I could use to test your ideas, and make suggestions.  I'm not an FPGA "expert", but I'm rapidly learning how it works and writing some LabVIEW-RT code that using this chip.  We'll "learn together" ...

 

Bob Schor

0 Kudos
Message 7 of 16
(2,555 Views)

Hi,

I connected the signal of 1KHz and 1. 5V from AI0 port, and put the whole project compression package on. Thank you for your reply!

 

0 Kudos
Message 8 of 16
(2,518 Views)

Hi,

 

I changed the data type of FIFO to a fixed point, but there is still a coercion dot (red dot).  I will send the compressed package of the project. Please give some suggestions. I can still see only one line in the waveform chart.

 

0 Kudos
Message 9 of 16
(2,511 Views)

@CIel123 wrote:

Hi,

 

I changed the data type of FIFO to a fixed point, but there is still a coercion dot (red dot).  

 


Hi,

 

I opened the code you attached and am now installing the drivers to be able to read it more carefully, but it seems like (and perhaps this is related to my lack of a driver at the moment) your FIFO type is now signed 48 bits with 24 integer bits. I strongly suspect that the datatype for the AI value is much narrower (e.g. perhaps signed, 16 bits with 4 integer or similar).

 


@CIel123 wrote:

I can still see only one line in the waveform chart.

 


I'm a bit confused here - how many lines are you expecting to see? Can you share a graph of what you're getting (screenshot etc) and perhaps an example of what you're expecting (I'd thought this would be a single line with a sine wave shape, 1V amplitude and 1ms period based on what you'd previously written, but if that's not the case (and you're expecting multiple channels, for example) please let us know 🙂 (if that is the case, then we probably don't need the expected graph!)


GCentral
0 Kudos
Message 10 of 16
(2,503 Views)