Discussion:
Custom manual waveform generation
(too old to reply)
scalpas
2008-08-06 21:40:05 UTC
Permalink
Hello,

I have a PCI-6221 DAQ card and I need some advice for the interface I'm trying to program.

I need a program to define and build a waveform made up of several different levels (see attachment). This waveform will then be sent to the analog output of my card. The basic requirements of the program are :

- the number of levels is defined by the user (typically 10-20 levels)
- the duration (a few seconds per level) and amplitude are defined by the user
- this basic waveform is then repeated several times (typically a few hundred). However, there should be a factor to multiply the whole waveform at the beginning of each cycle, to increase it.

So I'm not sure about the best way to implement this, so any advice would be welcome.

The best approach I've thought of is the following :
- the user enters the number of levels, with the amplitude and duration of each level, in a table.
- the program then builds the waveform using the ''basic function generator vi'' placed within a for loop. The function would be a square wave with a duty cycle of 100%. Each time the loop would generate one level and append it to the previous levels.

Is this a good approach ?

Thanks,


waveform.jpg:
Loading Image...
Hillman
2008-08-07 12:40:09 UTC
Permalink
Hi scalpas,
 
I have attached an example which produces a user defined waveform. I have tried to comment it as well as I can for you.
 
As for your hardware and generating the waveform periodically you should try this first off,
 
But feel free to post back if you encounter or have any other issues.
 
Thanks,


customizable waveform.vi:
http://forums.ni.com/attachments/ni/170/347475/1/customizable waveform.vi
MikeS81
2008-08-07 12:40:09 UTC
Permalink
Hi Hillman,
you donĀ“t need the first for loop! You can use the multiply function directly.
Mike
Hillman
2008-08-07 13:10:08 UTC
Permalink
Hi,
Thank you - your very right... easy to over-complicate things.
Heres the corrected one.Message Edited by Hillman on 08-07-2008 01:59 PM


customizable waveform.vi:
http://forums.ni.com/attachments/ni/170/347498/1/customizable waveform.vi
scalpas
2008-08-07 13:40:07 UTC
Permalink
Hi,

Thanks for your help. However, I have Labview 8.0 and I can't open the vi, which was programmed on 8.5 apparently. Is there any way of opening it with 8.0 ?

Thanks,
MikeS81
2008-08-07 13:40:07 UTC
Permalink
Hi scalpas,
with changes now. :smileywink:
Mike


customizable_waveform_LV80.vi:
http://forums.ni.com/attachments/ni/170/347510/1/customizable_waveform_LV80.vi
scalpas
2008-08-07 14:10:09 UTC
Permalink
Thankyou very much, it's exactly what I needed !
For the moment I've got one question : is there a way of controlling the number of elements in the array directly from the program ? The only way I've found is to right-click on the array and then ''data operations\insert element before''.

Thanks,
MikeS81
2008-08-07 14:40:05 UTC
Permalink
Hi scalpas,
for more comfort, you can add an event structure and react on the change events of your controls.
Mike
scalpas
2008-08-14 16:40:06 UTC
Permalink
Hi, This may be a daft question, but I haven't managed to find the answer in the Labview documents (and I'm relatively new to Labview). Between 2 samples, will the card just do a linear interpolation to create the output signal ?If so, then let's take the case of the programme you created for me : let's say that the signal stays at 4 V for 5s. If I have a total of 2 samples (1 at 0 s and 1 at 5 s), will the resulting signal from my card be the same as if I'd set a sampling rate of 1000 samples/s for example ? Thanks, 
Chris_D
2008-08-15 18:10:07 UTC
Permalink
Hey scalpas,

The DAQ device will not do any linear interpolation between samples. When you output a sample, it will hold that value until the next sample is output. If you are doing software timing then it will update the value based on each time that you write the sample. If you are doing hardware timing then it will update the value on each rising edge of the sample clock.

For your example, yes, the resulting waveform would be the same as long as the value of all the samples were 4V.
Loading...