Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating 4 analog output waveforms with different frequencies

Solved!
Go to solution

Hi viswa,

 

To address your questions:

 

1.  If you're using the AO sample clock for your digital waveform, your resolution is going to be equal to that clock rate.  For example, if you were updating at 10 kHz, you could define your digital pulses in 100 us intervals. The way to do this is to build an array of digital values that correspond to what you need (a digital "waveform").  The waveform will regenerate continuously by default, so by changing the size of the waveform you can adjust the frequency of your output.  For example:

 

@ 100 kHz sample rate:

[1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ] would give you a 50% duty cycle @ 5 kHz since there are 20 total points in the cycle (100 kHz / 20 = 5 kHz).

 

[1 1 0 0] would give a 50% duty cycle @ 25 kHz.

 

[1 1 1 1 1 1 1 1 1 0] would give a 90% duty cycle at 10 kHz.

 

Like I said this is going to be the trickiest part, but you will need to programmatically build this array based off of the specifications you require.

 

 

2.  Do you mean you are getting a buffer underflow?  If that's the case, you'll probably need to increase the Buffer size to ensure the loop can keep up with the data being output.  The minimum requirement is going to be system dependant, but setting the ratio of (Sample Rate : Buffer Size) to about 5:1 should be a good starting point.

 

Hopefully this clarifies a couple of things, if not be sure to let me know if you have any questions.

 

 

-John

Message Edited by John P on 11-09-2009 04:41 PM
John Passiak
Message 21 of 65
(2,155 Views)

Hello John,

                  Thank you for your reply. I tried to generate digital pulses with different frequencies have got problem defining them precisely (pulse width and frequency). So i took alternative approach to synchronise generation of analog signals with camera acquisition.

 

I took out V-Sync pulse of the CCD camera and gave it as external digital trigger (PFI0) to the analog output generation. It does generate all the AO waveforms triggered at the rising or falling edge of the triggering digital pulse initially (Trigger1.JPG). I just cross checked the signals with oscilloscope.

 

Then a problem was noticed i.e. the generated AO waveforms on oscilloscope  are not locked  instead keep drifting ("drift" means the AO signals and digital trigger pulse are in synchronsation (rising edge) at the start of the generation but as time passes they are not in tiggered in sync with triggering pulse any more) on the screen (Trigger2.JPG).

 

I used GOULD DSO 400 model oscilloscope to check the signals generated by the DAQ AO's.

 

1. Initially Oscilloscope was internally triggered by one of its two channels i. e. channel1, then the reult was signal fed to channel 1 was locked on the screen but not the signal in channel 2. 

 

2. Later tried changing trigger to channel 2, then signal in channel 2 was locked but channel 1 was drifting. 

 

3. Finally  CCD vertical sync pulse was used to trigger externally the oscilloscope, then also i did see all the analog output waveforms drifiting. 

 

All the 4 AO waveforms drift i changed sampling rate and no. of samples as well still i can see the drift.

 

Could you figure out what might be problem???? I double checked the AO waveforms with ext. trigger using another oscilloscope as well, observed same drifitng. 

 

If i fix this drift my problem is solved!!!!!
Message Edited by viswa on 11-12-2009 01:14 PM
Download All
0 Kudos
Message 22 of 65
(2,135 Views)

Hi viswa,

 

So it sounds like the delay between your external trigger signal and the AO lines is what is drifting.  Is this correct?

 

Could you post your code so I can see how you have your triggering defined?  Also, what is the time/div on the Oscilloscope screen shots?

 

 

-John

John Passiak
0 Kudos
Message 23 of 65
(2,119 Views)

Hello John,

                      Its not the delay that is causing the drift, but the original code is doing that i guess. I tried to check the AO waveform generation with out external trigger, then also i can see the drift. I have discussed this issue with my supervisor he also feels the same some strange behaviour of waveform generation is taking place.

 

Could you check generated AO waveforms with an oscilloscope to confirm the behaviour with default values as well as for other values of clock rate and other paramets? Whether sampling rates and no.of samples or some other parameter is causing this drift?  I will send you a video as well later today about how the waveforms are drifiting.

 

The time/div is 10ms/div and votage is 1V/div please refer to trigger image 1 and 2.

 

 

