LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RC Servo Motion Control/KollMorgen AKD Modbus Control

Solved!
Go to solution

I'm in the process of learning LabView on a project to control a RC Servo.  I have implemented a pulse train generator VI with a USB 6210 and can control the servo position using a knob control.  I want to be able to program the motion of the servo to follow a sine, square, and triangle wave.  I've tried to use the function generator VI to generate the signal but am unable to get the servo to move.  Can anyone give me some guidance on how to generate the desired waveform and use it to continuously vary the duty cycle of the pulse train?  I thought it would be simply to replace the knob control with the driving function?

 

My ultimate goal is to use the same concept to drive a KollMorgen AKD drive using Modbus to perform a similar function.

0 Kudos
Message 1 of 6
(2,905 Views)

Would you be able to post your code?  By any chance did you implement the following example from our site?

 

Data Acquisition Motor Control System

Regards,
Isaac S.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(2,863 Views)

My implementation uses basic LabView functions, no add-on modules.  I've included the code.  The original implementation used the included control and does work.  I was attempting to then replace the control with the generated sine wave.

0 Kudos
Message 3 of 6
(2,846 Views)
Solution
Accepted by LarryLarder

The express VI you use to simulate the sine signal is only running once thus only outputting 1 data point.  In order to run continuously you need to place it inside a loop.  Also I don't see a point in using a local variable for your PWM knob control.  You should wire it directly to the 'Not Equal?' vi inside the loop.  If you are trying to replace the know control with the sine generator then you need to put the sined generator inside the loop and wire that directly to where you have the PWM local variable connected.

Regards,
Isaac S.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(2,837 Views)

Thanks so much for the help.  I was able to correct my mistake and now have my first functioning vi.  I have found this to be a great demonstration exercise.  I would appreciate any feedback on how to improve the function or the style.

0 Kudos
Message 5 of 6
(2,791 Views)

The function generator frequency is dependent on the "Wait Until Next ms Multiple". You are creating 1000 samples at 1000kS/s with the "sampling info" input. Then "Convert from Dynamic Data" is taking only the last of those 1000 values. The function generator still works, in a way, because "phase" is in an uninitilaized shift register. The only reason I mention it is because the Frequency doesn't look right: a setting of 2Hz doesn't look like 2Hz (or radians).

0 Kudos
Message 6 of 6
(2,776 Views)