Jump to content
  • 0

controlling digital pins on AD2 with waveforms script editor


niburris

Question

I am trying to generate a code that creates a digital pulse at some frequency using a digital pin on the AD2. currently i am trying to use the "Patterns.Channel.DIO#" with # being the digital pin i want assigned to my ad2. for some reason i cannot figure out how to control the pattern control window with Patterns. some help would be greatly appreciated.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Thank you for your response @attila

this is very helpful, i have two issues i cannot seem to figure out. first is by connecting a trigger to a clock signal running at 1hz. i want to turn on wavegen when i reach the falling edge of of the clock signal, but when i give the wavegen these parameters (trigger: patterns , falling edge) it stays in the armed position. 

my second issue is that once triggered, the sin wave needs to start with a specific phase for example 60*, but the sin wave amplitude needs to start at 0v. my idea is that once the wavegen window starts running it would just wait until the sin wave reaches 0v and then it will start producing the signal for it. that way the sin wave would have a phase of 60* relative to the clock signal. however i am not sure how to do this via code.  

thank you for your help.

 

 

Link to comment
Share on other sites

  • 0

Hi @niburris

The Pattern as trigger outputs high when running and low in other states. The trigger input condition is the signal edge, so rising triggers on start and falling at the end of Patterns run cycle. You have multiple alternate options:
- wire the DIO to a trigger IO and use this as source in Wavegen,
- or configure the Logic Analyzer to trigger on the DIO and use 'Logic Analyzer detector' as source in Wavegen,
- or if you only need one digital clock signal to generate realize this with constant 0/1 and wait/run,
- or generate clock signal the other Wavegen channel

image.png

image.png

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