Jump to content

Gen 2 Pulses Continuously w/ one pulse having var duty Cycle


GammageATX

Recommended Posts

I am trying to generate two square waves continuously. This in itself has cause me problems. But I also need to vary the duty cycle of one of the pulses during run time, varying the frequency on the other would be nice but isn't necessary. One way I have found to do this causes a lot of software jitter in the signal. I have found two examples; one for each of the things I want to do and have tried to merge the logic. The result is included. This hasn't proved successful. Any help would be appreciated.

THanks

Using Labview 8.5

Link to comment

Do you need to poll the frequency and duty cycle changes so rapidly?

Try using an event structure in a loop.

If there is a value change event, write to the required property node.

See below:

post-2680-1238100485.jpg?width=400

post-2680-1238100495.jpg?width=400

post-2680-1238100503.jpg?width=400

There are additional Stop2 and Freq2 value change events that are dealt with similarly. The boolean Shift-reg stores whether either of the stop buttons has been depressed. If both have been pressed, then it exits.

N.

Link to comment

My experience is that you have to write both properties (Duty Cycle & Frequency) within the same property node, also you want to change only one. For reasons unknown to me, the duty cycle will not change, if you do not write frequency at the same time.

Jens

Link to comment

QUOTE (GammageATX @ Mar 29 2009, 02:44 PM)

Am I missing something?

Yes, quite a lot..! The stop case doesn't seem to actually stop the tasks, just the loop. The DutyCycle2 etc.. stuff doesn't seem to be going anywhere after the initial setup and run.

Why don't you just simplify and try with a single counter and then add the next one later.

Add changing freq+Duty cycle as another has posted.

Put the Stop button INSIDE the event structure and feed the result out to the loop stop icon.

Add a timeout event to stop the loop (instead of freezing it) in case there is a DAQ error.

Look at my screen shots posted earlier about how to stop the code gracefully.

N.

Link to comment

Ok, I see what your saying now. I've made changes and if you wouldn't mind looking at them again, it would help me out a lot. Thanks again.

QUOTE (Neville D @ Mar 30 2009, 12:51 PM)

Yes, quite a lot..! The stop case doesn't seem to actually stop the tasks, just the loop. The DutyCycle2 etc.. stuff doesn't seem to be going anywhere after the initial setup and run.

Why don't you just simplify and try with a single counter and then add the next one later.

Add changing freq+Duty cycle as another has posted.

Put the Stop button INSIDE the event structure and feed the result out to the loop stop icon.

Add a timeout event to stop the loop (instead of freezing it) in case there is a DAQ error.

Look at my screen shots posted earlier about how to stop the code gracefully.

N.

Link to comment

I would include the following changes.

1. As already said, update Frequency AND duty cycle at the same time. From my experience, it won't work, if you only write one property...

2. I'd stop both tasks in Stop-Case.

3. I included a case-structure which tests if you can already write a new dutycycle value. You can only set a new parameter if at least one cycle with the previous values has been generated.

Download File:post-8741-1238518481.vi

Perhaps still not perfect, but it should work.

Jens

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.