Message Edited by viswa on 11-13-2009 06:21 AM
0 Kudos
Message 24 of 65
(2,109 Views)

Hi viswa,

 

Did you have the chance to acquire the video of the drift you are seeing?  Also, what parameters do you have set for the frequency of your outputs--if these don't line up evenly (keeping in mind the restrictions of the sample clock) then I would expect to see some drift over time.  Do the waveforms drift on the front panel of the VI as well?

 

-John

John Passiak
0 Kudos
Message 25 of 65
(2,087 Views)

Hi John,

                    Thanks for your reply. i did not acquire camera pulse as AI along with AO's generation in sync, i used camera pulse only to trigger externally as explained in the previous post. The parameters set in the front panel are sample clock rate 100000S/s No.of samples 20000, 2 sine waveforms of 1000Hz frequency for 2 array elements and a square waveformof 25Hz. I have given camera pulse as external digital trigger to PFI0 at rising edge.  Except camera pulse all other AO were checked through waveform graphs, they were not drifting opposing to waveforms displayed on oscilloscope. [just have a look at the vi attached to last message for more info]. 

0 Kudos
Message 26 of 65
(2,070 Views)

Hi John,

                  I have another idea of locking the drift in especially saquare waveform. The idea is to define an analog output which completely depends on analog input.

 

1. I would like to acquire camera pulse using an analog input AI (pulse has 50Hz) and define an analog output which toggles between high and low (or +V and -V) voltage values at every rising edge of the input. 

 

2. I would like to generate some more AO (2 sine waves) simultaneously along with the toggling AO signal. 

 

3. Add one of the sine wave froms to toggle signal. [Toggle signal can be simply high and low but at that time i can not add any other AO to it to produce added signal].

 

Even though there is drift in sine waveforms it wont be a problem because they will be operated at the same frequencythey will cancel each others effect in my work.

 

But now the squareform AO is completely depends on AI so we will have always locked toggle signa,l toggling at each rising edge of AI.

 

I have attached an image (front panel.JPG) and vi (Inverting CCD pulse revised.vi) with which i tried to generate a toggle analog output while acquiring camera pulse in AI but got many problems with it, you will definetely get clear idea of what i want to do after looking at the VI .

 

 

Please let me know if you could find any idea to solve the vi with above requirements.

 

Many thanks!!!!!

Download All
0 Kudos
Message 27 of 65
(2,066 Views)

Hi viswa,

 

What voltage does the AO square wave have to be?  If you can get by with TTL voltage levels (0-5 V) then we can do what you need with either the Digital Output or Counter Output subsystems.  Since all of the AO lines share the same sample clock, I can't think of a good way to do this with the AO subsystem based off of what you have described since the AO is already being clocked out at a faster rate to generate the sine waves.

 

Could you post a timing diagram of all of the input signals and output signals required?

 

 

-John

John Passiak
Message 28 of 65
(2,049 Views)

Hi John,

               Thanks for reply, kudos for your persistance to solve my problem!!!! I need a few 100mV AO or DO. Conceptually i was thinking today about this high and low two state flip if the signal is digital or AO square wave if it is analog. 

 

1. The concept is simple, its like bistable multivibrator output with CCD camera vertical pulse as input, at every rising or falling edge of the CCD pulse the DO should change its amplitude, so now i am clear that the high and low flip can be possible only with digital generation.

 

(Experimentally camera acquires an image at every rising edge of a negative pulse @ 50Hz (refer AI and DO timing.JPG). I want to change laser current at every rising edge of the camera pulse, i.e. the laser sends change in wavelength info to CCD which acquires new info at every rising edge.

 

2. Once it is done then this vi will be integrated into muliple AO vi with control over phase, frequency, and amplitude.

 

 As you written code for me at the beginning of this thread to generate muliple AO, now that vi will get additionally have an AI which is acquired from camera and DO.

 

3. I also want addition of the DO with one of the AO sine waves.

 

NB: Analog output waveforms vary in frequency in the range of 1Hz - 12kHz.

 

 Please kindly ask me if you need more information. Again thanks a milllion!!!!

 

 

0 Kudos
Message 29 of 65
(2,044 Views)

Hi John,

                     Could you please look at my problem for solution?? I have tried in different ways but unable to find a solution. 

0 Kudos
Message 30 of 65
(2,011 Views)