Discussion:
PCI-6534 Onboard Memory Pattern Generation C#
(too old to reply)
Patrick S
2008-04-01 13:40:07 UTC
Permalink
Hi, I'm using a PCI 6534. I'm trying to write loops of data to the digital output in C#. Because the data must be send out at speeds above 1MHz I would like to use the onboard memory, and create pattern loops because there is a lot of the same data.In other languages it is possible to enable patterns by setting "Pattern Generation Loop Enable". However, I've been looking for such an attribute in C# and didn't find any.Is there a way to create pattern loops in the onboard memory with C#? What are the possibilities?Thank you and greetings,Patrick S.
RikP
2008-04-14 12:10:06 UTC
Permalink
Hi Patrick,
In the following Konwledge Base:
<a href="http://digital.ni.com/public.nsf/allkb/D41C98406383824286256FE8000F28FD?OpenDocument" target="_blank">http://digital.ni.com/public.nsf/allkb/D41C98406383824286256FE8000F28FD?OpenDocument</a>
is listed:
LabWindows/CVI and C
Use the following function call, setting the data parameter to 1 or 0 to enable/disable onboard looping (respectively):
int32 __CFUNC DAQmxSetDOUseOnlyOnBrdMem(TaskHandle taskHandle, const char channel[], bool32 data);
Did you already try this functioncall?
Regards,
RikP - National Instruments Applications Engineering
Martin EE
2008-07-23 01:10:06 UTC
Permalink
I'm attempting to use DAQmxSetDOUseOnlyOnBrdMem in my CVI application, but I get error -200462.&nbsp; I'm not sure how to implement it correctly.
Bas van Dijke
2008-07-25 10:40:06 UTC
Permalink
Hi Martin,
&nbsp;
I only tested this with a simulated device, but I think you need the following:
&nbsp;
&nbsp;&nbsp;DAQmxErrChk (DAQmxCreateTask("",&amp;taskHandle));&nbsp;&nbsp;DAQmxErrChk (DAQmxCreateDOChan(taskHandle,chan,"",DAQmx_Val_ChanForAllLines));&nbsp;&nbsp;DAQmxSetChanAttribute (taskHandle, "", DAQmx_DO_UseOnlyOnBrdMem, 1, 8);&nbsp;&nbsp;
&nbsp;&nbsp;/*********************************************/&nbsp;&nbsp;// DAQmx Start Code&nbsp;&nbsp;/*********************************************/&nbsp;&nbsp;DAQmxErrChk (DAQmxStartTask(taskHandle));
You have to set a Channel property. It is the most easy to use the function panel to set this property (and read the help). You can find this via:
NI-DAQmx Library &gt;&gt; Channel creation/configuration &gt;&gt; DAQmxSetChanAttribute. (see attached printscreen to find the right property).
&nbsp;
Regards,
Bas van DijkeAE, The Netherlands


property.jpg:
Loading Image...
Martin EE
2008-07-26 00:40:06 UTC
Permalink
A couple of questions arise: 1. Does DAQmxSetChanAttribute(Task, "", DAQmx_DO_UseOnlyOnBrdMem, 1, 8) replace DAQmxSetDOUseOnlyOnBrdMem(Task, "Dev1/port0", 1);or coexist?2. Where does DAQmxWriteDigitalU8(Task,Num);get implemented with respect to either of the above functions?3. Also, in DAQmxSetChanAttribute( ) function call, shall the last parameter be replaced by the same value provided to DAQmxWriteDigitalU8( ) function call?&nbsp; This would replace '8' with 'Num'.
Bas van Dijke
2008-07-28 11:40:13 UTC
Permalink
Hi Martin,
Sorry that it is maybe a&nbsp;little bit confusing. But both functions are possible. The first function (DAQmxSetDOUseOnlyOnBrdMem) changes the property, but doesn't have a function panel. The advantage is that you only need the Taskhandle, channelname and a bool value. If you use this, you need the following code:
-create Task&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -create DO channel-set properties (DAQmxSetDOUseOnlyOnBrdMem)-start Task-write data-stop Task
DAQmxCreateTask(??,&amp;taskHandle);DAQmxCreateDOChan(taskHandle,chan,??,DAQmx_Val_ChanForAllLines);DAQmxSetDOUseOnlyOnBrdMem(taskHandle, chan, data);DAQmxStartTask(taskHandle);DAQmxWriteDigitalLines(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL);DAQmxStopTask(taskHandle);DAQmxClearTask(taskHandle);
The second possibility (DAQmxSetChanAttribute) changes the same daqmx property, but you don't see this, because it is 'hidden' in a more common function call, with a function panel, what makes it maybe a little bit more easy. The disadvantage is that you need some more parameters. You get something link this:
-create Task&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -create DO channel-set properties (DAQmxSetChanAttribute)-start Task-write data-stop Task
DAQmxCreateTask(??,&amp;taskHandle);DAQmxCreateDOChan(taskHandle,chan,??,DAQmx_Val_ChanForAllLines);DAQmxSetChanAttribute (taskHandle, chan, DAQmx_DO_UseOnlyOnBrdMem, 1, 1);DAQmxStartTask(taskHandle);DAQmxWriteDigitalLines(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL);DAQmxStopTask(taskHandle);DAQmxClearTask(taskHandle);

Does this answer your questions?&nbsp;Regards,Bas&nbsp;
Martin EE
2008-07-28 15:40:10 UTC
Permalink
Bas, Thanks for sticking through with this one.If I attempt to write after starting a task, I again get a complaint that the buffer is empty.&nbsp; The difference in our code is that I write with a DAQmxWriteDigitalU8( ) rather than a DAQmxWriteDigitalLines( ) as you have listed in your sample code.&nbsp; This is similar to the case when I attempt to change the property before writing to the buffer, hence the reason I asked about the placement of the write function.&nbsp; I had placed the code like such:DAQmxCreateTask( )DAQmxCreateDOChan( )DAQmxCfgSampClkTiming( )DAQmxSetDOUseOnlyOnBrdMem( )DAQmxWriteDigitalU8( )DAQmxStartTask( )DAQmxWaitUntilTaskDone( )DAQmxStopTask( )DAQmxClearTask( )This results in error -200462.Thanks,Martin
Bas van Dijke
2008-07-29 09:10:10 UTC
Permalink
Hi Martin,
Could you please test the attached example?
Thanks,
Bas


DO.zip:
http://forums.ni.com/attachments/ni/70/9260/1/DO.zip

Loading...