First, before I write my questions, I would like to provide some information:
- Used device: Analog Discovery 2 (revision 3)
- Programming language is C++
- IDE: Visual Studio Community 2013, version 12
- Operating System: Windows 10
I am trying to control the device with the SDK but I got issues with the Digital-In-Instrument. I attached a .cpp file with my code. My aim is to configure digital pin 0 to take 1000 samples as soon as a rising edge on the same pin occurs. To generate a rising edge on this pin, I connect digital pin 0 and digital pin 1 and configure pin 1 to pulse on enabling.
I checked if the pulse on pin 0 really occurs: This works fine.
Furthermore, I try to read out the logged samples after the triggering and print them on the console.
Now the description of my problems:
- With the following code I expect the digitalIn Instrument to be armed just one time (setting of acqmodeSingle in row 27). But the print on row 76 prints "DwfStateArmed". I expect it to stay on "DwfStateDone". Do I missunderstand something here?
- I totally don't understand the format of the data that I get with
FDwfDigitalInStatusData(...)
In the digilent examples I saw it like this:
FDwfDigitalInStatusData(deviceId,Pointer to array with size of "nrOfSamples", nrOfSamples*sizeof(unsignedshort))
Why is there a multiplication with the size of an unsigned short?
- Could you please explain me, in which format the logged values are stored in the data-array? Is it a bitfield with the value of each pin or something different?
Thank you very much in advance for the given answers. If somethings not clear, don't hesitate to ask.
Question
aaronBe
Hello Digilent world
First, before I write my questions, I would like to provide some information:
- Used device: Analog Discovery 2 (revision 3)
- Programming language is C++
- IDE: Visual Studio Community 2013, version 12
- Operating System: Windows 10
I am trying to control the device with the SDK but I got issues with the Digital-In-Instrument. I attached a .cpp file with my code. My aim is to configure digital pin 0 to take 1000 samples as soon as a rising edge on the same pin occurs. To generate a rising edge on this pin, I connect digital pin 0 and digital pin 1 and configure pin 1 to pulse on enabling.
I checked if the pulse on pin 0 really occurs: This works fine.
Furthermore, I try to read out the logged samples after the triggering and print them on the console.
Now the description of my problems:
- With the following code I expect the digitalIn Instrument to be armed just one time (setting of acqmodeSingle in row 27). But the print on row 76 prints "DwfStateArmed". I expect it to stay on "DwfStateDone". Do I missunderstand something here?
- I totally don't understand the format of the data that I get with
In the digilent examples I saw it like this:
Why is there a multiplication with the size of an unsigned short?
- Could you please explain me, in which format the logged values are stored in the data-array? Is it a bitfield with the value of each pin or something different?
Thank you very much in advance for the given answers. If somethings not clear, don't hesitate to ask.
Kind regards
Aaron
example.cpp
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.