04-22-2007 10:57 AM
Hello,
I am using PCI 6723 for generation of Analog Outputs using VB.NET 2003. I am not able to generate multiple analog outputs simultaneously. I tried to modify code as provided in example (..\NI-DAQ\Examples\DotNET1.1\Analog Out\Generate Voltage, ContGenVoltageWfm_IntClk). I changed the AnalogSingleChannelWriter to AnalogMultiChannelWriter and instead of one dimensional array I supply two dimensional array. I got the output but the channel aO and a1 doesnot show up at same time (time difference, not simultaneously). Is this a right way of generating output?
I am also looking for example code that is compatible with VB.NET 2003 regarding multiple analog outputs.
Any programming manual regarding VB.NET (command and their operations) would be helpful.
With regards,
04-23-2007
07:05 PM
- last edited on
07-16-2024
12:54 PM
by
Content Cleaner
Hello Bryan,
I made the following changes to the ContGenVoltageWfm_IntClk example and I was able to successfully update multiple channels:
' Write the data to the buffer
Dim d(1, 5) As Double
d(0, 0) = 1
d(0, 1) = 1
d(0, 2) = 1
d(0, 3) = 1
d(0, 4) = 1
d(0, 5) = 1
Dim writer As New AnalogMultiChannelWriter(myTask.Stream)
writer.WriteMultiSample(False, d)
When I change the "Physical Channels" to "Dev1/ao0:1" I am able to output a constant 1V on my ao0 and a constant 0V on my ao1. However, I am a little confused by your comments about the behavior of your channels. What do you mean when you say: "I got the output but the channel aO and a1 doesnot show up at same time (time difference, not simultaneously)."? Are you saying that your channels do not update with the values of your array? Are you sure that you have indexed your array correctly to update as you expect?
Finally, in regards to your questions about examples that are compatible with VB .NET 2003, the NI-DAQmx 8.5 driver Readme says the following:
"The .NET example paths for Windows XP and Windows 2000 are x:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET1.1 and x:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0."
04-25-2007 06:15 PM
Hello Matt,
Thank you for your response.
I am not able to generate analog outputs signals simultaneously for different channels with different data.
If, array(0,i) = 100 random numbers
array (1,I )= 100 random numbers
array(2,i)= 100 random numbers
Dim writer As New AnalogMultiChannelWriter(myTask.Stream)
writer.WriteMultiSample(False, array)
It will output 100 random numbers for all 3 channels; but I am not able to update oputput with different data. Do we need to repeat same process ( from the beginning )each time to update output ?
What do you mean when you say: "I got the output but the channel aO and a1 doesnot show up at same time (time difference, not simultaneously)."?
Well, when I created 2 channels, the output point of first channel doesnot appear at same time with second channel. for example,
array (0, 1)=-2
array(1,1) =2
then, isnt it the channel 0 output (-2) and channel1 (2) output should apper at the same time?
With regards,
Bryan
04-26-2007 11:19 AM
04-26-2007 06:29 PM
Hello Matt,
Thanks for your valuable response.
One last question, instead of contineous samples I want to have fintie samples.
I changed my configureSampleClock as shown below.
myTask.Timing.ConfigureSampleClock("", 5000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, 5000)
I want to clear all the previous samples (clear buffer) while writing new samples onto it simeltaneously. I tried different ways but
getting same error code: -200288 ( Property : NationalInstruements.DAQmx.Daqstream.WriteRelativeTo Corresponding Value: NationalInstruemnts.DaQmx.WriteRelativeTo.CurrentWritePosition .
Property :NI.DAQmx.DAQsteam.writeOffset Corresponding value.
How can we point the write position (buffer location)? Any Vb.Net 2003 example will be too helpful.
About delay, it was my mistake, sorry for that.
With regards,
Bryan
04-26-2007
11:06 PM
- last edited on
07-16-2024
12:55 PM
by
Content Cleaner
Hello Bryan,
There is a document here which discusses a common reason for the error you described. I believe the problem is that you are not stopping the task (as stated in the document). If you want to perform multiple finite generations you will need to stop the task and restart it for every generation. Finite generation outputs the number of samples you have specified and no more; if you wan to output more samples you will need to increase the number of finite samples or create a new task.
However, I'm not sure that you actually need to perform a finite generation. You should be able to perform a continuous generation and specify a new array any time you want to change the waveform (as described in my previous post). I suggest that you look at continuous generation based on your statement that:
@bryan81 wrote:
...
I want to clear all the previous samples (clear buffer) while writing new samples onto it simeltaneously.
...
To clarify, the buffer is circular, so data is automatically "cleared" when it is written out. As you write new data into the buffer, it fills and then rolls over back to the start when it reaches the end. The driver keeps track of where the data is being written in the buffer and what data has been generated, so that you never have to manually clear the buffer. So long as you are not attempting to write data to the buffer faster than your device can generate the waveform, you should not have any problems. I hope this is clear, but let me know if you have any additional questions.