LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error -200288 AO

Solved!
Go to solution

Hi DianeS,

 

In order to write the new waveform to change the output I have tried different things to empty the output buffer, like setting timing temporarily to finite samples or the buffer size to 0. Unfortunately none of them worked. I keep getting the same error over and over.

 

Your solution works fine, but it's kind of inconvenient for my original program to have this additional loop that needs to run continously. So until someone tells me how to clear or overwrite the output buffer I will go with the "dirty" solution to clear and re-create the task. I'm still not completely satisfied with this, but I couldn't find a way to manipulate the output buffer once it has been written to. If there is a way, please let me know.

 

Thank you for your advice, anyway. It helped me narrow down the problem.

 

Best,

Shell17

0 Kudos
Message 11 of 18
(1,483 Views)

Hi Shell,

 

I guess I'm not clear on why it's a problem to have a DAQ loop in your program?  You can pretty easily write the DAQ module as a queued state machine, and then just call into it as needed (to set up the task, start it, change the waveform, terminate it, etc.) from other places in your application.  That's what I do.  It works very well in applications which require a constant acquisition or generation, but also have to do a whole bunch of other things.

 

If you'd rather not explore the idea, that's totally cool with me -- it's your app -- but I'm curious as to why you're resistant to having a dedicated QSM that handles your analog generation.  It would be a bummer for you to constantly clear and recreate your task, and then have to come back to this forum to find out why your application has a slow memory leak.  😞

 

Anyway, if you want to toss ideas around, I'm happy to chat about it!  If not, no worries, and best of luck!

 

Diane

 

P.S.  As an aside, may I compliment you on the neatness of your code?  It's really nice!

0 Kudos
Message 12 of 18
(1,480 Views)

Hi Diane,

 

Actually, I would like to discuss the topic. I don't want to just turn down the suggestion because it is a good one.

 

The main reason why I don't like the idea of the loop is that I need to synchronize the signal with either a pulse train or the trigger of a camera's image acquisition (depending on the mode). I don't trust the loop to stay in sync. Is the timing precise enough to keep the pace with the other signal over a longer time or might it drift off after a certain time?

 

A second reason why I resent putting the loop in there is that I would need two of them. I have a case structure that contains the main part of my code deviding it into two modes/cases. To operate the output in both cases would mean putting one loop into each of them and starting/stopping them properly when I switch between the modes/cases. It would have been so much easier to implement if I could make the changes in a subVI that can be called several times in different places of my code. The subVI would just end after executing and the output would keep doing its thing. But with the loop, it has to be in the main program or I could never exit the subVI. It's kind of complicated.

 

On top of that, one of my cases contains a sequence structure where at one point the change to the output is applied and then the image acquisition starts. I cannot just put the loop inside, it would never go to the next panel. It completely messes up the structure of my code Smiley Frustrated.

 

 

Best,

Shell17

 

 

PS: Thank you for the compliment. I do my best Smiley Happy

0 Kudos
Message 13 of 18
(1,471 Views)

Hi Shell,

 

Encapsulating the acquisition in its own little QSM (queued state machine) sounds like it might be exactly the thing for you, actually, especially since you want to be able to call into it from different places in your code.

 

Do you know about queued state machines?  Your mention of the sequence structure makes me think that perhaps you don't.  Your mention of a sequence structure inside a case structure makes me shiver in horror!  🙂  I'd love to introduce you to better architectures, and I think you'll like them once you get to know them.

 

Tell you what.  I don't have time right this second since I'm on my way out the door, but I'm going to work up a little example for you that demonstrates what I'm talking about.  It's not going to be a complete solution or anything, but it will illustrate the concept and perhaps give you some new ideas on approaches you can take.

 

Stay tuned...

Diane

 

P.S.  A quick question:  Are you using the pulse train/trigger signal as your acquisition timing source?  You can, you know.  Did you already say what DAQ board you're using?  If it's a multifunction board, then you can guarantee synchronization by using the pulse train / trigger signal as a timing source for your acquisition.  Then you don't have to worry about drift.  Just a thought...

0 Kudos
Message 14 of 18
(1,460 Views)

Hi Diane,

 

Please excuse my delayed response. I took a trip out of town for the weekend.

 

I have read the term QSM in some other post somewhere, but I have never actually seen an example. So, no, I don't know about queued state machines. I would be really grateful if you could teach me how to use them to improve my code.

 

I haven't mentioned what hardware I'm using. The reason is that I don't know. One of my students is leaving for the US in a few weeks. He will do his master thesis in a coorporation project at a university there. They have the hardware and I do the mentoring of the student. That is what the program is for. I currently have no one there who I could ask about the hardware. I have a different hardware at my lab which I'm using to test my code. But most of the time I just use a simulated device. The real testing cannot start until my student arrives there.

 

I assume, however, that it is a multifunctional board, because it is used to control two analogue outputs and one digital channel. Let's assume it is, how would I use the pulse train as a timing source? How would I configure the trigger? Is it possible even when the pulse train has a much higher frequency than the waveform? So far, the pulse train is triggered to start with the ao starting trigger and it uses the same clock to stay in sync.

 

Best,

Shell17

 

P.S.  What is so bad about sequence structures? Aren't they used to make things happen in the correct order? Is using them bad programming style?

0 Kudos
Message 15 of 18
(1,434 Views)

Hi Shell,

 

Here you go...the weather was gorgeous here this weekend so I poked around in the garden instead of writing code.  🙂

 

Sequence structures are definitely bad style.  Whenever possible, you should use the error wire to enforce dataflow.  Sequence structures also have the disadvantage that there's no way to interrupt them, break into them, etc.  So once you're in one, you're stuck until the end!  State machines are much more flexible, as you will shortly see.

 

For using an external timing source for your generation, do a forum search on the topic, although it sounds like what you're doing is just fine (if it's working, why change it?).  You can also do a forum search on queues, queued state machines, etc.  There is TONS of information already out there.

 

Using a simulated device will work fine for this code, so you will be able to run it.

 

Take a look.  Read the comments.  Read the LabVIEW help for any function you don't understand.  I tried to be fairly clear about what I was doing, but our versions of clarity may differ.  🙂

 

Diane

0 Kudos
Message 16 of 18
(1,419 Views)

Hi Diane,

 

I finally found the time to look at your files (my computer is currently frequently occupied by a colleague). It took me a while to understand it, but now it's quite clear. Your comments explain things really well. That definitely does help me a lot. I guess I have still a lot to learn o.o

 

I will try to implement the QSM into my code. That will take a while because I have a lot to change in the main program. I will let you know when it worked. Thank you very much again for your example.

 

 

Best,

Shell17

0 Kudos
Message 17 of 18
(1,390 Views)

Hi Shell,

 

You're welcome!  I'm glad that you found it helpful, and hope that it showed you some different and more efficient/flexible ways to do things.

 

I remember first learning about QSMs.  Like you, I initially found them very confusing, but once I understood them, I never looked back.  I'm very glad that the comments helped!  You'll find that the custom controls are also documented...if you do a <ctl>H to bring up the context help window, and hover over the type-defined control's icon, you'll see my explanations of them.

 

If you run into more problems, start a new thread for each problem so that it will get more attention, and we'll help you along.  🙂  Have fun!

 

Diane

0 Kudos
Message 18 of 18
(1,386 Views)