LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating 8KHz Square on NI 9401

Solved!
Go to solution
I am trying to generate a 8000 Hz Square Wave signal using a CDAQ chasis and the NI 9401. I plan to use this to control the speed of my stepper motor via a driver, however I am having some issues writing a VI to do this. I tried using a signal express VI to generate the signal and dynamically converted it into a boolean array, but this failed. Any ideas of how to do this?
0 Kudos
Message 1 of 17
(1,544 Views)

For steper motor you can refer this example.

https://decibel.ni.com/content/docs/DOC-35115

 

0 Kudos
Message 2 of 17
(1,500 Views)
Solution
Accepted by topic author AllanIL

Hello AllanIL,

 

one simple way is the Counter - Continuous Output.vi you can find this inside of the example finder, if the 9401 is based in a cDAQ it can used as a counter input. The frequency can be changed, if the vi will be modified so a new value will be written, inside of the while loop, to the card.

 

Hope it helps.

 

best regards
Alexander
0 Kudos
Message 3 of 17
(1,499 Views)

Duffy,
Thank you for your response and I have reviewed the VI you have suggested. I am only a beginner in LabVIEW programming could you explain to me exactly what the trigger is and how it would affect my program as well as the duty cycle? If I understand correctly the duty cycle should be default 0.5 i.e. 50% in my scenario? If I am also aiming for a 8 Khz signal wouldn't the 100 ms delay greatly affect my timing?

0 Kudos
Message 4 of 17
(1,483 Views)

Hello AllanIL,

 

the 100ms inside the while loop is the iteration time to check, if the DAQmx driver returns an error or not. The trigger can be used to start the PWM generation depending on an external signal. The PWM generation starts when the DAQmx start.vi is executed. The duty cycle in percent describes the division between high and low during a cycle, with 8 Khz high and low then are 62,5 µS long, if the duty cycle is set to 50%.

best regards
Alexander
0 Kudos
Message 5 of 17
(1,479 Views)

Is there a difference between what I wire for my counter input versus the output of this VI? I am using nearly all my channels on my NI 9401 to obtain encoder feedback, direction, 5V supply, and pulsing the driver. I have only one or two spare channels available.

0 Kudos
Message 6 of 17
(1,474 Views)

Hello AllanIL,

 

you can use the PFI line you want, the are individually configurable. All outputs are TTL compatible.

best regards
Alexander
Message 7 of 17
(1,467 Views)

Hello Duffy,

I have accepted your response as the solution, however I just ran into a major problem while running this VI. I am able to run my motor fine at 900 Hz, but the motor I try to run at anything above and especailly 8 KHz my motor doesn't move and all I all hear is a loud ramping sound. Do you know the cause of this issue potentially?

I am using a LIN Engineering R701 driver, which should be able to handle 200 KHz stepping. This is very odd to me as I have never seen this before and my current rating for this driver and motor should be well more than enough.

http://www.linengineering.com/products/drivers-controllers/r701-710/

0 Kudos
Message 8 of 17
(1,461 Views)

Hello AllanIL,

 

please verify the 5V signal, because the driver need a sink not a source modul.

best regards
Alexander
0 Kudos
Message 9 of 17
(1,454 Views)

I am running a SonceBoz 2A phase 1.8 degree motor using a LIN R701-710 driver (link is in previous post) using half stepping mode, which should work. The driver is set to run at its appropriate current rating and the duty cycle is far more than enough from the minimum of 100 ns for the NI 9401. The driver also can step at a maximum of 200 Khz

0 Kudos
Message 10 of 17
(1,447 Views)