LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ao write and Ao start

i would appreciate, if somebody solve my problem.
i am sending to VIS. in the VI test5, i am calling Ao write and Ao start outside the While loop. if i want to send 32 periods of a sine wave. it works fine but when i would like to pause sending these periods to the board and after few hours would like to resume the rest of the priods and send them to board. it does not work why?regarding this VI one more question is there any limit of number of periods. for example i send upto 40,000 periods and it starts genearting periods.but when i send 1 million periods, it gives the out of memeory error. can i collect these 1 million periods in array and then i write 1000 periods to the write function. moreover if i would like to interrupt writ
e function for a break and resume sending rest of the periods, how can i do this?
2)in test 6 vi i can pause and resume the application, but if i would like to send only 2 periods, then i see 2 periods on the osilloscope. then continuos zero points and after a delay again 2periods and this zero points delay is constant. why i am getting a repition of 2 sine periods. i just send 2 periods and the program should stop after 2 periods. if i send 10000 periods, then it should display these 10000 periods on the osilloscope and stop. if i wanna break some where in between, then i must be able to reume from the point where i made a pause. please help me in this respect.
Thanks
Regards
Download All
0 Kudos
Message 1 of 12
(3,955 Views)
Hi,
do you have VI something as "Ao stop.vi"?
Because when you set to Ao 10000 samples and you Start sampling, you give control to you external Ao devices. And you can not break this operation.

You need somethink like as "Ao stop.vi" and this Vi you call when you press break button. You need one "process-theader" for User Interface {stop button} and one "process-theader" for sending samples to Ao devices.

For UserInterface and Breake and Continue you can use Staus Machine or Event Structure - look to "Find Examples".

AD: "send 1 million periods": Try generate array with one period and this array send 1 million times.

Have nice day.
JCC
Message 2 of 12
(3,955 Views)
Hallo JCC
No in AO palette National instruments did not provide AO stop VI. in my case how can i implement this process theader. please can you give me an example.
i send i million periods, but it does not work. it errors that out of memory. how can i solve this issue.
because i am a beginner. i am still learning. so i would be grateful for your help.
regards
Hood
0 Kudos
Message 3 of 12
(3,955 Views)
Why would you want to send 1 million periods to the daq board instead of just 1 and have it continously output for some amount of time?
0 Kudos
Message 4 of 12
(3,955 Views)
Thanks Dennis. you meant that i should set 0 to AO start VI for continuous execution and set some time for that execution, as i am already doing this.
but the demand of my application is that i have to generate a sine wave. N number of periods/cycles of sine wave are given.it could be possible that i have to generate sine wave upto 50 periods or it could be possible that i have to generate periods upto 1 million. because this 1 million periods of a sine will control and oscillate another mechanical cylinder 1 million times. as i said it could be 50 times oscillation or 100 or 30000 periods/oscillation possible. i just want to control this oscillation by periods but not by time. that means if i have given 10000 periods to generate, it must s
tart, generate and and stop after 10000 periods. if i pause after 500 periods and resume after 4/5 days the rest 9500 periods must be generated, because as i told you the
cylinder must move/oscillate 10000 times and only
500 times, i oscillate it. the rest i resume after few days and the rest 9500 oscillation must be done now.i have been trying to solve this problem and stuck with AO write VI and AO start VI.i tried my bes all the possiblities to break Ao write / AO start VI and then resume AO write/Ao start VI after several periods with several methods, but i did not succeded. i dont know how to solve this problem. i would be very very greatful for the solution.
regards
Hood
0 Kudos
Message 5 of 12
(3,955 Views)
Hi Hood,
I have for you any examples, but it is in LabVIEW 7.1. I hope you have 7.1. If not, I rewrite that to LV 6.1.

: _wave_generator.vi - is wave generator from LV, you can use or not.

: StateMachine.vi {and StateMachineStates.ctl} this is skeleton for your application. Try debug this code and you will be understand state machine in LV. I speculation it is clear. In state "Running" try change any value of wave and this change you will see on wavegraph.
Warning, when you in 'Pause' state, do not press button Breake again! After you will can not leave this state. {this 'Pause' state need Event Structure too}

: StateMachine_Ao.vi - it is same as previous and added your Ao VIs.
Try generate one wave signal with only two periods.
State 'Running' will be sending this wave constantly. Try found on you oscilloscope if is signal between ther two waves continuous. If yes after you can use this technique generation.

