LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Turret Press Control

Hello,

I am trying to create a program that acts much like a turret press does.  The goal is to make a machine that punches holes at any coordinates on a material the size of a regular sheet of typing paper.  The x and y movements are controlled by stepper motors.  These stepper motors are controlled by digital outputs in stacked sequences inside of for loops where the number of iterations relates to the distance the punch should travel.  My problem is I need to punch multiple holes, the number of holes is to be determined before hitting start.  So after pushing run I need a program that will move in the x and y to the first hole, then move to the next hole, and so on.  The hole locations can be entered before pushing start, but once again I dont know how many holes will be punched until right before running the program.  I am having trouble figuring out how to implement this and what sort of structures to use.  Has anyone worked on this sort of program before or have any ideas to get me started?

 

Thanks for the help

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

@mtcellar65 wrote:

[...] I dont know how many holes will be punched until right before running the program.  I am having trouble figuring out how to implement this and what sort of structures to use.  Has anyone worked on this sort of program before or have any ideas to get me started?

 

Thanks for the help


I'd use an array to hold the coordinates and a For Loop to go to each one.

 

Your question is a bit wide-open to answer more specifically.  What have you written so far?

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

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

So here is what I have now:

 

I am using stepper motors to control the x and y motion and a solenoid for punching.  I have written for loops for the stepper motors where the number of iterations directly relates to the distance I want the machine to travel.  My goal then is to have two input numbers, an x and y coordinate.  I would like to have an excel spreadsheet (or if similar can be done in LabVIEW) where I enter my x and y coordinates into the first row in columns 1 and 2.  The relative distance from this point will go in row 2; the relative distance from there will go into row 3 and so on.  My goal is to write a sort of state machine/sequence where the program reads the two coordinates in row 1 and executes the for loops to move to that point.  Then it needs to read the coordinates in row 2 and move to that point.  My problem is: I do not know how to read two data points at a time into LabVIEW.  I don't know how many points there will be but I would like the program to keep moving relative distances until it reads a 0,0 and then stop.  I am asuming I can do this with an if statement that says if the two read coordinates are 0, stop; else move that distance. 

 

Please help me with this excel problem.  I've seen the tutorials on how to read whole data sets but I would like to be able to read off two usable coordinates at a time until the coordinates are 0,0.

0 Kudos
Message 3 of 6
(2,401 Views)

It sounds like all you need is a 2D array and one for loop.  The Array has two elements in each row, the relative x and y coordinates. Using autoindexing the for loop will take you through all the rows in the array.

 

Here is a simple example to show what I have in mind.

 

Lynn

0 Kudos
Message 4 of 6
(2,397 Views)

Lynn,

 

I think you are my hero... Thanks for the help it worked like a charm!  You're about as helpful as they come, I really appreciate it.

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

Jim said basically the same thing in his earlier post.

 

As with any tool, you have to learn how to use it effectively.  LV makes it easy to use arrays of data and to repeat things in loops.  So, when you want to do the same thing over and over with different values, you learn to think of arrays.

 

Lynn

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