Discussion:
Continuous patern generation with PCI 6534 using CSharp
(too old to reply)
Vincentbl
2006-10-18 04:10:07 UTC
Permalink
Hello,
 
I am using a PCI 6534 board and I want to generate a continuous pattern from onboard memory. The software has to be written in CSharp.
 
I have found the following code example that is supposed to do this in C++ 6.0
 
DAQmxCreateTask("",&taskHandle)DAQmxCreateDOChan(taskHandle,"Dev1/port0","",DAQmx_Val_ChanForAllLines)DAQmxCfgSampClkTiming(taskHandle,"/Dev1/PFI0",1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000)DAQmxGetDOUseOnlyOnBrdMem(TaskHandle taskHandle, const char channel[], bool32 *data);DAQmxSetWriteRegenMode(TaskHandle taskHandle, DAQmx_Val_AllowRegen );DAQmxWriteDigitalU32(taskHandle,8,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL)DAQmxStartTask(taskHandle)//keep doing until stop or errorDAQmxStopTask(taskHandle);DAQmxClearTask(taskHandle);
 
But I have a hard time finding .Net equivalent functions. Attached is the CSharp code I have been able to come up with. I would appreciate if someone could review this code and point me in the right direction.
 
I have found very few .Net base source code for NI-DAQmx. If someone could point me to some example code that would greatly help.
 
Thanks,
 
 
Vincent
 
 
 
 
 


6534 Continuous Pattern Generation.cs.pdf:
http://forums.ni.com/attachments/ni/70/5635/1/6534 Continuous Pattern Generation.cs.pdf
Vincentbl
2006-10-18 21:40:10 UTC
Permalink
Jarrod
 
I did look at the example you mentioned. I was able to produce the code I attached in my previous posting based on that example. Unfortunately I haven't been able to find an example illustrating the transfer of data to on board memory to then generate a pattern based on the data in on board memory.
 
The code that I attached is my attempt to solve that problem but the DAQmx .Net documentation is very poor. It explain what a method or property is but in most cases there it does not expain how to use it.
 
Could you please look at the code I attached in my previous post and answer the following questions:
 
Do I need the following line MyTask.Stream.WriteRegenerationMode = WriteRegenerationMode.AllowRegeneration;

since I used SampleQuantityMode.ContinuousSamples in the ConfigureSampleClock call? If the call is not needed what is it used for?
 
It seems to me that the following properties MyTask.Stream.TotalSamplesGeneratedPerChannel, MyTask.Stream.Buffer.OutputOnBoardBufferSize must always have identical values and must be the same as the last parameter pasted to the ConfigureSampleClock call. If it is true then why are those two properties user settable? Is setting the second properties what determines that data written goes to on board memory and not the computer memory? And what happens if both OutputOnBoardBufferSize and OutputBufferSize are set?
 
For the method digitalMultiChannelWriter.WriteMultiSamplePort how does the second parameter needs to be layed out? If I want to use two 16 bit channels do I need to have a buffer composed of 16 bit with each consecutive values for each channels or do I need to enter 32 bit values which will be split between the two channels?
 
Any other advice would be appreciated.
 
Thanks,
 
Vincent

Loading...