LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arbitrary waveform generator synchronized to an external event

Hi everybody,

 

I have to generate a periodic arbitrary signal based on a table of coordinates. However, this signal must be synchronized to an external signal acquired via DAQ. That external signal is a reference signal and it is a square wave whose frequency and duty cycle can change. So, the frequency and the duty cycle of the generated signal must follow the reference signal. I’m trying to do this, but without success. Somebody can help me?

 

Thanks.

0 Kudos
Message 1 of 10
(4,729 Views)

Hi jfonseca,

 

You'll need to implement Triggered Continuous Buffered Generation, you'll be able to find examples of this in the NI Example Finder. (Help > Find Examples...)

 

I think the underlying sequence of operations required for this function is as follows:

  1. Read through the entire table and convert this into waveform data.
  2. Write this data into Continuous configured DAQ Analogue Output Signal to store the waveform data in the buffer.
  3. Have the Analogue Output task driven by a reference to an input digital signal from another line as it's clock source (Task Sample Clock VI).

This will write the whole waveform into the write buffer of the task, and the write task's clock source will be driven by the edge of the input digital signal you have configured; this will write each data point on the rising/falling edge of the signal independantly of it's duty ratio.

 

The most complicated part of this will be referencing the input trigger signal; some DAQ devices do not have the ability to reference an exact terminal. However, you can build your own reference to a task for external triggering; you can see examples of this in the Example Finder too.

 

Hope this helps. 


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 2 of 10
(4,717 Views)

Alex,

Firstly I would like to express my gratitude by your reply. I apologize, but I wasn´t able to find the examples at NI Example Finder that you mentioned, anyway I think that I wasn´t clear about the generation of signal. Actually, that generated waveform will be used just as an internal signal of VI and I don´t need to put this signal in DAQ output. I tried to find a Task Sample Clock VI, but I couldn´t. Could you give me some examples?

 

Thanks again.

0 Kudos
Message 3 of 10
(4,707 Views)

@jfonseca wrote:

Alex,

Firstly I would like to express my gratitude by your reply. I apologize, but I wasn´t able to find the examples at NI Example Finder that you mentioned, anyway I think that I wasn´t clear about the generation of signal. Actually, that generated waveform will be used just as an internal signal of VI and I don´t need to put this signal in DAQ output. I tried to find a Task Sample Clock VI, but I couldn´t. Could you give me some examples?

 

Thanks again.


Okay, so just so that we're clear; you wish to read in an external digital pulse which will clock an interation through some arbitrary waveform data in your VI? Do you have any information of the speed at which the input digital signal will be coming in? Also, just so that we're sure; what hardware will you be using, alongside which version of LabVIEW?

 

For a high speed signal I have an idea in mind regarding using a Counter to count the digital edges and poll this value. The problem with this is that we won't update the graph instantly on every clocked edge but we could iterate through the number of points since the last counted value, but we could choose how often (Within limitations of your CPU) we check this data. Try using the Edge Count option in a DAQ Assistant to see if you can implement this method if it suits your problem. Counters roll over,  so you may need to implement some form of check in order to make sure you don't miss any missed signals. You can find out the resolution of your counter and infer how you'd check for a roll over and what number of points you'd need to add to the graph. 

 

Sorry about all of the questions, however is this what you had in mind?


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 4 of 10
(4,696 Views)

Alex,


Thanks again, however I may to explain better that application. Well, as you asked me, the hardware that I have been used is a NI USB-6229 alongside LabVIEW 2010 developer suite. Clarifying, the external signal that come from a sensor has about 3 Hz of frequency and will be used as a reference to the virtual arbitrary generator. This signal looks like a triangle waveform pattern rather than a digital one. I think the information that I have to extract from this signal is: period, rise time and fall time. Thus, that information has to be entering in a “waveform generator block” to control the period, rise time and fall time of arbitrary signal generated.
Is that idea correct? What the right bocks that I need to accomplish this? Do you have a better solution? I'll be grateful if you help me.
Thanks.

0 Kudos
Message 5 of 10
(4,693 Views)

jfonseca,

 

The list below defines what I'm understanding your specification to be. I'll explain to you how I would go about implementing it, however if there's anything I've misunderstood please explain the key points of what your system should do in your response.

 

