Jump to content
  • 0

No constant type in Waveforms API


sand

Question

Hello!

I am programming an Analog Discovery 2 with the Waveforms API in Python 3, and I am wanting to use the "Patterns" generator to make DIO-0 go to state '1'. In the SDK I only see the following options (from the SDK reference manual):

• DwfDigitalOutTypePulse: Frequency = internal frequency/divider/(low + high counter).
• DwfDigitalOutTypeCustom: Sample rate = internal frequency / divider.
• DwfDigitalOutTypeRandom: Random update rate = internal frequency/divider/counter alternating between low and high values.
• DwfDigitalOutTypeROM: ROM logic, the DIO input value is used as address for output value
• DwfDigitalOutTypePlay: Supported with Digital Discovery.

 

But the Waveforms software allows the type "constant". Is there a way to make the pin a constant logical high while the program is running?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi @sand,

You'll be wanting FDwfDigitalIOOutputEnableSet and FDwfDigitalIOOutputSet which are defined in the Digital IO section (section 8) of the WaveForms SDK Reference Manual.

DigitalIO.py in the samples folder uses these two functions, enabling DIO 0 to 7 as outputs and then setting IO pins 2 and 5 as logic high.

Let me know if you have any questions (or if I misunderstood what you are wanting to do).

Thanks,
JColvin

Link to comment
Share on other sites

  • 0

Hi @sand

The easier is to use Digital/StaticIO functions.
For constant with DigitalOut use Counter 0|0 and specify (initial) value with CounterInit

dwf.FDwfDigitalOutEnableSet(hdwf, channel, 1)
# dwf.FDwfDigitalOutIdleSet(hdwf, channel, DwfDigitalOutIdleInit) # default value
dwf.FDwfDigitalOutCounterInitSet(hdwf, channel, 1, 0) # 1 = initialize with high when running
dwf.FDwfDigitalOutCounterSet(hdwf, channel, 0, 0) # low/high count zero, no toggle during run, constant

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...