Discussion:
PCI 1200 control stepper motor
(too old to reply)
Ryan.NUS
2008-07-08 03:10:07 UTC
Permalink
Hi, I am a labview new user, I am trying to use Labview 6.1 and PCI 1200 to control a stepper motor.
I have a few question to seek help from all of you.
(1) how to write a program to ramp the frequencey?
(2) how to count the number of pulses? (I have tried  labview 6.1 example count event 8253.vi, but it does not count pulse accurate when it is at low frequrency )
(3)how to send a pulse train with exat number of pulse? (I have tried labview 6.1 example, finite pulse train8253.vi, but this programe dose not work well when it is required to send small number of pulse)
 
thank you for your information
 
 
BrowningG
2008-07-09 00:40:09 UTC
Permalink
Hello Ryan,

When you say that the count event VI does not work properly, could you elaborate?  Are you saying the incoming pulses are at low frequency and the count is not being kept accurately?  The example program that you mentioned is how you would setup the device to count pulses.  In order to change the frequency of your counter output, you will need to change the specifications of your pulse on the fly. 

How many pulses are you trying to send for the pulse train generation?  The example VI works in the method that is needed to create a finite pulse train.  First, you generate a timebase with one counter that is used by the other two.  Then, one counter uses this timebase to gate the other counter for a certain period of time.  The last counter is trying to generate a continuous pulse train based on the specifications you provide, but it only produces it for a certain period of time based on the gate you create with the second counter.  This method uses all three counters on the device at the same time.  Are you trying to perform all of the actions you specified at the same time on your PCI-1200 card?  Each counter can only be used by one task type at a time so if you want to count edges, you will not be able to generate a pulse at the same time. 

If you could let me know what type of accuracy errors you are getting we can work to see if they can be resolved.&nbsp; Also, NI has plenty of <a href="http://www.ni.com/motion/" target="_blank">motor controllers available</a>&nbsp;that can be used to control stepper motors that also use LabVIEW. &nbsp;
Ryan.NUS
2008-07-10 02:10:09 UTC
Permalink
Hi, Mr Browning,

"When you say that the count event VI does not work properly, could you elaborate?&nbsp; Are you saying the incoming pulses are at low frequency and the count is not being kept accurately?&nbsp; The example program that you mentioned is how you would setup the device to count pulses.&nbsp;"&nbsp;&nbsp;&nbsp; A pulse is generated and output thru OUTB0, then use "count event 8253" to count how many pulse there is, the number that counted is used as a condition to stop pulse generation.

"&nbsp;In order to change the frequency of your counter output, you will need to change the specifications of your pulse on the fly.&nbsp;" I don't understand how to "change on the fly", could you provide a sample?

"How many pulses are you trying to send for the pulse train generation?&nbsp;"&nbsp;&nbsp; I am sending&nbsp;a finite pulse train signal to&nbsp;a stepper motor, and, when I try to command the motor to move&nbsp;0.1mm(40 pulses),&nbsp;the motor could move more than 1mm, but when motor is commanded to move 10mm(4000 pulses),it move to about 9.8-10.3mm.&nbsp; in the case that motor moves less than the desired distance, it could because of slippage, but it moves more than the desire distance, there should be a signal which drives it move.

" The example VI works in the method that is needed to create a finite pulse train.&nbsp; First, you generate a timebase with one counter that is used by the other two.&nbsp; Then, one counter uses this timebase to gate the other counter for a certain period of time.&nbsp; The last counter is trying to generate a continuous pulse train based on the specifications you provide, but it only produces it for a certain period of time based on the gate you create with the second counter.&nbsp; This method uses all three counters on the device at the same time.&nbsp; "&nbsp; I aware of that.

" Are you trying to perform all of the actions you specified at the same time on your PCI-1200 card?"&nbsp;&nbsp;I am not performing the three&nbsp;taks at one time.&nbsp;
BrowningG
2008-07-10 21:40:07 UTC
Permalink
Hello Ryan,

The simplest way to change the frequency of your continuous pulse on the fly is to reconfigure your card using a while loop in LabVIEW.&nbsp; I took a section of the example Cont Pulse Train (8253).vi and placed the Generate Pulse Train (8253) VI into a while loop.&nbsp; Using this, I am able to change the pulse specifications while the pulse is still being output.&nbsp; I think this screenshot should clarify the code.&nbsp;

<img src="Loading Image...">

You could modify this to provide a software timed ramp in frequency by changing the output frequency in the while loop.&nbsp; The <a href="http://digital.ni.com/manuals.nsf/websearch/0AA638B7E90E699686256B180076F1C0" target="_blank">user manual</a> for the PCI-1200&nbsp;also contains some more information on the different options that are available with the device. &nbsp;

For your first question, I am assuming that you are continuously polling the count of the card and when that count reaches a certain value you stop the count generation.&nbsp; Whenever you count with this card, the data is first stored on the card and then transferred to the computer.&nbsp; It is possible that the count can be incrementing while you are waiting for the data to transfer and register in LabVIEW.&nbsp; This could cause some differences between the number of pulses sent and the number of pulses counted when the VI is stopped.&nbsp; Also, the finite pulse generation VI should send the correct number of pulses while the output frequency could vary from the frequency you specify.&nbsp; Could you try using an analog input line or an oscilloscope to determine if the correct number of pulses are indeed being generated.&nbsp; Since the finite pulse generation requires all three counters, if you have another counter device you could counter the number of pulses generated by the finite pulse generator to ensure that the output count is indeed incorrect.&nbsp; Message Edited by BrowningG on 07-10-2008 04:19 PM


ChangePulseSpec.gif:
http://forums.ni.com/attachments/ni/250/41463/1/ChangePulseSpec.gif
Loading...