Stepper motor case structure

Hey everyone
I am currently a physics student and for my final year project I am building a mini CT scanner which involves the use of two stepper motors. I currently have a program working which controlls the motors but i am having difficulty in reversing the rotation. Unlike conventional CT scanners, I must rotate the sample. Would anyone be able to help me figure out how to automatically change the case structure form true to false in order to reverse the stepper motor and without stopping the program.
Many thanks
John
Attachments:
motor.vi ‏48 KB

From this point, it is just a matter of figuring out what logic you want to be in place of that control.
You can go by the number of iterations and switch if you go beyond a certain count.  You could go by your rotations completed.  It is just a simple comparison.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • Labview using a stepper motor

    Could really do with some help I am a 4th year student doing my final year project. The project has a conveyor belt which is driven by a stepper motor, along the conveyor belt there is 5 sensor I want to be able to stop the motor at theses sensors for a certain time and then restart. I have attached the program I have come up with but I have one slight problem the motor will not reactivate without the sensor been made again is there any way around this.
    Any help would be greatly appreciated.
    Regards
    Billy
    Attachments:
    24.02.14.vi ‏146 KB

    Hi Bilbo,
    The case structures in your code go 'True' when the voltage values you are acquiring is greater than / equal to 0.5 V (this is how dynamic data type behaves when converted to boolean). I don't know what sensors you are using and also I could not see a stop command being sent to your motor anywhere in the code.  It is worth considering the state machine architecture as mentioned in the previous reply. you can find a white paper telling more about the state machine  here:
    http://digital.ni.com/public.nsf/allkb/5CD79190713D2B558625765F007FCC99
    If you have to rely on voltage values to detect whether your sensor is activated or not, you will have to continuously monitor your sensors in one state (sensor monitor state) of your state machine and based on the value decide whether you need to move to 'sensor activated'/ sensor deactivated' state. In these states you need to take the appropriate action on your motor (i.e. turn off (in sensor activated state) and turn on (in sensor deactivated state)) and return to your 'sensor monitor' state to monitor your sensor. This will be more clear once you read the article and understand the state machine architecture and how to implement it in LabVIEW.
    I hope that helps.
    Thanks and Regards,
    Supreeth.K
    Applications Engineer
    NIUK

  • Can I put a READ function in a TRUE/FALSE case structure?

    Hi,
    I have a vi that operates as controller for a mechanical system of motors.  There are several sensors of various types, that provide input to the vi, including encoders, whose period is being measured.  The attached vi is the encoder period measuring part. It measures 15 periods and tells me the average of the 15 with each loop iteration.
    In my application, the encoder period measurement is not needed unless the vi knows that ALL THE OTHER sensors in the hardware configuration are measuring values within the desired range.  For example, Sensors A, B and C should all measure between 5-10.  If they are all showing values between 5-10, then, we want the encoder value to read and display.  If only one of the sensors, say A, is measuring 12, then, we don't want the period value to READ or be subsequently processed.  So, it is easy to set up the sensors A, B, C, to give a TRUE or FALSE based on whether they are within range or not, and if all 3 are TRUE, then, that value can easily be passed to the case structure that holds my READ function for the period.  Is this a good way to do this?  The goal is to eliminate unnecessary execution time that the period READ function would consume, as well as all subsequent calculations that are performed on the period value collected.  The period data is of no use if any one of the other sensors is not in the correct range.
    If any one of the other sensors is out of range, we want to skip the encoder READ step altogether.  So, it is easy to structure a BOOLEAN in my vi as shown in the attachment.  If I do it this way, will it throw an error, or just skip the READ until the BOOLEAN is true again?  Is there a better way to prevent the READ from happening if one of my other sensor values is not within the correct range?
    Thanks,
    Dave
    Solved!
    Go to Solution.
    Attachments:
    forum JUly 18.vi ‏26 KB

    Sure, you can put a Read inside a case structure. For your application, just check that your sensors are all within range (Comparisons palette), then AND the T/F's and use the result of that for your case structure. (If you are already doing the in-range check, I can't see it here because you have 5 subVIs that I cannot open here.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • Can I use a formula node to start the execution of a case structure?

    Hi,
    I am working on editing a VI to make it much easier to understand (for colleagues and non LV users). For one reason or another, the VI's creators did not fully make use of the power of case structures and other structure types. In the application we need it for, the instrument cycles and repeats measurements on several objects. We are interested in measuring the motor currents for several motors in the system. As it stands now, for each sample object's run, there is a separate sub-vi diagram which displays its waveform trace and several indicators such as max current, time at max, etc. That code was contained within a T/F case structure and copied and pasted 20 plus times.... Obviously the vi became extrememly cluttered and needed a huge screen to see. The trigger for the current case structures is an EQUALS comparison between one input (which is the sample object counter; and this part I will likely leave unchanged since it makes a lot of sense already) and a constant which was defined 1 through 20+ for case. 
    I have since made one case structure and 20+ instances of that case and have labeled them (at the top selection box near the detent arrows) "1", "2", 3, etc. I am wondering if I can use a formula node to act as the "trigger" which sets each case structure running? I believe that a simple IF statement should work. Please see a snippet of my attempt at making this in C below.
    For the node, I defined X as the input and Y as the output. The input to the node, X, is connected to the sample object counter. The output, Y, is connected to the case selector of the case structure. My attempt at the code is below:
    int32 y
    For(x == 1)
       y = "1";
     For(x == 2)
       y = "2";
    etc, etc.
    Is that above code snippet correct? Do i need something like "ENDIF" or "end if" at the end? Does "y" have to be defined as "int32" or can it be something else?
    Thanks for the help!

    Is your formula node doing anything else besides what is shown?
    Why don't you just wire the value that is going into it at X directly into the selector of the case structure?
    Attachments:
    Example_VI_BD.png ‏2 KB

  • Trouble positioning a stepper motor accurately (to one step)

    I'm using a PCI-7344 with an MD7506 motor driver from RS. I'm testing angle sensors whose voltage output is proportional to (you've guessed it...) angle.
    I'm stepping the motor round by one step, checking that it's got there by reading the encoder, measuring the sensor voltage and repeating.
    My problem is that the motor sometimes 'hunts' around the target position. In closed loop (with an encoder associated with a motor) this results in sometimes not being able to reach the target exactly with the pull-in moves.
    Using open-loop and reading the encoder directly I get better results because I can loop more times, but the motor will still 'hunt' around a target point, changing direction a few times as it over
    shoots by a step.
    As there are a million MAX settings for this I won't list them all here, but I'm checking for a move complete when the InPos flag is set and I have a deadband of 0 steps too. I'm only rotating at 120 step/sec with a 10ms pause between steps.
    Do I have to accept that stepper motors are only accurate to +/- 1 step or am I doing something wrong?
    Thanks,
    Mike
    Mike Evans
    TRW Conekt
    N.I. Alliance Member, UK
    http://www.Conekt.net

    Mike,
    Maybe other people will have better suggestions, but in my case I can advise to either:
    1. increase the number of pull-in moves,
    2. increase the microstepping of your drive,
    2a... together with a higher precision encoder...
    Other than that, the accuracy is advertised to +/- 1 step, so maybe you would like to consider a stepper with more steps/rev.
    Good luck!, I hope other people will give other suggestions.
    Nestor.
    Nestor
    National Instruments

  • Resetting a Case structure

    I am writing a VI that reads in a signal to a comparator and sends the
    output
    to a
    case structure.
    The ides behind the project is EMG (monitoring muscle active/inactive
    times).
    The case structure is as follows:
    If 1: count up and if count reaches 10 then green LED on (represents muscle
    active)
    If 0: count up and if count reaches 10 then red LED on (represents muscle
    inactive
    and should be exercised.)
    My question is how could I reset the case structure to start again: i.e, If
    Case=0
    and the inactive time reaches 10 and RED LED comes on, I want this to then
    turn
    off
    and put the count back to 0 if it switches to Case=1.
    (The idea is that this RED LED is representing a Vibrate motor (which I
    will
    output
    to using DAQ) . The motor will switch on as the RED LED does to indicate to
    a
    user
    muscle should be exercised but I do not want the motor to be on constant, I
    need it
    to turn off when the muscle is exercised and then restart the count again)
    I probably haven't explained this very well but I have attached my VI.
    Any help would be appreciated
    Solved!
    Go to Solution.

    PinkLady4128 wrote:
    The case structure is as follows:
    If 1: count up and if count reaches 10 then green LED on (represents muscle
    active)
    If 0: count up and if count reaches 10 then red LED on (represents muscle
    inactive and should be exercised.)
     What is the count interval? How is the count increment triggered (time ie: every second?)
    My question is how could I reset the case structure to start again: i.e, If
    Case=0 and the inactive time reaches 10 and RED LED comes on, I want this to then
    turn off and put the count back to 0 if it switches to Case=1.
    Do you want the reset to occur automatically and restart?  Do you want someone to notice the RED LED?  If it resets, do you want to start again but keep the RED LED on which also indicates that the motor is running?
    (The idea is that this RED LED is representing a Vibrate motor (which I
    will output to using DAQ). The motor will switch on as the RED LED does to indicate to
    a user muscle should be exercised but I do not want the motor to be on constant, I
    need it to turn off when the muscle is exercised and then restart the count again)
    So while it is counting, if there is muscle
    movement detected, do you want the motor to stop and the RED LED to turn
    off?
    I probably haven't explained this very well but I have attached my VI.
    You forgot to attach your VI

  • What's the type of control for stepper motor?

    Hi,
    I'm using PXI-7358 controller, UMI-7774, Industrial Device NextStep third part microstepping drive, stepper motor SANYO-DENKI (type 103-8932-6421, NEMA42) and incremental encoder 3600 ppr (14400 count/round). I want to say what's the NI onboard type of control used to control motor step position? In the case of servomotor the type of onboard control is a PID, in the case of stepper motor what's the type of control? What's the MAX parameters to set for the project specific (overshoot, settling time, rise time etc..)? What does it means "Pull-in Window" e "Pull-in Tries" in MAX? So, it's possible control the stepper motor with user's algorithm control, excluding the onboard control?
    Thanks for your patience,
    Best regards
    Lorenzo

    >
    Matt wrote:
    > Go to SE24.  Type in cl_dd_document and press enter.  Select the methods tab.  Look for the method "CONSTRUCTOR".  Double click on it.   Click on SIGNATURE button.  The types of the parameters are clearly seen.
    >
    > matt
    TYPE and VALUES OF TYPE -- different things. For example, TYPE C -- CHAR. VALUES of this: A, B, C, ..., 1, 2, 3.
    Thus, return to question.
    TYPES: sdydo_attribute(50) TYPE c
    TYPE: sdydo_attribute
    VALUES: ???
    May be, value ABRAKADABRA correct?

  • Shared variable engine modbus - Getting a stepper motor to work

    Hello,
    I am new to Labview. I need to trigger the stepper motor to start by allowing current to run through the motor. This can be done by turning bit3 on the16 bit register 007Dh. The register address has been attached below as 007Dh.png so please view that before you go any further to have a better sense of what i'm trying to accomplish. Please also note that the decimal conversion of 007Dh is 125.
    So my question is, how do you turn on bit3 of that 16 bit address? How would you translate the holding registers from the manual
    into a 5-6 digit data item that labview can understand?
    (Please refer to this page for the types of data items: http://zone.ni.com/reference/en-XX/help/371618J-01/lvmve/dsc_modbus_using/)
    Attachments:
    007Dh.png ‏17 KB

    Hello Frank,
    Thank you for the help with the modbus slave simulator, everything worked just fine. However I still can't get the real device to work with labview. I am wonding if you can answer a question for me as I am not sure I can do what I want with the equipment I have. 
    What I need to do is turn a stepping motor on and off using Labview as well as get Labview to record the speed and position of the stepping motor over time. I have an AED-AD stepping motor driver made by Oriental Motors. I have attached the user manual in case you need to see it. I am conecting the motor driver device to a computer using an RS485 converter, which oriental motors suggested I use for the purpose of using Labview to collect data. 
    My question is, will this setup work for what I need to do, or do I need some kind of data aquisition device as well? 
    After I solve this, I will be adding three more motors to the Labview program monitoring the same thing as well as some pressure sensors.
    I have just finished my second year in the engineering program and have been hired as a research assistant to solve this problem so I am completely new to Labview. If there is anything else you can suggest to read or someone I can talk to to get more information about this type of control systems I would be very greatful. So far, I have been reading as much stuff as I can find about Labview on the internet but I have not come across anything that helps me figure out if my setup is appropriate for collecting data in Labview.
    Thank you again for your help and advice! I hope you are having a great weekend!
    Kind Regards,
    Meesh
    Attachments:
    HM-60065-3E.pdf ‏1787 KB

  • Why won't my charts continuall​y update while running a case structure?

    I'm making a VI to drive an actuator and read a force on a load cell.  I have programmed the actuator to run through a flat sequence using millisecond timers to delay its drives outward and inward, which is necessary for its intended use.  However, my goal is to have it display the motor position and the force on the load cell on the charts continuously throughout the test.  However, when activating the case structure containing the test sequence, the graph fails to update live. 
    I'm not sure if I'm on the right track, but I have posed my file for whomever is interested.  I hope you can lead me in the right direction, and thank you very much.
    Keith Blume
    Attachments:
    Final VI.vi ‏303 KB

    johnsold wrote:
    You can find the version of a VI you have downloaded (as long as you have not saved it) by closing the window.
    Well, closing the window is a bit drastic.
    Simply go to VI-properties (e.g. by right-clicking the icon in the upper right) and do: "General...list unsaved changes"
    Message Edited by altenbach on 12-16-2008 08:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Version.png ‏31 KB

  • What third party drive do I use to connect my umi-7764 to a phytron stepper motor (zss66)

    I would like to connect my phytron stepper motor (zss66) to my UMI-7764, do I need a third party drive ?
    And if i need one, which one ?
    Thank !
    Seb (I am french so if you want to aswer french, let's go )

    Sebastien,
    l'UMI 7764 n'est qu'un bloc de connexion. En aucun cas celui ci ne délivre de puissance. Donc il vous faudra nécessaire un bloc puissance entre l'UMI et votre moteur. L'UMI 7764 ne délivre aucune puissance.
    (N'oubbliez pas d'aimenter l'UMI avec une alimentation 5V externe. Ce 5V est à connecter sur le connecteur situé au debut du boitier).
    National Instruments fourni des drives (MID 76XX)dont les specs sont limités en courant. (Elles sont affiché dans le lien ci dessous). Dans le cas de l'utilisation d'un drive NI, il n'est plus nécessaire d'utiliser l'UMI 7764.
    Le choix de votre drive se fera en fonction du nombre de phase de votre stepper, et de son courant nominal.
    Voici un lien sur lequel vous trouverez une liste de drive pour stepper. (Voir
    le bas de la page web)
    http://www.ni.com/devzone/advisors/motion/driveadv​isor.htm
    Je ne connais pas les spec de votre stepper, mais si vous désirez l'utiliser avec un UMI 7764, le plus simple serait de contacter la fbricant de ce moteur, et d'obtenir une liste de drive que celui conseille.
    Raphael TILLET
    Ingénieur Application
    NI FRANCE
    Cordialement,
    Raphael T

  • How do you control LED lights on the front panel to identify the number of steps a stepper motor has taken?

    I am controlling a stepper motor that is coupled with a valve with four outlets (using an Arduino).  I've got a general understanding of how to control the motor, but I want LED lights on the front panel to light up that indicate which outlet the valve is currently at after the steps are taken.  The method I'm thinking about involves a lot of repetitive code.  I'm not that experienced with LabVIEW, I'm assuming I need some sort of loop structure but I don't know how to set it up in order to control the sequence of the LEDs.  I've attached my current block diagram for a visual aid if needed.
    Attachments:
    Capture.JPG ‏33 KB

    I was thinking about using the Stepper To Go and Stepper Write functions four separate times, using the same constants for the steps each time since the distance between each outlet is equivalent.  The only difference would be what's connected to the "steps remaining" node, which would be the function that activates one of the four LEDs (if that makes sense).  I was thinking that doing it this way would be a little counterintuitive since the only thing that needs to be changed is the LED indicator.

  • Suitable card for three stepper motors

    Hello everyone, 
    I want to ask which DAQ card would be suitable for controlling three (X,Y,Z stage) stepper motors using continuous and/or finite pulse generation.  X and Y stages have to be independent on each other (i.e. diagonal movement), Z one does not but it would be nice. Solution may include buying two cards to ensure the independency of counters.
    I have heard that for finite pulse generation two counters are used for one axis (stage). Does it mean I need a card with six counters? Or two cards with four and two counters? In that case, our lab is equipped with the old 6035E card providing two counters (unfortunately not independent in finite pulse generation mode probably due to the statement above), which could handle one of the axes. 
    I dont want to use DIO for pulse generation because there is no possibility to control the frequency of pulses. Frequency for the stepper motor varies from 1000 to 2000 Hz. 

    Hi Diego,
      There is a way to only use one counter to output a finite digital pulse train.
    Normally when performing a finite counter output operation, two counters are required. One counter is used to actually output the pulses and another is used to gate the first counter and therefore output a finite number of pulses.
    The way to accomplish this same behavior with a single counter is by setting up a continuous pulse output task with a start trigger and a pause trigger. The pause trigger takes the place of the second counter normally used as the gate signal, freeing this counter to be used for other operations. 
    Finally, an external source must be used to create a pulse of a desired width in order to achieve a finite pulse train that used a single counter on the PCI-6602.  In the case below the external signal is passed to Dev3/PFI0, which has been configured to be the pause trigger source terminal. 
    Pause triggers are only valid for continuous sampling mode with implicit timing. You can find the properties for the proerpty node in the following locations:
    Properties » More » Pause » Trigger Type
    Properties » More » Pause » Digital Level » Source
    Properties » More » Pause » Digital Level » Pause When
    For each property, right-click the terminal and select Create » Control or Create » Constant  from the shortcut menu.
    Keep in mind also that there are stepper motor controllers available from NI like 7332. For more information check the link above:
    http://sine.ni.com/np/app/main/p/sn/n21:6/ap/globa​l
    May you have further questions dont hesitate to ask!
    Best regards,
    David Varga
    Applications Engeneer
    NIH

  • Repeatable different steps of a stepper motor

    Hello everyone,
    I am working on a project where i have a stepper motor moving a plate and a signal sensor who measures a distance. I managed to initialize the signal so my initial position is the position where the sensor gives me the minimum value (Voltage).Each time the stepper motor moves, i define it from the front panel. My question is, how can my stepper motor moves automatically for e.g. 8000steps then without define it again for another 5000 steps or whatever i want with a time delay. The definition of the steps now is being done from DAQmx Timing>Samples per channel. I want to run the program and the steps to be already defined wihtout change them again and again from the front panel. I attach my current VI.
    Thank you in advance
    Attachments:
    (2nd version (a-D).vi ‏73 KB

    Hi Chris,
    not a problem, we all were new at some point. In case you don't know there are boatloads of classes you can access online with your License or even without one:
    Here's a small collection (courtesy of crossrulz):
    3 Hour Introduction
    6 Hour Introduction
    LabVEW Basics
    Self Paced training for students
    Self Paced training beginner to advanced, SSP Required
    LabVIEW Wiki on Training
    Learning NI
    Getting Started with NI Products
    And if you are a student you can take a real class with NI for a ridiculously small amount of money (say, 93%) discount).
    With start twice I mean that I was wrong in believing you did so, when I fact you started two different tasks, so: nevermind.
    PFI stands for Programmable Function Input, which is confusing because it is probably assigned to an I/O line. I just asked to find out what section of your code I have to look at. I'm still not quite sure about this, butI understood you want to move the motor, when you push a button. The only part of your code, where you even read a button within a while loop is for the Direction Line. Apart from that you just write the inputs once and then forget about the tasks (not even stopping them sometimes). I suggest moving the button that should move the motor into a while loop. 

  • I need an example vi about stepper motor control

    Hi.
    My system is consist of pc-tio-10 controller, SLOSYN SS2000D6 driver, NEMA 17 stepper motor,and labview5.1.
    I'm trying to give a pulse to the motor, take a pulse from the motor and control the nmotor. But I don't know what to do. So I want to see the example vi.
    Please let me know where I can get appropriate example for this case. Thanks.
    Jee

    Here is an older example from LV 3.X, but the concept is still valid.
    Attachments:
    STEPPER.TXT ‏2 KB
    STEPPER.LLB ‏197 KB

  • Case Structure Based on Changing Input Controls

    Hello. I am trying to create a control VI for a quad-copter. Right now I've managed to build a basic program that gets input from some sliders and transforms and sends it to the quad-copter motors through I2C and virtual serial port.
    The problem that I'm having is that I want to be able to control the engines either individually or in pairs, so I can achieve motion in all directions. But since I can't have multiple inputs at the same time for each engine, I think I might need a case structure. What I would like to do is have a scenario where depending on whether an input changes and how (either for an individual motor or a group), the case structure switches to that case and takes the inputs specified for that particular case. What I'm thinking is having 10 or so sliders, 1 for each engine, and then 1 each for groups like 1 & 2, 3 & 4 and 1 for all, and depending on whether they change and how, switch to the case where only those particular engines change speed.
    Can you please help me out with that? Thank you. 

    That is one way to accomplish it. I would probably use the event structure. It is not that difficult to use. It is very similar to the case structure.
    I would also caution you on comparing two floating point numbers. Due to rounding it is possible that you will subtract two values which are essentially equal but return a non-zero result. You should use the "In Range" VI and set some tolerance value which indicates the numbers are equal.
    One last item, do you want your shift registers to be unitialized? If they are unitialized they will retain the values from the last execution of this VI. You may not want that since I assume you would want your motors to be off in the initial state.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Maybe you are looking for