03-29-2006 11:48 AM
03-30-2006 04:03 PM
Hey Berto,
I made the changes that you have suggested. However, we can still only get one channel at a time.
Here are the canges that we made:
// Find out the current number of waveforms
handleErr(niScope_ActualNumWfms(vi, channelName, &numWaveform));
// Do not support multiple channels in this example
// To support multiple channels, the next two lines of code are commended out
//if (numWaveform > 1)
// handleErr (-1);
// Configure immediate triggering
handleErr(niScope_ConfigureTriggerImmediate (vi));
// Initiate the acquisition
handleErr(niScope_InitiateAcquisition(vi));
// Find out the current record length
handleErr(niScope_ActualRecordLength (vi, &actualRecordLength));
// Allocate space for the waveform and waveform info according to the record length and number of waveforms
if (wfmInfoPtr)
free (wfmInfoPtr);
wfmInfoPtr = malloc (sizeof (struct niScope_wfmInfo) * numWaveform);
if (waveformPtr)
free (waveformPtr);
waveformPtr = malloc (sizeof (ViReal64) * actualRecordLength * numWaveform);
And then, for the channel input, we used "0:1"
int option;
strcpy(channelName,"0:1");
*verticalRange = 10.0;
*minSampleRate = 2000000;
*minRecordLength = 1000;
However, it only get the data from channel 0.
I was looking into one of the help files in NI-Digitizer help. It's called "Fetching Multiple-Record Acquisitions". It has some code that was similar to the one you gave but it has some other codes. Here is that code:
// Set numWfms to 6, because the acquisition is for 2 channels times 3 records.
niScope_ActualNumWfms (vi, "0,1", &numWfms);
// Fetch the coerced record length
niScope_ActualRecordLength (vi, &actualRecordLength);
// Declare memory for the waveforms and waveform info structs
wfm = malloc (sizeof (ViReal64) * actualRecordLength * numWfms);
wfmInfo = malloc (sizeof (struct niScope_wfmInfo) * numWfms);
as you can see here, niScope_ActualNumWfms (vi, "0,1", &numWfms); but which is not in the code you suggested. do we need to add that somehow
Do we have to change the ViInt32 numRecords = 1; we changed that to a 2 but nothing happend.
what else can we do to make it work?
Thanks for the help, Berto. We really need it.
04-02-2006 10:37 PM
04-03-2006 10:06 AM
Hey Berto,
No success yet. I have made the changes, however, we can still only get one channel at a time.
Here is how the code look so far:
int option;
strcpy(channelName,"0,1");
*verticalRange = 10.0;
*minSampleRate = 20000000;
*minRecordLength = 1000;
// Find out the current number of waveforms
handleErr(niScope_ActualNumWfms(vi, channelName, &numWaveform));
// Do not support multiple channels in this example
// To support multiple channels, the next two lines of code are commended out
//if (numWaveform > 1)
// handleErr (-1);
// Configure immediate triggering
handleErr(niScope_ConfigureTriggerImmediate (vi));
// Initiate the acquisition
handleErr(niScope_InitiateAcquisition(vi));
// Find out the current record length
handleErr(niScope_ActualRecordLength (vi, &actualRecordLength));
// Allocate space for the waveform and waveform info according to the record length and number of waveforms
niScope_ActualNumWfms (vi, "0,1", &numWaveform);
niScope_ActualRecordLength (vi, &actualRecordLength);
if (wfmInfoPtr)
free (wfmInfoPtr);
wfmInfoPtr = malloc (sizeof (struct niScope_wfmInfo) * numWaveform);
if (waveformPtr)
free (waveformPtr);
waveformPtr = malloc (sizeof (ViReal64) * actualRecordLength * numWaveform);
What do you think the problem might be? We really appreciate your help.
Thanks
04-05-2006 03:48 PM
04-07-2006 12:58 AM
04-07-2006 04:39 PM