Jump to content

HasNoCreek

Members
  • Posts

    6
  • Joined

  • Last visited

HasNoCreek's Achievements

Newbie

Newbie (1/4)

1

Reputation

  1. Hey @attila thanks for the input. My application does require high precision and all my analog channels are already allocated to other features. So it looks like I will be utilizing the digital out functions. I am hoping to be able to use the pulse setting, but im struggling slightly with the fact that the wave automatically repeats. Since I only want a single high per pin and per trigger, is there a way to stop the digital signature from repeating within the run time? Like in the below screenshot, I would not like to have my DIO 0 repeat for the duration of the runtime, but that run time is required to send my entire DIO 1 signature. Ideally, DIO 0 would send a single high, and go back to idle until the next trigger. If the pulse type is not possible due to this, I may have to just configure the digital outputs as a custom, but I would love to not have to do that. Thanks!
  2. Hello all, I am using the .NET SDK to connected to an Analog Discovery 3. My goal is to configure 2 digital pins, say pin 0 and 1 for example, so that after a PC trigger: Pin 0 stays low for X milliseconds, then stays high for Y milliseconds, then waits for another PC trigger. Pin 1 stays low for Z milliseconds, then stays high for Q milliseconds, then waits for another PC trigger. I was hoping to use the digital out wait setting to pull this off, but it looks like I am only able to set a single wait time for all the digital out pins. I am considering using the custom send type, but am hoping there is a better option! Thanks for reading and for any help you can offer!
  3. Ahhh, I have found the culprit. My pins 0 and 1 are high, but I can only see that with the master enable on and the positive supply cranked up to 4V, which is happening behind the scenes in my application. Enabling that in waveform shows me correctly that those pins are high! Thanks for the help @attila!
  4. Hey there @attila, Appreciate the response. With the change you suggested, I am still receiving the [3,0,3,0....] repeating data after the trigger timeout. I also ran a test with the triggering removed entirely, and received the same result. Any idea what I am missing there? I have attached a simplified version of my test without triggering or data processing: Dwf.DigitalInReset(_deviceManager.GetDevice()!.Id.Value); var id = _deviceManager.GetDevice()!.Id; var hzSys = Dwf.DigitalInInternalClockInfo(id.Value); // sample rate to 1MHz var divider = (uint)(hzSys / 100e6); Dwf.DigitalInDividerSet(id.Value, divider); // 16bit WORD format Dwf.DigitalInSampleFormatSet(id.Value, 16); Dwf.DigitalInAcquisitionModeSet(id.Value, ACQMODE.Single); // get the maximum buffer size var cSamples = 1000; // default buffer size is set to maximum Dwf.DigitalInBufferSizeSet(id.Value, cSamples); // start Dwf.DigitalInConfigure(id.Value, false, true); int count = 0; while (count < 5) { STATE sts; do { sts = Dwf.DigitalInStatus(id.Value, true); } while (sts != STATE.Done); var rgwSamples = Dwf.DigitalInStatusData(id.Value, cSamples); count++; //Do something with data } Thanks man
  5. Hello all, I am attempting to read back the Digital IO pins on the AD3, for tracking the ticks of a rotary encoder, but even with no pins coming in high, im getting non 0 values for my pins(when reading from SDK only, Waveforms app does not show any pins high) I assume that I am doing something wrong on the read and have attached my test below. Dwf.DigitalInReset(_deviceManager.GetDevice()!.Id.Value); int leadingPinIndex = 0; int trailingPinIndex = 1; var id = _deviceManager.GetDevice()!.Id; var hzSys = Dwf.DigitalInInternalClockInfo(id.Value); // sample rate to 1MHz var divider = (uint)(hzSys / 1e6); Dwf.DigitalInDividerSet(id.Value, divider); // 16bit WORD format Dwf.DigitalInSampleFormatSet(id.Value, 16); Dwf.DigitalInAcquisitionModeSet(id.Value, ACQMODE.Single); // get the maximum buffer size var cSamples = Dwf.DigitalInBufferSizeInfo(id.Value); // default buffer size is set to maximum Dwf.DigitalInBufferSizeSet(id.Value, cSamples); // set trigger position to the middle Dwf.DigitalInTriggerPositionSet(id.Value, (uint)(cSamples / 2)); // trigger on any pin transition Dwf.DigitalInTriggerSourceSet(id.Value, DigitalTriggerSource.DetectorDigitalIn.MapToWaveFormsSdkType()); //_digitalInService.DigitalInTriggerAutoTimeoutSet(id, 10.0); //var triggerBits = SetBits(0, 1); uint triggerBits = 0xFFFF; Dwf.DigitalInTriggerSet(id.Value, triggerBits, triggerBits, triggerBits, triggerBits); Dwf.DigitalInTriggerAutoTimeoutSet(id.Value, 5); // start Dwf.DigitalInConfigure(id.Value, false, true); bool previousLeading = false; bool previousTrailing = false; int count = 0; while (count < 5) { STATE sts; do { sts = Dwf.DigitalInStatus(id.Value, false); } while (sts != STATE.Done); var rgwSamples = Dwf.DigitalInStatusData(id.Value, cSamples); for (int i = 0; i < rgwSamples.Length; i += 2) { // Ensure there's a pair of bytes to process if (i + 1 < rgwSamples.Length) { var byte1 = rgwSamples[i]; // Even byte - pins [0-7] var byte2 = rgwSamples[i + 1]; // Odd byte - pins [8-15] var byte1BoolArray = ByteToBoolArray(byte1); var byte2BoolArray = ByteToBoolArray(byte2); bool leadingPin = leadingPinIndex < 8 ? byte1BoolArray[leadingPinIndex] : byte2BoolArray[leadingPinIndex - 8]; bool trailingPin = trailingPinIndex < 8 ? byte1BoolArray[trailingPinIndex] : byte2BoolArray[trailingPinIndex - 8]; if (leadingPin != previousLeading || trailingPin != previousTrailing) { //This will yield return in actual application //yield return (leadingPin, trailingPin); previousLeading = leadingPin; previousTrailing = trailingPin; } } } count++; } If I provide a True to the DigitalInStatus call, rgwSamples is [3,0,3,0,3,0,3,....] If I provide a False to the DigitalInStatus call, rgwSamples is [80,1,145,144,229,1,0,0....] and then the series repeats. My expectation would be that if I have no high digital pins, my entire rgwSamples would be 0s. Since I have a 16 bit format and 16 pins, its my assumption that the even elements in rgwSamples would be for pins 0-7 and the odd elements would be for pins 1-15. Is that a misunderstanding? Thanks in advice for any advice/help!
  6. Hey @attila, I have seen you post around on here so often you must know the answer to this. Im doing something very similar to what you are doing in the script sent above, but in c#. I am looking to use PC triggering to handle all of our pulse sends into the Analog Discovery, but I am seeing some strange results with combining PC triggering with a trigger repeat, and a non-zero value for AnalogOutRepeatSet. If I set repeat to 0 for AnalogOutRepeatSet, my state after triggering always returns back to ARMED. If I set it to a 5 for example, the state will return to armed 5 times, before going back to DONE. What I am trying to achieve is to triggerpc once, and have my wave be sent 5 times(without having to call trigger each time), and then to be able to call triggerpc again and have another 5 waves sent. Any idea how I could achieve this? Thanks in advance!
×
×
  • Create New...