Rohit_Verma
-
Posts
5 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Posts posted by Rohit_Verma
-
-
Hi @attila,
Thanks so much for your valuable input, i am able to detect the Negative pulse now.
However, just for one case i need some more input please?
=> I want to generate a pulse on 1 DIO pin and my code is such that, it's response i can check from another pin.
Been using below logic:
def GeneratingSignal():
#For GPIO1, generating 1ms pulse
dwf.FDwfDigitalOutRunSet(hdwf, c_double(1)) # 1ms run
dwf.FDwfDigitalOutRepeatSet(hdwf, c_int(1)) # once
dwf.FDwfDigitalOutIdleSet(hdwf, c_int(0), c_int(0)) # 1=DwfDigitalOutIdleLow, low when not running
dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(0), c_int(1), c_int(0)) # initialize high on start
dwf.FDwfDigitalOutCounterSet(hdwf, c_int(0), c_int(1), c_int(1)) # low/high count zero, no toggle during run
dwf.FDwfDigitalOutEnableSet(hdwf, c_int(0), c_int(1))
print("Generating 1s pulse")
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
#time.sleep(1)
dwf.FDwfDigitalOutReset(hdwf)But i need to validate no. of pulses, lets say 5 pulses of 1ms, to validate the scenario.
However i am getting some random values if i call this func, GenerateSignal(), is it because of some latency,?
How can i rectify this ??
-
50 minutes ago, attila said:
Hi @Rohit_Verma
1. The following lines are to wait for the capture to finish.
while True:
dwf.FDwfDigitalInStatus(hdwf, c_int(1), byref(sts))
if sts.value == DwfStateDone : # 2
break2. If you want to trigger on DIO-7 negative pulse length use:
dwf.FDwfDigitalInTriggerResetSet(hdwf, c_int(0), c_int(0), c_int(0), c_int(1<<7)) # low, high, rise, fall
dwf.FDwfDigitalInTriggerSet(hdwf, c_int(1<<7), c_int(0), c_int(0), c_int(0)) # low, high, rise, fall
dwf.FDwfDigitalInTriggerLengthSet(hdwf, c_double(5e-4), c_double(7e-4), c_int(0)) # 500-700us
dwf.FDwfDigitalInTriggerCountSet(hdwf, c_int(1), c_int(0))3. If you want to precisely count the pulse rate use the record to collect a fixed number of samples and count the pulses in you script.
You could use the sync capture mode and rely on the available samples, see DigitalIn_Sync.py and the following post. This will be software controlled start/stop so it will have a uncertainty of milliseconds.Thanks @attila ,
I have copied the aboveset of commands and below is the output:
---------------
DWF Version: b'3.17.1'
Opening first device
DigitanIn base freq: 100.0MHz
Waiting for acquisition...
Status: 5
Status: 5
Status: 5
Status: 5
Status: 5
Status: 3
Status: 3
Status: 3
Status: 3
Status: 2
done---------------
=> Now my concern is the value that is being returned in status variable.
==> Because i need to validate this for different time intervals, that is:
1st case: Negative pulse at every 1 sec
2nd Case: Negative Pulse at every 100msec.
3rd Case: Negative Pulse at every 5 sec.
Likewise, i need to store 6-7 cases, and need to validate the same in file only.
I am attaching the full DigitalIn_PulseTrigger.py file here.
Please let me know what should be the best way to validate the same (Without using the software).
Thanks again,
Rohit
-
2 minutes ago, attila said:
Hi @Rohit_Verma
You could perform recording either on analog or digital-in and count the edges/pulses in software.
Hi @attila,
Thanks for quick response,
Actually i need the count in the file itself, need for some automation project work..
Checking with DigitalIn_PulseTrigger.py as of now, but not sure about the value "2" below:
print("Status:", str(sts.value))
if sts.value == 2 : # done <------------ What does this 2 signify, what else can we write here???What does this signify ?
=> Also, please confirm if my understanding about these functions is right :
dwf.FDwfDigitalInTriggerResetSet(hdwf, c_int(0), c_int(0), c_int(0), c_int(1<<7)) <---- Reset at Falling edge on pin DIO7
dwf.FDwfDigitalInTriggerSet(hdwf, c_int(1<<7), c_int(0), c_int(0), c_int(0)) <------- generate trigger at low state of Pin DIO7(in my case it around 600 us) attach snippet of negative pulse.=> what value should be placed here to count number of negative pulse for some interval ??
Thanks,
-
I need to capture a pulse (High to low), which stays for appx 600us, then goes back high.
I need to capture for a given interval of time, the no. of pulses triggered.
time interval maybe : 1ms, 1 s, 5s etc.
Been using the DigitalIn_PulseTrigger.py & DigitalIn_trigger.py, but couldn't understand if it is behaving as expected:
--------------
while True:
dwf.FDwfDigitalInStatus(hdwf, c_int(1), byref(sts))
print("Status:", str(sts.value))
if sts.value == 2 : # done
break------------
Not sure about the value to be compared here, as for 1 sec or for 5 sec, i am seeing the break in appx same time here.
=> Also tried with AnalogIn_sample.py but i think it is not able to detect the drop in voltage for such short duration.
Any help will be appreciated.
Thanks,
Rohit
Need to generate continous pulse from one pin and pulse acquisition operation from the same file.
in Test and Measurement
Posted · Edited by Rohit_Verma
Hello,
I am using below code to generate a Negative pulse at regular interval on DIO 0 pin of AD2
---------------------------------------------------------
print("Generating 1s pulse")
while True:
dwf.FDwfDigitalOutEnableSet(hdwf, c_int(0), c_int(1))
dwf.FDwfDigitalOutRunSet(hdwf, c_double(0.05)) # 50ms run
dwf.FDwfDigitalOutRepeatSet(hdwf, c_int(1)) # once
dwf.FDwfDigitalOutIdleSet(hdwf, c_int(0), c_int(1)) # 1=DwfDigitalOutIdleLow, low when not running
dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(0), c_int(1), c_int(0)) # initialize high on start
dwf.FDwfDigitalOutCounterSet(hdwf, c_int(0), c_int(0), c_int(0)) # low/high count zero, no toggle during run
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
time.sleep(0.1)
dwf.FDwfDigitalOutReset(hdwf)
time.sleep(5)
dwf.FDwfDigitalOutReset(hdwf)
dwf.FDwfDeviceCloseAll()
--------------------------------------------------------
And after this code segment I have another "pulse acquisition" code from Different pins of Digilent.
==> But, Since i ran code above continously in while loop(we need to generate the pulse continously), the acquisition code is not getting executed.
Need some idea here, if we can ran the pulse generation with some other way or configure digilent.
Any help is appreciated. @attila
#############
Tried Below code to configure digilent for pulse generation but No Luck so far:
------------
# continue running after device close
dwf.FDwfParamSet(c_int(4), c_int(0)) # DwfParamOnClose 0 = run, 1 = stop, 2 = shutdown
print("Opening first device")
hdwf = c_int()
dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf))
# the device will be configured only when calling FDwf###Configure
dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0))
# digital output
dwf.FDwfDigitalOutTriggerSourceSet(hdwf, c_int(3)) # trigsrcDetectorDigitalIn
dwf.FDwfDigitalOutRepeatSet(hdwf, c_int(0)) # infinite repeat
dwf.FDwfDigitalOutRepeatTriggerSet(hdwf, c_int(1)) # wait for trigger in each cycle
dwf.FDwfDigitalOutRunSet(hdwf, c_double(1)) # 1ms run
# DIO 1 pulse
dwf.FDwfDigitalOutEnableSet(hdwf, c_int(1), c_int(1))
dwf.FDwfDigitalOutIdleSet(hdwf, c_int(1), c_int(1)) # 1=DwfDigitalOutIdleLow, low when not running
dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(1), c_int(1), c_int(0)) # initialize with high when running
dwf.FDwfDigitalOutCounterSet(hdwf, c_int(1), c_int(0), c_int(0)) # low/high count zero, no toggle during run
# configure and start
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
------------
Thanks,
Rohit