Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How to count and stop at multiple encoder locations

Hello, I was given an assignment at school to create an encoder-based stepper motor driven wheel to be stopped at multiple preset locations as established in a simple list and controlled by a M series board (PCI-6221). The task involves a spreadsheet created list of locations (Stop locations) on the encoder where the stepper motor will need to advance to, stop for a preset period then advance to the next encoder location and so on until the list of locations is completed.
 
Specifics
 
1 stepper enable line to run motor that spins the wheel
 
1 quadrature input pair with reset (Index)
 
1 Power disable for stepper driver
 
Period of stop to be from 100msec to 10 sec
 
I have studied and searched for answers but I am stumped on the stop point list. How can I enter this "stop list" without writing a separate program? According to the teacher, there is a way to do this all in Labview but I can't find it.
 
Thanks so much for any help you can offer me,
 
Jessie
0 Kudos
Message 1 of 2
(3,510 Views)
Jessica,

In order to perform this you will need to implement some form of software control. I would recommend using the LabVIEW shipping example, "Measure Angular Position.vi" to measure your quadrature encoder (software timed). Then, you could use "Write Dig Chan.vi" for your stepper enable / power disable digital control lines. These example can be found in LabVIEW's example finder (Help->Find Examples) along with many other DAQmx and general LabVIEW programming examples.

As for the stop point list, I would use nested loops (one inside another), where the outer loop indexes through the stop points, and the inner loop cycles until the current position meets the stop point. In this situation, the outer loop would be a for loop, with the number of iterations equal to the number of stop points, and the inner loop would be a while loop, looping until the stop condition is met. Upon successful completion of this stop condition, you could toggle the stepper enable line. This could be done either inside or after the while loop. Moving this case outside the while loop would allow the while loop to execute faster, potentially increasing your stop position accuracy.

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 2 of 2
(3,500 Views)