03-10-2015 01:46 PM
I have an application to drive a stepper motor. We will be using TTL outputs to drive custom drivers for a 2-phase and a 3-phase setup.
Constraints:
Does anyone have insight on what hardware to use? Looks like I could get away with a 6320 card, using a two counters, one 10x the other to generate the AI and DO sample clocks. They could both be triggered by another digital line.
The question is, how to set up the DO. IS there a way to program the output to repeat a current buffer until that buffer is overwritten? That way I could program one entire 4-step pattern (this is the repeating pattern) and have it run. When it pauses, I could reverse the direction by detecting the current phase and then generating the reverse patterns starting at that phase. Can this be done?
To do this, I would need to know the count of the counter used for the sample clock; I suspect I would need to use another counter to get that info.
03-11-2015 08:14 AM
1. Yes, you can configure a DO task to repeat a buffer with a DAQmx Write property that sets Regeneration Mode to "Allow Regeneration".
2. Since reversing a stepper in motion can be a dubious proposition anyway, I'd try to design the app to reverse by stopping the DO task, writing a reverse phase pattern, then restarting the task. You may need to add additional delay time in there to allow for motion settling.
3. If you can do things this way, you won't need to feed the buffer on the fly, a very helpful simplification. BTW, I'd write more than a single cycle of the phase pattern to the board, probably more like a couple seconds worth.
4. I know one nice feature of the X-series boards (63xx family) is that only one counter is required to configure finite pulse generation rather than an adjacent pair as had been needed in prior MIO boards. Using a counter output as your DO clock allows you to control the # of steps to take.
5. Another nice feature of the X-series boards is buffered counter output. If you wanted to get fancier and define stepper velocity trajectories, you can program your counter to put out a hw-timed variable frequency.
6. Another way to get the 10:1 clock ratio between DO and AI would be to simply duplicate each digital state 10x and run the single shared clock at the AI rate. That's a way to make the DO phase changes happen at 1/10th the AI rate using a single clock.
7. Looks like a 6320 card would be sufficient if it meets your analog needs. I personally tend not to get the MIO boards that don't support AO simply because tomorrow's needs aren't always the same as today's.
-Kevin P