I am trying to use the digital discovery board to read a series of raw 32 bits coming through pins 0 to 31. There are many examples I looked at, but all of them uses 16 bit int for the sample. I need to read them as samples, each 32 bits. I tried using the waveforms and it worked nicely. It even gave me the option to read them as unsigned numbers in decimal format which is what I need.
any help is greatly appreciated,
Here is a segment of my code:
FDwfDigitalInInternalClockInfo(hdwf, &hzSys);
FDwfDigitalInDividerSet(hdwf, hzSys/2e5); // sampling at 200KHz
FDwfDigitalInSampleFormatSet(hdwf, 32); // so the size of the sample is 32 bits
FDwfDigitalInBufferSizeInfo(hdwf, &cSamples);
// default buffer size is set to maximum
rgwSamples = new unsigned int[cSamples]; // here is the problem, the type is 16 bits, so I am reading 16 bit signed (although declared unsigned)
// set trigger position to the middle
FDwfDigitalInTriggerPositionSet(hdwf, cSamples/2); // not sure about this, it was in one of the examples
FDwfDigitalInStatusData(hdwf, rgwSamples, cSamples*sizeof(unsigned int)); // again the size of the sample here is 16 but this is the only thing the worked
Question
ssm
Hello everyone,
I am trying to use the digital discovery board to read a series of raw 32 bits coming through pins 0 to 31. There are many examples I looked at, but all of them uses 16 bit int for the sample. I need to read them as samples, each 32 bits. I tried using the waveforms and it worked nicely. It even gave me the option to read them as unsigned numbers in decimal format which is what I need.
any help is greatly appreciated,
Here is a segment of my code:
FDwfDigitalInInternalClockInfo(hdwf, &hzSys);
FDwfDigitalInDividerSet(hdwf, hzSys/2e5); // sampling at 200KHz
FDwfDigitalInSampleFormatSet(hdwf, 32); // so the size of the sample is 32 bits
FDwfDigitalInBufferSizeInfo(hdwf, &cSamples);
// default buffer size is set to maximum
rgwSamples = new unsigned int[cSamples]; // here is the problem, the type is 16 bits, so I am reading 16 bit signed (although declared unsigned)
// set trigger position to the middle
FDwfDigitalInTriggerPositionSet(hdwf, cSamples/2); // not sure about this, it was in one of the examples
// trigger on any pin transition
FDwfDigitalInTriggerSourceSet(hdwf, trigsrcDetectorDigitalIn);
FDwfDigitalInTriggerAutoTimeoutSet(hdwf, 10.0);
//FDwfDigitalInTriggerSet(hdwf, 0,0,0xFFFFFFFF,0xFFFFFFFF); // I tried this, it did not work
FDwfDigitalInConfigure(hdwf, true, false);
// begin acquisition
FDwfDigitalInConfigure(hdwf, false, true); // start
do{
if(!FDwfDigitalInStatus(hdwf, true, &sts)) return 0;
}while(sts != stsDone);
// get the samples
FDwfDigitalInStatusData(hdwf, rgwSamples, cSamples*sizeof(unsigned int)); // again the size of the sample here is 16 but this is the only thing the worked
thank you
Sam
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now