From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

counter out ctr0 channel for stepper motor driver pulse status in mid of start task

hi , 

i am using ni card 6229 ctro and ctr1 channel to rotate stepper motor with driver syntron sh-30806 . i am using vi that generates number of pulses . triangular profile is given to stepper motor of which it starts from 0 to 50 degree to 0 to -50deg and again to 0. 

 165 pulses correspond to 1 degree. 50 degree means (50*165) pulses.

Q1: In this case is it possible to get me the status at every 10ms of corresponding pulses or degrees while the stepper is rotating. 

Q2: or may i stop motor at a specified pulse number say 1500 and again start from that point.

0 Kudos
Message 1 of 11
(2,729 Views)

Hi,

is it possible to drive a stepper motor using digital out signal as accurate as counter out (ctr_0) does .

0 Kudos
Message 2 of 11
(2,817 Views)

Perhaps.

Especially if you use the counter to trigger the digital changes, I would have thought.

Why?

Also, please give more information for a more informative reply...


GCentral
0 Kudos
Message 3 of 11
(2,702 Views)

actually when i use Counter out the pulses generated are accurate enough and their duty cycle comes out same .the issue with me is that i cannot get the present pulse number written to counter out port at mid of generation.

but for digital out is it possible to generate the pulses exactly and deterministic through while loop with ms delay vi (which is another non deterministic delay).

using 1 sample per iteration with ms delay does not give the same pulse time period uniformly. 

 

0 Kudos
Message 4 of 11
(2,682 Views)

If you want the current value of the Counter count, you might have better luck using this property node:

Example_VI.png

It can be found using a Channel property node, under Counter Output > General Properties > More > Count.


GCentral
Message 5 of 11
(2,676 Views)

@cbutcher wrote:

If you want the current value of the Counter count, you might have better luck using this property node:

Example_VI.png

It can be found using a Channel property node, under Counter Output > General Properties > More > Count.


CAUTION:  While this property *does* return the count value, the count value is NOT the # of pulses generated so far.  If you were to put this property node in a tight loop you'd see that the count value keeps counting down toward 0 then resetting to 1 or 2 different positive values.  That's some of the down & dirty of how pulse train generation happens.

 

The pulse parameters (freq/duty cycle, high/low time) will be translated into high & low ticks.  The counter will load up one of those values, count down to 0, toggle the output state when it reaches terminal count (0), load up the other value, count down to 0, toggle, etc.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 6 of 11
(2,630 Views)

The M-series 6229 is not a good choice for generating a stepper profile.  A newer X-series 63xx card would be a *very much* better choice.   Here are the top 3 reasons I can think of:

 

1. It can generate a buffered set of variable-freq pulses with sub-microsec hardware timing precision.

2. Finite pulse trains require only 1 counter, not 2.

3. 4 total counters are available instead of 2.  It'll be easy to *measure* the 1st counter's pulses with a 2nd counter.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 7 of 11
(2,632 Views)

but Sir,  CO.count is different for each run . it is not consistent 

0 Kudos
Message 8 of 11
(2,594 Views)

@DMic wrote:

but Sir,  CO.count is different for each run . it is not consistent 


I tried to briefly review this and a couple other of your related threads.

 

1. As I already mentioned above in msg #6, the property CO.count is not likely to be useful to you.  It does *NOT* indicate the # of step pulses that the CO task has generated.

 

2. If you mean to emphasize only that you need to *generate* a different # of pulses with each run, then the advice I gave in msg #7 still holds true.

 

3. As I reread your msg #1 in this thread, I noticed that you refer to a triangular profile while talking about *position*.   Typically, I think of motion profiles primarily as *velocity* profiles, so I kinda missed that the first time.   Since a triangular position profile corresponds to a piecewise-constant velocity profile, you stand some chance of making this work with your 6229.

    Mind you, the 6229 still isn't particularly well-suited to this task, but you at least stand a chance of getting there from here.

 

Does your stepper driver support a "step and direction" mode instead of the "CW pulse, CCW pulse" mode you've been trying to use?  Things get easier if it does.   If so, I'd generate the direction bit with a DO task, generate the finite pulse train with an AO task (by exporting the sample clock to a PFI pin), and use a CI task to count the pulses being generated.

   (Generating a finite pulse train directly with a counter would consume *both* counters on your M-series device, leaving none available for counting pulses.)

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 9 of 11
(2,572 Views)

unfortunately my stepper driver does not have DIR and Step pins. it has only CCW and CW pins

0 Kudos
Message 10 of 11
(2,557 Views)