I can't get the Python script DigitalIn_Record.py to work properly.
Environment that I've tried with:
Windows 7 & 10
Python3
SDK 3.9.1 and 3.10.2
Digital Discovery and Analog Discovery 1
Just running the script as is, it seems to be working, but the triggering point is not correct. (When running DD I added FDwfDigitalInInputOrderSet to set fDioFirst=True)
IMHO, this line seems not correct:
if cSamples == 0 and (sts == DwfStateConfig or sts == DwfStatePrefill or sts == DwfStateArmed) :
sts is declared as c_byte() and DwfState... as c_ubyte(), so they will never be equal. Adding .value will fix this:
if cSamples == 0 and (sts.value == DwfStateConfig.value or sts.value == DwfStatePrefill.value or sts.value == DwfStateArmed.value) :
Now the script will be hanging, as the unit remains in the prefill state.
Changing -1 to 0 in dwf.FDwfDigitalInTriggerPrefillSet(hdwf, c_int(-1)), makes the unit to leave the prefill state, but the record is not started at the assumed trigger point.
I'm not aware of the units internal design, but a level triggering can cause faulty triggering, so I changed to edge trigger, but it seems like I'm not able to have that work that way either.
Some good ideas what I'm doing wrong? I would like to start a record from my triggering point.
And what does prefill = -1 does? I can't find any info in the SDK manual.
Question
Peo
Hi!
I can't get the Python script DigitalIn_Record.py to work properly.
Environment that I've tried with:
Just running the script as is, it seems to be working, but the triggering point is not correct. (When running DD I added FDwfDigitalInInputOrderSet to set fDioFirst=True)
IMHO, this line seems not correct:
if cSamples == 0 and (sts == DwfStateConfig or sts == DwfStatePrefill or sts == DwfStateArmed) :
sts is declared as c_byte() and DwfState... as c_ubyte(), so they will never be equal. Adding .value will fix this:
if cSamples == 0 and (sts.value == DwfStateConfig.value or sts.value == DwfStatePrefill.value or sts.value == DwfStateArmed.value) :
Now the script will be hanging, as the unit remains in the prefill state.
Changing -1 to 0 in dwf.FDwfDigitalInTriggerPrefillSet(hdwf, c_int(-1)), makes the unit to leave the prefill state, but the record is not started at the assumed trigger point.
I'm not aware of the units internal design, but a level triggering can cause faulty triggering, so I changed to edge trigger, but it seems like I'm not able to have that work that way either.
Some good ideas what I'm doing wrong? I would like to start a record from my triggering point.
And what does prefill = -1 does? I can't find any info in the SDK manual.
/Peo
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.