LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generation of DC signal with changing amplitude in certain period

Hi All,

I am wondering if anybody can give me a help.

I am trying to generate a DC signal, however, I need the amplitude of the DC signal to change after each iteration in a for loop.

the ideal is that, I am writing a program to perform Vector Scan. I intend to generate two DC signals to drive a typical scan coil (strength of X and Y DC signas will determine the bending of electron beam and hence can foucus on one position)

see the program attached


I have 2 questions:

(1) Is this the correct way to generate a DC signal to output (Just input numeric values)? Is there a better way?? (Please take note that I need the amplitude to change)

(2) The speed of this program is too slow (not faster enough as desired, somewhere around 4KHz), [Open the "Properties" od DAQ assistant, under  "Generation Mode", I can only use  "1 Sample (On Demand)", if choose other 3 options, it will give me error. ]

So, How can I increase the running speed?!

Thanks in advance~!!

Charlie
0 Kudos
Message 1 of 10
(3,711 Views)

Charlie,

Outputing a numeric value is the way to do it.

The most likely reason that your vi is running slow is the fact that you are using the DAQ Assistant.  Each time the inner FOR loop executes the DAQ Assistant ( X2 ) is repeating several steps that really only need to be done once outside your loop.  These just happen to be the steps that take the most time in DAQmx.

Suggest that you not use the DAQ Assistant and instead use the DAQmx vi's instead.  If you right click on the DAQ Assistant in your vi you have the option to Generate DAQmx Code.  This will give you an idea of what the assistant is really doing.  There are also many good example DAQmx vi's that ship with LV.  One in particular, Gen Mult Volt Updates-SW Timed.vi covers the general concept of what you are trying to do.  Also suggest you read the section in the DAQmx docs on the Task State Model.

To get the best overall performance you will need to create a single analog output task that contains your 2 output channels.  Do this outside the loops.  Then you can use a single DAQmx write inside your loop to write both outputs at the same time.  You just need to make sure that your vi clears the task after the loops are done running.

What version of LV are you running?  If I get some time I'll try and put together an example for your application.

0 Kudos
Message 2 of 10
(3,700 Views)
Dear centerbolt,


THANKS  for your  reply~

Very glad that you say the numeric  method is the  way to do it.

I am using the latest version -- LabVIEW8.5

I totally agree with you that it is the DAQ assistant which slow down my program. I will take a detailed look at what you suggested and the sample vi. I am not very firmiliar with DAQmx, it may spend me some time.

I think you are definitely right that I should use one one single output. Nice advice... 🙂

The reason I am looking the way to create the DC signals:
---------------------------------------------------------------------------
I intend to use LabVIEW to create an imgae capturing system (Using vector scan method, Raster scan is a bit complicated to do), this is applied for a miniature SEM (Scanning Electron Microscope, this SEM is built by ourselves). The idea is pretty simple: changing amplitude of X and Y DC signal will position the electron beam, and the back scattered electron will be collected by a PMT (Photomultiplier) and output a current (this current then will be converted to voltage before entering DAQ. I am using NI USB-6259 DAQ device.). then display an scaned image using an intensity graph (intensity graph accept 2D array)

X, Y DC signals physically position electron beam (from electron gun of SEM), while in software it should find a way to create the index of the 2D array. Finally, the voltage entering DAQ (from PMT convertion will be the value of each array element)

I am thinking, if DC is too slow, finally I may still go back to use saw-tooth signals (each cycle of X scan one row, and after one cycle, Y sawtooth increment with 1 step, this is the ideal of raster scan). I think saw-tooth signal is not easy to control and implement.
------------------------------------------------------------------------------

Finally, let me express my appreciation to your GREAT help 🙂

Charlie


0 Kudos
Message 3 of 10
(3,696 Views)
Charlie,
 
Been a long time since I got to play with a SEM.  Smiley Happy  Have attached a vi that shows how you might move the overhead outside the loop to improve speed.
 
 
0 Kudos
Message 4 of 10
(3,686 Views)
Thanks centerbolt~

Let me take a look at your vi first. 🙂

I am in Singapore, I have no the USB-6259 with me now, so I can only test it out tomorrow morning in my Lab.

I think the vi should work well, after that, I am planning to create the 2D data array for erntering intensity graph to form a scan image.

Good night~!

Charlie
0 Kudos
Message 5 of 10
(3,682 Views)
Hi centerbolt,

I've tried out the program you provided. It's nice to see that it functions well. Thanks.

However, the frequency is still not high enough (Do faster than my first try~ :)), The frequency is around 500Hz and I have no control of the frequency

So,

(1) Can I have way to run it even faster? (Can I have control of DC signal "frequency")

(2) If cannot, I may have to try using saw-tooth signal, which will give me frequency control. Hoever, I find it difficult to synchronize the acquisation of sample intensity (I must make sure each acquisation occur with each step period), somehow pretty hard in my opinion.



I lookforward to hearing form you soon~

And any other kind soul around please give a help if you know the way to solve these problem. Thanks. 🙂

Charlie


0 Kudos
Message 6 of 10
(3,667 Views)
Instead of calculating each XY position inside the loops, try generating a 2D array of XY positions and then using a single FOR loop to step through them.
0 Kudos
Message 7 of 10
(3,660 Views)
Many Thanks centerbolt,

I thinks your suggestion do can make my program even faster, however, I really need to have control on frequency, so I decide to try saw-tooth signals again....

Charlie
0 Kudos
Message 8 of 10
(3,654 Views)

Charlie,

Your DAQ device should have a couple of counters.  You may want to investigate using one of the counters to create a trigger that controls the timing of your DAQ writes and reads.

0 Kudos
Message 9 of 10
(3,651 Views)
Sure, centerbolt, Thanks for your great advice.

I amy try your advice out in the future. 🙂


Charlie
0 Kudos
Message 10 of 10
(3,643 Views)