From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error - 200462 - Generation cannot be started because the output buffer is empty.

I am fairly new to LabVIEW and beg your forgiveness ahead of time for my lack of experience.  After scouring the forums, I have found several posts that deal with this error, but none of them apply to what I am doing.

 

My goal:

I need to write a voltage to an analog output card every 1ms (simulated by the random number)

 

Error:

Error -200462 occurred at DAQmx Start Task.vi:7

Generation cannot be started because the output buffer is empty.

Write data before starting a buffered generation. The following actions can empty the buffer: changing the size of the buffer, unreserving a task, setting the Regeneration Mode property, changing the Sample Mode, or configuring retriggering.

Task Name: _unnamedTask<300>

 

Hardware Setup:

NI CDAQ-9188 (Ethernet 8-slot chassis) - (Self-test in MAX returns no errors)

NI-9264 (16CH Analog Out)

Connected via the company's network infrastructure

 

The Problem:

Every time I run the VI, it seems to run at the correct speed, however after completion I get an error stating that generation cannot be started because the output buffer is empty.  At this time I have completely depleted my LabVIEW skills and cannot find what I am doing wrong.  I have identified that the error is coming from the "DaqMX Start Task" VI, but I have no idea how to resolve it.

 

I attached my VI below.  Thank you in advance for any help,

Message 1 of 10
(9,461 Views)

pvanzyl

 

Thanks for your post and uploading your code.  Your code looks nice, but I think I may be able to spot why you are getting your error message.

 

In your DAQmx Timing.vi you have "Continuous Samples" wired into it; this tells the board to expect some data at the rate you set (250Hz).  Then you tell it to start the task but since the buffer is empty it returns an error message.  Then you have your write function inside a while loop with timing of 4ms (250Hz) to be a random number and once you tell it to stop then it stops the task but since it has returned the error message already it will not perform this task.

 

My advice - lose the DAQmx Timing.vi altogether!  It's best used when you are writing `NSamp' in which case you should have your DAQmx write.vi before your DAQmx Start Task.vi so that it fills the buffer and then writes at the rate you told it to.

 

Regards,

Robert Ward
Applications Engineer, NI
Message 2 of 10
(9,453 Views)

Robert,

 

Thanks for the reply.  I tried losing the timing VI, but then my loop can run at the fastest speed of 40ms.  Any idea how I can improve the loop speed without using the timing VI?

0 Kudos
Message 3 of 10
(9,450 Views)

pvanzyl

 

I am not sure what you mean by `improve the loop speed'.  What do you mean by this?  Using the Wait Until Next ms Multiple should be ok, no?

 

There are such things as Timed Loops in Functions Palette -> Programming -> Structures -> Timed Structures -> Timed Loop, where you can set priorities and the like but if you are using a 1kHz derived clock I don't see how this is better than using a wait until next ms timer.


Regards,

Robert Ward
Applications Engineer, NI
0 Kudos
Message 4 of 10
(9,443 Views)

Robert,

 

I tried a few things in my spare time today and I have some strange results.

 

I created a duplicate loop to write a voltage to another channel on the same NI-9264 card.  The duplicate loop has the timing, start, and stop VI's removed.  See the attached VI.

 

When I start the loop without the timing VIs, it runs at 0.036s. (Recall I want 4ms, and 1ms as a final result)

When I start the timed loop, that fires at 4ms, but also affects the untimed loop to fire at 4ms as well.

 

My final goal is to have one VI that runs and reads / writes every channel on my CDAQ for use in other programs that are distributed on the network.  Currently, that is 56 channels total.

0 Kudos
Message 5 of 10
(9,421 Views)

pvanzyl,

 

I am glad you have something working; now we can try to get it working right. I take it that you are no longer getting the -200462 error message in your top loop - that seems strange.

 

Basically your top loop is hardware timed and your bottom loop is software timed.  Hardware timing is more accurate; as your benchmark timing proves.  The dilemma we have is that if we want to use hardware timing we need to fill the buffer before the task starts but since you want to write continuously it's not as simple as putting a loop around the DAQmx Write.vi

 

Let's try using a DAQmx Is Task Done.vi inside a loop; this will make sure that we have continuous buffered generation (see attached code).  One problem with this however is that we will keep writing the same random number each time.  To overcome this place a Write vi inside the loop and wire the new data into the data terminal.  Using a write property node, select the Regeneration Mode property and set it to not allow regeneration.  You need to make sure you generate new data fast enough to prevent the buffer from regenerating old data.

 

Let me know how you get along with this.


Regards,

Robert Ward
Applications Engineer, NI
0 Kudos
Message 6 of 10
(9,408 Views)

Rob,

 

I am pretty sure that I caught what you were saying.  Please verify that the VI attached is what you instructed. 

 

I am still getting an error and this tiem it is saying that the write buffer is empty.

 

I noticed that the Start Task is still the place where the error occurs, even though a random number has been written to the buffer.  Is that because only one value was written to the buffer and it reads it faster than the loop can fill values again?

 

Any help is creatly appreciated.

0 Kudos
Message 7 of 10
(9,393 Views)

pvanzyl,

 

I read the error message and it says "Write data before starting a buffered generation.  The following actions can empty the buffer;... setting the Regeneration mode property..."  So because you have the property node wired before the start task it clears the buffer so when you come to start the task it is empty.  Try putting the property node after the DAQmx Start task.vi (but wire the property node in properly with error/task in and error/task out). 

 

I am not 100% sure if it needs to be inside the while loop and/or after the DAQmx is Task Done.vi either so have a play around and see what works; but this is the cause of the error.

 

Regards,

Robert Ward
Applications Engineer, NI
Message 8 of 10
(9,377 Views)

Rob,

 

I wired the property node properly per your instruction, but I am now getting an error that states the property cannot be chaged while the task is running.  The loop runs at the correct speed, but the new error still exists.

 

I looked into the NI KB and this is what I found, but I am not sure that I want to start and stop the DAQmx task, do?

http://digital.ni.com/public.nsf/allkb/B84FB2E8915E601086256D1D00646B1B?OpenDocument

 

I have tried the following combinations of the RegenMode property node locations:

1) No property in VI - No Error - Slow Sample Rate (16ms)

2) Before Sample Clock - No Error - Slow Sample Rate (16ms)

3) After Sample Clock - Error - Buffer empty

4) After 1st DAQmx Write -  Error - Buffer empty

5) After DAQmx Start Task - Error - Cannot change property while task is running (See Screenshot)

6) Inside Loop before DAQMX is task done - Error - Cannot change property while task is running (See Screenshot)

7) Inside Loop after DAQMX is task done -Error - Cannot change property while task is running (See Screenshot)

😎 Inside Loop after DAQMX Write - Error - Cannot change property while task is running (See Screenshot)

 

Thanks for your help.  I attached the VI in case you wanted to toy with it.

 

PvZ

0 Kudos
Message 9 of 10
(9,366 Views)

pvanzyl,

 

I have had a chat with a colleague in the office, and he advised going into the NI Example Finder and loading up Voltage (non-regeneration) - Continuous Output.vi found under Hardware Input and Output -> DAQmx -> Analog Output.  Are you able to get that working?  If so can you adapt it to write a random number to an Analog DBL 1Chan 1Samp DAQmx write and it should work as you want it to.

 

Let me know how that goes.


Regards,

Robert Ward
Applications Engineer, NI
Message 10 of 10
(9,356 Views)