Though you've got a good-enough solution now, I'd like to point you to another thread where I eventually posted an example. I've long wished for a buffered counter output mode that would allow us to define an exact # of precise but varying periods. I STILL think it's a glaring hole in the data acq driver and continue to wish and hope.
Anyway, a different method that may just a bit better than what you've got is to create a timed loop which uses the counter pulsetrain output as a timing source. My example at the end of the thread demonstrates only a ramp-up acceleration so some work would be needed to handle ramp-down or both or whatever else. Think of it as illustrating an approach, and maybe it'll give you a little boost.
HOWEVER, there's an even better method available for your M-series 6221 board provided you know the entire desired trajectory ahead of time. You can use the "correlated DIO" capability of your card to predefine a digital output buffer that represents the entire variable-rate pulse train trajectory, and then generate the pulses with 1 microsec precision. You'd need one of your counters to act as a 1 MHz sampling clock for the DO task.
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.