Have a nice day.
JCC
0 Kudos
Message 6 of 12
(3,955 Views)
Thanks for your reply and example. in the above example when i write to send 2 periods, there is continuous generation of periods. what i want is that this generate 2 periods and stop. if i give input 50,000 periods, then this must generate 50,000 periods and thn must stop. i am doing this because some times i want to send 5000 periods. sometimes i want to send 50,000 periods and so on so forth.why i am not able to stop after execution of periods.please can you explain this? regards
0 Kudos
Message 7 of 12
(3,955 Views)
well i have L 7.1. now i am sending you the altered VI. i am using a subvi for generation of waveform,instead of function geneartor. this is i am doing because i dot want a symmetric sine but with amplitude value from +5 to -7. i am attaching also thesub vi for the wave generation. just now when i send 16 periods to osilloscope. i saw on continuous sine waves with a slight delay after every 8 periods. and as i told you continuos display of periods. i just want when iset 16 periods, it shows continuous 16 periods without any delay and then stop. if 1000 periods, then it shows 1000 continuos periods, then stop. why it is not possible, why can we not control AO start. and you also write that we can only pause/break only 1
times. why not we can pause and resume several times? are all these things not possible in LV 7.1? thanks for your help
regards
Download All
0 Kudos
Message 8 of 12
(3,955 Views)
OK, try this one 'state_Ao2.vi' - this VI generate only one period, but this period send many times to Ao. On the display you can see remaining period number. Now you need allocate memory only for one period.
=> When you need send 50,000 periods, program send 50,000 times one period, and allocate memory only for one period.
You can modify code and when need send 50,000 periods, program send 10,000 times 5 periods.

When is program in state 'Running' you can not see and click to button 'Continue'.
When is program in state 'Pause' you can not see and click to button 'Break'.
0 Kudos
Message 9 of 12
(3,955 Views)
Dear JCC(SK)

Many thanks for your help. well i checked your VI and othe basis, i have few questions, difficult for me and i dont find the answer of these questions. please help me.
i added two more Function generator, and i discuss each in detail why did i add two and what are the problems i am facing, after addition of every Function generator.

1) in my first generator(that sub vi i am using two times to generate sine). first sine generating sub vi, when i send 1 period, on osilloscope i see 2 periods, when i send 2 periods, on oscilloscope i see 3 periods, and so on so forth. every time one more period than actually i send is displayed. why?

2) always there is a delay(word document attached) after every period. i think this is due to this repetition in while loop, as you said 50,000 times 1 period displayed.i thought this may be due to the time delay of loop. i reduced time on the timer and increse the timer, but no good results .well this problem is present in my all of three generated sines.

3)when i set 0 parameter for AO start, then there is a continuous and very nice smooth display of sine(such a display is required when i set parameter 1) , but the bad news here by setting this parameter to 0 is that i cannot pause any more or stop any more.after setting this parameter to 0, the program is out of control. only then i have to abort the program. why?

4) i added one more channel and obviously one more source(my sub vi). good news is that this sub vis is also taking value from period variable. that means period act like a global variable, and it runs as much as periods i define. but the bad news is that again this sub vi on different channel(1) also display the same results like the 1st VI. i mean delay between periods.

5) the third sine sub vi source i took (Function generator).it is simple, has only frequency and amplitude) when i am adding its result wave to my other source (Sub vi). i am getting delay again after addition of two sine waves. i think a little dely from 1st sine( MY sine sub vi) and the second dely from Function generator(the simple sine array source).the good news here again that when i run the 1st,second and third source, it finishes execution as soon as number of given periods finishes.

6)Now very very important issue.and that is let us talk about periods,time relation ship.
if i give in the field of periods 100 periods as input and if i give input frequency(for 1st my sub_VI source 1.6HZ frequency). on this basis i calculate the total time required. it is 62.5 seconds. as you can see in the indicator this periods must take 62.5 seconds for execution or displaying on osilloscope. but the bad news is that these 100 periods with 1,6 HZ frequency take around 16 seconds to finish their execution. another example if i select 50,000 periods with 1,6 Hz frequency.these periods must finish in 31250 seconds. but in this case they are finishing execution early. why these periods does not pass the mathematical calculaton/definition of periods, frequency, time relationship? And you know this is very important ,because when you give N number of periods, according to frequency, youmust acheive corresponding time.

7) why i am interested in all these, i would like to tell you that i have two cylinders, one cylinder i am moving vertically. for this vertical movement/osillation i need addition of two sines.one sine that that has assymetric amplitude e.g, from 5 to
- 7( the word document of the sine wave that is not the true sine attached). this sine wave( my 1st sub_vi for sine wave generation), the user input is max ampl, min amplitude(frequency in Double) and the total number of periods.
in the second sine that i add to first sine( user input is frequency ampitude and corresponding periods).

here i want to mention, if i have total number of periods for first sine wave and the frequency, i can calculate the total time , that i am doing already but as i said I am not getting correct and corresponding total time.

well this addition of sine waves was for vertical movement of cylinder.

😎 for the horizontal movement of the cylinder, i am using another channel and sub vi source. there again the delay problem appear.
i hope, now i explain every thing in detail, so that you have clear picture,when you are answering me.
9) I am using AT-MIO-16XE-50 board from NI .

I think these problems are due to some bug in AO start, that is.when you start generation, you cannot pause resume it any more. i dont know whether i am right or wrong.
well with the answers of my questions, i learned a lot from you and all other colleges they help me about Labview and i would be very thankful and grateful to you and other colleges who help me on this forum.
have a nice day.
Regards

Hood
0 Kudos
Message 10 of 12
(3,955 Views)