Jump to content
  • 0

Analog discovery 2 analog out and pattern generator buffer size calculation


Thomas Lee

Question

Hi,

I am using the analog out and digital out functions with the following settings:

hzAcq=C_double(5e6)

freq=180

impulsetime=4

ringdowntime=2

Analog out:

          dwf.FDwfAnalogOutTriggerSourceSet(hdwf,c_int(0),c_int(12))

          dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_bool(True))
          dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine)
          dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double((freq/10.000)*hzAcq.value/500.000))
          dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(excitation)) 
          dwf.FDwfAnalogOutRunSet(hdwf,c_int(0), c_double((4/0.00002)/(hzAcq.value*10))) # run for 4 ms
      
          dwf.FDwfAnalogOutRepeatSet(hdwf, c_int(0), c_int(1)) 

Digital out pattern generator:

          dwf.FDwfDigitalOutDividerSet(hdwf, c_int(0), c_int(20))
          dwf.FDwfDigitalOutDividerSet(hdwf, c_int(1), c_int(20))
          dwf.FDwfDigitalOutDividerSet(hdwf, c_int(2), c_int(20))   
          dwf.FDwfDigitalOutDividerSet(hdwf, c_int(3), c_int(20)) 
       
          dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(0), c_uint(0), c_uint(1))
          dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(1), c_uint(1), c_uint(1))
          dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(2), c_uint(0), c_uint(1))
          dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(3), c_uint(1), c_uint(1))
 

          dwf.FDwfDigitalOutEnableSet(hdwf, c_int(0), c_int(1))
          dwf.FDwfDigitalOutCounterSet(hdwf, c_int(0), c_uint(int(ringdownTime*5000+650)), c_uint(int(impulseTime*5000+150))) 
          dwf.FDwfDigitalOutEnableSet(hdwf, c_int(1), c_int(1))
          dwf.FDwfDigitalOutCounterSet(hdwf, c_int(1), c_uint(int(impulseTime*5000+50)), c_uint(int(ringdownTime*5000+750))) 
          dwf.FDwfDigitalOutEnableSet(hdwf, c_int(2), c_int(1))
          dwf.FDwfDigitalOutCounterSet(hdwf, c_int(2), c_uint(int(impulseTime*5000+1050)), c_uint(int(ringdownTime*5000-250))) 
          dwf.FDwfDigitalOutEnableSet(hdwf, c_int(3), c_int(1))
          dwf.FDwfDigitalOutCounterSet(hdwf, c_int(3), c_uint(int(impulseTime*5000+100)), c_uint(int(ringdownTime*5000+700)))


 I used the default buffer size setting which is 4K for analog out and 1K for digital out. Since my analog out setting is 5 MHz sample frequency and run for 4 ms, the captured buffer size is 20 K which already exceeded the buffer size, however, the system seems still working in set time duration. For the digital out, I used 20 as divider and digitaloutcounterset to define the pattern, which would capture 30800 bits (impulseTime*5000+100+ringdownTime*5000+700) for one cycle, this seems also exceeded the 1K limit but still work. I am wondering is my calculation wrong or the setting I used does not require that much buffer size?

 

Best regards,

Thomas

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @Thomas Lee

The analog-out on AD1,2 always uses the entire buffer available in the configuration. The custom waveforms are stretched to this size but not the play (streaming) mode. To obtain arbitrary frequencies 'real number' sample step is used.
With newer devices AD3, ADP2000, 3000 the used buffer size can adjust.

For digital-out the buffer is only used for custom patters and pulse, counter... use 'timers' in the device. 

image.png

 

image.png

Link to comment
Share on other sites

  • 0

Thanks Attila! I understood that the modes I am using for analog out and digital out do not capture high buffer size. I am wondering how could I know how much buffer storage I used for analog out or digital out in my selected mode (sinewave mode for analog out and counter mode for digital out)? For example, would that be OK if I increase the analog out time from 4 ms to 12 ms? Would that be OK if I double the time periods for digital out counter set? 

Also I am wondering which command would you recommend using to set the total runtime for the digital out counter?

I also have a new purchased AD3, it is good to know AD3 has improved buffer size, I am wondering how could we adjust the buffer size for each section with commands?

Best regards,

Thomas

Link to comment
Share on other sites

  • 0

Hi @Thomas Lee

Analog-out sine for AD1,2 always uses the entire buffer, 4096 samples in default configuration. For AD3 and newer devices this is automatically adjusted based on specified frequency to obtain more precise Hz.
The run length does not affect the frequency. This determines for how long the signal will be generated.

Are you looking for FDwfDigitalOutRunSet ?

image.png

Link to comment
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
×
×
  • Create New...