jfonseca's Specification

  1. Using the NI USB-6229, an input triangle wave signal ≈3Hz will be read into LabVIEW.
  2. The readings from this waveform will be used to determine the Period, Rise Time and Fall Time.
  3. The values of Period, Rise Time and Fall Time will be used to generate an arbitrary signal.

Proposed Solution

  1. Using a DAQ Assistant, you can read this data continuously from one of the analogue ports.
  2. Use the output of the DAQ Assistant into the Timing and Transition Measurements VI to retrieve the Rise Time and Fall Time, and into the Pulse Measurements VI for the Waveform Period.
  3. ...

As for option three, this completely depends on your own implementation. There are many different kinds of signals which have these attributes, so depending on what type of output you require will affect your decision. You can look at the Waveform Generation/Signal Generation palette and see what options you have open to you. For producing a completely arbitrary wave, use the Arbitrary Wave VI. Use the context help for this VI (Press Ctrl+H) and open up the example to see how can be used; however you'll need to come up with your own algorithm for trying to define just how the specific signal data you retrieve is used to produce the arbitrary wave you require.

 

Regards, 


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 6 of 10
(4,685 Views)

Alex,


The specification that you wrote is correct. I built a VI regarding your proposed solution, but two errors happened that I think that is because the values that used in setup. Attached this I am sending two figures which you can see the showed errors. Also, I am sending the VI that I built. Note that I need to put the values (rise time and fall time) into the arbitrary generator – I am using a Simulate Arbitrary Signal function, though I don’t know if that is the best function to accomplish this.

 

Regards.

Download All
0 Kudos
Message 7 of 10
(4,664 Views)

Hi jfonseca,

 

Error One:

The measurement VI used hasn't acquired enough datapoints to process the measurement information. Not a whole period has occured during the processing of the data, therefore the measurements cannot be made; you can't determine the frequency of only a section of a waveform. Periodicity is also an important factor to take into account.

 

ActivationSnippet.png

 

Error Two:

The DAQ Assistant is not reading data fast enough. Increase the sample rate or decrease the number of samples to be read to prevent the buffer from overflowing and losing information. You could also follow the hints showed by the error message; try reading a finite number of samples (N Samples).

 

Producing Your Signal:
If you want to generate your signal in LabVIEW based only on the measurements you're taking, i.e. build a waveform out of the known frequency, rise time and fall time, you have to define your own mathematical function in order to do so as shown in the Abritrary Signal VI Help Example that I referenced earlier.  


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 8 of 10
(4,648 Views)

Alex,


I did what you wrote. Now, the acquisition section is working fine and I can measure the period, rise and fall time. However, I am trying to put that information in an arbitrary waveform generator. The steps to do this (which I think) are:


1) As the generated arbitrary signal has two segments (rise and fall time) I used two Arbitrary Wave blocks, one per segment;
2) I used the Append Waveform DBL.vi in order to put the segments together;
3) Finally I am thinking to align the waves (acquired and generated) by the Align Waveform Stamps.vi.


What do you think about these steps? Is there another way to do this?
Also, as you can see in the attached file sampleteste.VI, the step #2 does not worked. If you run the VI, the period Td must be put ahead of period Ts, thus the entire period of waveform must be Ts+Td, but it does not happened. Could you help me with this?


Thanks.
Jeison

Download All
0 Kudos
Message 9 of 10
(4,620 Views)

Hi jfonesca,

 

Sorry it has taken me so long to get back to you. I've downloaded your code and the steps that you have taken are very logical and I can't see any problems with your implementation, your steps towards programming this VI are very logical and it's shaping up to be a great VI!

 

All I can see is that so far they are producing the same data, except the 'Append' graph has a larger successing duration. I'm assuming that your issue is that the Ts value is not providing the expected 0V level length that you require.

 

The VI doesn't appear to be offsetting the signal by Td and I'm assuming this is your problem. I'm thinking that you may need to implement a way of constructing the algorithm so that the signals depend on the Td and Ts signals combined, instead of graphing the data points separately.

 

Could you please comment your code in future to explain the thought process that goes behind your algorithms and to signify what parts you'd like the user to debug? This makes everything much easier to understand the first time around!

 

Regards,

 

Regards,


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 10 of 10
(4,576 Views)