07-16-2007 10:54 PM
07-17-2007 07:50 AM
07-24-2007 01:00 AM
07-27-2007 11:25 AM
Don't have LV handy to open the old code, but I did read through the thread you referenced. It sounds like the example configured 2 counters to create the variable-freq finite pulse train and configured a 3rd counter to count the # steps generated as verification. That 3rd counter would be a problem for you as there is no internal timing signal connection between your 2 USB devices. You would need to run a physical wire connection and change some of the config code to match. Alternately, you could just delete all the code associated with the 3rd counter for now because it isn't strictly necessary.
Further advice/questions: Are you planning on a pure sine wave of frequency such that you oscillate with both positive and negative velocity (example: varying from -1000 to +1000 Hz clockwise)? Or is there a nominal average frequency with a small sine wave superimposed (example: nominal of 1000 Hz clockwise, variation of +/- 50 Hz)?
I *think* you may be dealing with more of a continuous pulsetrain situation, which is actually much simpler. You would only need 1 counter/timer, though you would still perform the freq changes in a timed loop which uses the pulsetrain as its timing source. You'd just need to keep track of your total elapsed time so you could figure out the right sinusoidal freq value at the moment you're ready to update it.
Another subtlety to watch out for if you're oscillating about 0 velocity -- don't try to create a frequency that is lower than the rate at which you need to update. Also, with steppers you may have mechanical stability issues at low freqs like 10's to low 100's of Hz. These kinds of things may need to be managed as special cases which force you to deviate from a "pure" sine wave.
-Kevin P.