Error 0xfffcf19c - Some or all of the samples to write could not be written to the buffer yet. More space will free up as samples currently in the buffer are generated.
This process is taking too long, so I am looking into ways to speed it up.
Any ideas?
Thanks,
Anson
I have written an example which I think demonstrates the operation you
discussed. I am assuming you are developing in LabVIEW, but if you are
using another development environment the same ideas will hold true. I
modified one of our example programs to use regeneration to update the
data that is generated by writing new data to the memory buffer that is
being generated. For a more detailed description of regeneration, you
can see the NI-DAQmx Help which you can find by going to your Start menu and selecting All Programs>>National Instruments>>NI-DAQ. Specifically, the help file has a section called Regeneration which states the following:
"Regeneration
Generating the same data more than once is called
regeneration. You can configure NI-DAQmx to allow or disallow
regeneration by setting the Regeneration Mode
attribute/property. By default, NI-DAQmx allows regeneration for sample clock
timing and disallows it for handshaking or burst handshaking timing. When
regeneration is disallowed, new data must be continuously written to the
device.
Allowing Regeneration and Using Onboard Memory
When the Use Only Onboard Memory
attribute/property is true, NI-DAQmx transfers data only once to the device and
that data is continually regenerated from there. Attempting to write new data to
the device after starting the task returns an error. In addition, the amount of
data written to the device before staring the task must fit in the onboard
memory of the device.
When the Use Only Onboard Memory
attribute/property is false, NI-DAQmx continuously transfers data from the host
memory buffer to the device even though this data is not changing. Thus, if you
write new data to the device after starting the task, that new data is generated
and regenerated until you write more new data. This type of regeneration is
sometimes called PC memory or user buffer regeneration.
When this attribute/property is false, you can also set the
Data Transfer Request Condition attribute/property to specify
when to transfer data from the host buffer to the device."
My example is attached and is called Cont Gen Voltage Wfm-Int
Clk-Regeneration_Modified.vi. There are more notes in the VI itself
regarding each function used, but basically this example takes an
update from the user through the Front Panel and writes the value on
the analog output. You could easily modify this example to calculate
the update based on a formula or equation that better suits your needs.
I hope this helps, let us know if you have any other questions.
Cont Gen Voltage Wfm-Int Clk-Regeneration_Modified2.vi:
http://forums.ni.com/attachments/ni/250/38760/1/Cont Gen Voltage Wfm-Int Clk-Regeneration_Modified2.vi
- Set "Regeneration" = true
- Set "Use Only Onboard Memory" = false
This will result in the device getting constantly updated with the contents of my data buffer, which I can update while the Task is running using the standard write() functions.
Is this correct?
I have some questions about the "UseOnlyOnBrdMem" configuration function ( see declaration below )
DAQmxSetAOUseOnlyOnBrdMem(TaskHandle taskHandle, const char channel[], bool32 data)
The channel[] parameter surprises me!
- Do I need to supply the name of the output channel in the task that will be using "user buffered" generation?
- What if the task contains multiple channels, do I need to call this function for each channel in the task?
- Is it possible to have one channel in the task using "User Buffered" data while the other use "Device Buffered" data?
Thanks,
Anson
- DAQmxCreateTask()
- DAQmxCreateAOVoltageChan()
- DAQmxSetWriteRegenMode()
- DAQmxSetDOUseOnlyOnBrdMem()
Steps 3 and 4 are generating the following errors:
3) DAQmxSetWriteRegenMode( DAQmxTaskHandle, 1 );
Error 0xfffcf273 - Requested value is not a supported value for this property.
4) DAQmxSetDOUseOnlyOnBrdMem(DAQmxTaskHandle, NULL, 0);
Error 0xfffcf0fc - Specified property is not supported by the device or is not applicable to the task.
Any ideas why I am receiving these errors?
Thanks,
Anson
Regeneration Mode Property.jpg:
http://forums.ni.com/attachments/ni/250/38907/1/Regeneration Mode Property.jpg
- DAQmxCreateTask()
- DAQmxCreateAOVoltageChan()
- DAQmxSetWriteRegenMode( DAQmxTaskHandle, 10097 );
- DAQmxSetA OUseOnlyOnBrdMem(DAQmxTaskHandle, NULL, 0);
- DAQmxCfgSampClkTiming()
- DAQmxCfgOutputBuffer() -- I may not need this one anymore
- DAQmxWriteAnalogF64()
- DAQmxStartTask()
This sequence is working fine, and the first value I write to the task is being generated at the expected output.
After the task is started I am unable to update the output.
- I've tried updating the data buffer I passed to the task in step 7
- But the output is not updated.
- I've tried resending the DAQmxWriteAnalogF64() command
- I receive the same errors described above when performing the write command on a running task.
Am I missing something?
I thought that configuring the card in this manner would allow me to update the output task ( without stopping the task ) by changing the contents of the buffer supplied in step 7. Is this not correct?
Thanks for all your help,
Anson
- Create and configure the Task as we have discussed above
- Write a single sample of 2 (2 VDC)
- Start the task
- Attempt to write a new sample to the buffer (3 VDC)
- No failures generated but the output stays at 2 VDC.
- The output eventually drops to 0 VDC ( with no input from me)
Any ideas why I would see this?
Thanks again,
Anson
Bmode trig V1.2.vi:
http://forums.ni.com/attachments/ni/250/40358/1/Bmode trig V1.2.vi
So it sounds like you need to output a
repeating sequence of values timed to an external 21 kHz clock. To do this I
would recommend taking advantage of analog output regeneration. This will let
you write the output sequence to the buffer once and then the card will output
the sequence over and over. You can time this to be synced with an external
clock. An example of this can be found in the NI Example Finder. In LabVIEW go
to Help >> Find Examples? >> Hardware Input and Output >>
DAQmx >> Analog Generation >> Voltage >> Cont Gen VoltageWfm ?
Ext Clk.vi. The external clock will be your 21kHz signal and you can replace
the examples waveform with your repeating sequence.
One thing I noticed in your VI is that
you have 300 wired to the rate terminal in the timing vi. When you are
providing an external clock the rate terminal should be set to the highest frequency
you expect that external clock to run at, in your case 21000. Also you will
want to set the sample mode to ?Continuous Samples?. Please let me know if you
have any questions and take care.
Thanks,
The way the example I showed you and hardware
timed analog output works is that on each edge of the external clock 1 sample
from the buffer is output. It does not output the entire buffer on each edge. When the end of the buffer is reached it
starts over from the beginning. So if you write 0,3,6,9 to the buffer on the
first clock edge 0 will be output. On the second edge 3. Next edge 6. Then 9.
On the fifth edge 0 will be output again and so on. This sounds like the behavior
you were looking for. When using an external sample clock the output will be
timed to that clock and only output a sample on the active edge of that clock.
You still however need to set the rate terminal of the timing VI with the
highest frequency that you expect that external clock to run at. This is so the
drivers know how large of a buffer to allocate for the task. This value is used
to setup the timing of the acquisition only when using the internal sample
clock. If you provide an external sample clock the output timing will depend
solely on that clock. I hope this helps and let me know if you have any
questions.
Thanks,
sample4.vi:
http://forums.ni.com/attachments/ni/250/41332/1/sample4.vi
ampUpdate.vi:
http://forums.ni.com/attachments/ni/250/41657/1/ampUpdate.vi