• 0
laurent

Reset once and multiple 32768 patterns

Question

Hi,

I am writing a python script to output patterns on my digital discovery.

I need to have a reset at 0 during 100ns on DIO24=channel 0, then 20000pattern that are repeated. But I do not want to repeat the reset. I have tried many commands of the SDK ref manual, including

 Reset = 0

dwf.FDwfDigitalOutRepeatTriggerSet(hdwf,  c_int(Resetn), c_int(1)) # repeat = false

But, no way the reset is always repeated. How to proceed ?

BRgds,

Laurent

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Hi @laurent

Such pulses can be generated specifying count zero and count-init nonzero.

See the example script: DigitalOut_ResetPattern.py

# DIO-0 or DIO-24 on Digital Discovery
# generate 100ns high pulse after start/init then remain low, since low count is nonzero and high is zero
dwf.FDwfDigitalOutEnableSet(hdwf, c_int(0), c_int(1))
dwf.FDwfDigitalOutIdleSet(hdwf, c_int(0), DwfDigitalOutIdleLow) # DwfDigitalOutIdleLow = 1
dwf.FDwfDigitalOutDividerSet(hdwf, c_int(0), c_int(int(hzSys.value*100e-9))) # 100ns (10MHz) prescaler
dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(0), c_int(1), c_int(1)) # start high for 1 count
dwf.FDwfDigitalOutCounterSet(hdwf, c_int(0), c_int(1), c_int(0)) # low = 1 and high = 0

image.thumb.png.20ebde08d3caa6834cfeda848b9ac28a.png

image.thumb.png.041ed21358086c468c99e105fb58984b.png

 

image.png.c4a7f847e241e33795133ad2fbb88cd2.png

 

Share this post


Link to post
Share on other sites
  • 0

Hi @laurent

With another device.

Only one application can connect to a device at a time, but the DIO signals are bidirectional.
You can generate on some output and capture at the same time the inputs and outputs as well.

Share this post


Link to post
Share on other sites
  • 0

How to set the channel to trigger on ?

dwf.FDwfDigitalInTriggerSourceSet(hdwf, c_ubyte(3)) # trigsrcDetectorDigitalIn
dwf.FDwfDigitalInTriggerSet(hdwf, c_int(0), c_int(0), c_int(0x0003), c_int(0x0003))

What c_ubyte(3) refer to ? It seems to be kink to channel 0, how to chenge it if I want to trigger on channel 1 ou 2 ?

Laurent

Share this post


Link to post
Share on other sites
  • 0

Hi @laurent

The trigger and the received data samples are bit field sets, each value or sample representing a channel:
fs/sample = [bit-0/channel-0] [bit-1/channel-1]...

dwf.FDwfDigitalInTriggerSet(hdwf, c_int(0), c_int(0), c_int(0x0003), c_int(0x0003))
This will trigger on rinsing or falling edge of channel-0 or 1:
0x0003 = (1<<1) | (1<<0) 

In case you use the DIOs first on the Digital Discovery FDwfDigitalInInputOrderSet(hdwf, 1) it will trigger on DIO-24 or 25 otherwise on DIN-0 or 1.

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

Hi,

I still use the loop between the output and inputs as shown on the pictures above to check my patterns written in Python.
I need to send one burst of signals with a depth of 32101. But, I don't know what to write in the 2 registers dwf.FDwfDigitalOutRunSet() and dwf.FDwfDigitalOutRepeatSet(hdwf, c_int(1)) ?
Whatever I set in these commands, the pattern is repeated. I guess it is due to the fact I read them back, but is there a way to check that are not repeated ?
Here are the plotted result and the python script I use - the configuration is above in the photo.

BRgds,
Laurent

 

hv_prog.jpg

OTP_digital_HV1.py

Edited by laurent

Share this post


Link to post
Share on other sites
  • 0

Hi @laurent

You should apply the run/repeat settings before starting the output, just like the other options.
The run time should be expressed in seconds.
 

Share this post


Link to post
Share on other sites
  • 0

Hi Attila,

I spend a week to try to generate the following signals, but I still cannot rise the signals at different times. I tried with 2 methods : pulses and arbitrary pattern, but none of them gave me successful result. I know that the timing are not good, because I was trying to get the right pattern at first. I don't know how to a rising edge at a different time for my 2 signals. I already spend several days on it using the waveforms_sdk_rm.pdf

BRgds,

Laurent

 

 

Pattern_HV.png

OTP_digital_HV2.py OTP_digital_HV1.py

Share this post


Link to post
Share on other sites
  • 0

Hi @laurent

The default idle output (when not running) is initial value. Your HV patterns starts with 1.
Use this to have idle output 0:
dwf.FDwfDigitalOutIdleSet(hdwf, c_int(HV), c_int(1)) # DwfDigitalOutIdleLow

In order to generate the above signal you should have more 1s in your Prog pattern.

In order to have sample rate at 1MHz use:
dwf.FDwfDigitalOutDividerSet(hdwf, c_int(HV), c_int(100)) # set sample rate
dwf.FDwfDigitalOutDividerSet(hdwf, c_int(Prog), c_int(100)) # set sample rate

HV [1, 1, ... 32032‬ zeros]
Prog [18x 0s, 32000x 1s, 16x 0s]

The run length should be:
dwf.FDwfDigitalOutRunSet(hdwf, c_double(6*32034e-6)) 
or:
dwf.FDwfDigitalOutRunSet(hdwf, c_double(32034e-6)) 
dwf.FDwfDigitalOutRepeatSet(hdwf, c_int(6))

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now