ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample Clock

I have a waveform stored in a byte of data. I would like to send this out the PCI-6071E. I have everything set up to send out the data. I am trying to do this in Microsoft Visual C# .NET. Below is the code we use in LabWindows that I am trying to implement in C#. I think the problem I have is in the timebase and interval. Below I also have the C# code I am using to implement this. Would you have any suggestions for converting it over.
Thanks


LabWindows
status = WFM_Load(gpib_device, 1, ao_channels, a_d_readings, a_d_readings_size, 1, 1);
status = WFM_Rate(100000, 0, &timebase, &interval); //
status = WFM_ClockRate(gpib_device, 1, 0, timebase, interval, 0); //
status = WFM_Group_Control(gpib_device, 1, 1);

C#
try
{
// create the task and channel
myTask = new Task("AOTask");
myTask.AOChannels.CreateVoltageChannel("Dev1/ao0","",-8.2,
8.2,AOVoltageUnits.Volts);

// verify the task before doing the waveform calculations
myTask.Control(TaskAction.Verify);

// configure the sample clock with the calculated rate
myTask.Timing.ConfigureSampleClock("",
100000,
SampleClockActiveEdge.Rising,
SampleQuantityMode.ContinuousSamples);

AnalogSingleChannelWriter writer = new AnalogSingleChannelWriter(myTask.Stream);

//write data to buffer
writer.WriteMultiSample(false,a_d_readings);

//Start writing out data
myTask.Start();
}
catch(DaqException err)
{
MessageBox.Show(err.Message);
myTask.Dispose();
}
0 Kudos
Message 1 of 4
(3,880 Views)
The problem I am having is in the rate at which each string of data is started. I would like to transmit it say 10 times per second.
0 Kudos
Message 2 of 4
(3,874 Views)
The best method I found was to use a timer and just run the routine once on every timer tick.
0 Kudos
Message 3 of 4
(3,869 Views)
Hello,

How is this code behaving? Is it outputting your waveform at the expected rate? You should just be able to set this up as a simple continuous analog generation. Please look at the .NET shipping example at: C:\Program Files\National Instruments\MeasurementStudioVS2003\DotNET\Examples\DAQmx\Analog Out\Generate Voltage\ContGenVoltageWfm_IntClk\Cs

This example performs a continuous analog generation using the internal clock.

Let me know if you have any further questions.

Sincerely,
Sean C.
0 Kudos
Message 4 of 4
(3,855 Views)