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: 

how to continuously generate a pulse train with variable frequency

Solved!
Go to solution

Dear all,

I am trying to use NI-USB 6259(BNC) to send Pulse signals to conduct position control of a servo motor with labview. The position control of servo motor follows these rules:

  1. The number of the pulse train determines how many degrees the motor rotate ;( e.g. the angular position of motor)
  2. The frequency of pulses determines how fast the motor rotate; (e.g. the speed of motor rotating)
  3. The digital determines the direction of rotation of motor (e.g. clockwise or counterclockwise)

 

My question comes when I need to continuously generate a finite plus train signal in a period of time. Below is a sample:

 

Time(s)

Number of pulses

Direction of rotation

(1 is clockwise, 0 is counterclockwise)

Frequency

0-1

923

1

923hz

1-2

3540

0

3540hz

2-3

1751

1

1751hz

3-4

2663

0

2663hz

4-5

353

0

353hz

5-6

1017

1

1017hz

6-7

3436

1

3436hz

7-8

302

0

302hz

8-9

1513

1

1513hz

9-10

570

1

570hz

Here is the explanation of this table, the motor keeps rotating in clockwise direction during 0~1s. When the time reaches 1s, the motor just complete the rotation of 923 pulse signals. And then the motor starts to rotate in counterclockwise direction during 1s~2s. When the time reaches 2s, the motor just complete the rotation of 3540 pulse signals. So we can see that the rotating speed of motor in 0~1s is different from the speed in 1s~2s. Namely, the frequency of pulse signal in 0~1s is different from the frequency in 1s~2s.

 

I have already use the counter output of DAQmx, it just can generate pulse signal with certain numbers and certain frequency in one time. The attachment is the vi which can generate a finite digital pulse train from a counter output channel and the frequency, duty cycle, Initial delay, and Idle state are all configurable.

 

How can I continuously generate  a series of pulse train with varying numbers and frequencies during a certain period of time.

 

Thank you very much for your help!

Download All
0 Kudos
Message 1 of 7
(6,923 Views)

Hi Raymondteng,

 

I believe this knowledge based article includes and example on exactly what you would like to achieve. Take a look at it to see if this works for you and try to adapt it to your application.

 

http://digital.ni.com/public.nsf/allkb/7B1B0427C39FE33086256CEE00752133

 

 

A. Acuna
Message 2 of 7
(6,855 Views)
Solution
Accepted by topic author Raymondteng

The "on the fly" frequency control requires software interaction and can't guarantee a specific number of pulses at each rate (which I'm assuming you want since it is a stepper motor).

 

If it were me I would do one of these instead:

 

1.  Use digital output for everything.  Clock out the digital output at some higher rate and build the waveform to give you the desired number of steps and direction.  This method would give less timing resolution than the others.

 

2.   Use a counter output task, 1 section at a time.  Reconfigure and restart the task for each section after adjusting the direction output.  This method would introduce a delay between each section.

 

3.  Purchase new hardware--X Series supports buffered counter outputs that can do what you are asking.

 

 

 

Best Regards,

John Passiak
Message 3 of 7
(6,840 Views)

Hi aacuna,

 

Thank you for your reply!

I already checked that  article.  The frequency in that Vi can change dynamically, but the method of adjusting the frequency is ‘manual’ .Below is the front panel of that Vi. When the Vi is running we can change the frequency by press the button.   

Time(s)

Frequency

0-1

923hz

1-2

3540hz

2-3

1751hz

3-4

2663hz

4-5

353hz

5-6

1017hz

6-7

3436hz

7-8

302hz

8-9

1513hz

9-10

570hz

 

Thank you!

0 Kudos
Message 4 of 7
(6,809 Views)

Hi aacuna,

 

Thank you for your reply!

I already checked that  article.  The frequency in that Vi can change dynamically, but the method of adjusting the frequency is ‘manual’ .Below is the front panel of that Vi. When the Vi is running we can change the frequency by press the button.   

Time(s)

Frequency

0-1

923hz

1-2

3540hz

2-3

1751hz

3-4

2663hz

4-5

353hz

5-6

1017hz

6-7

3436hz

7-8

302hz

8-9

1513hz

9-10

570hz

 

Thank you!

0 Kudos
Message 5 of 7
(6,809 Views)

Hi 

 

 

Thank you for your valuable suggestions!

I will try the digital output and counter output following your suggestion.

 

My friend has an NI cDAQ 9178 with NI 9401, NI9215 and NI 9263.  I found that the specification of cDAQ 9178 have below explanation:

buffer.jpg

 

Is that a usable equipment for my task?

 

Thank you!

0 Kudos
Message 6 of 7
(6,802 Views)

You *could* use analog output, but you can do the same thing with digital output (like I mentioned previously) and the digital output can be updated at a much higher rate.

 

 

Best Regards,

John Passiak
Message 7 of 7
(6,784 Views)