From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-18-2015 08:08 AM
Hello everyone. I am new to labview programming and i have a problem with a strucure tha i am trying to program. I have a structure where there is a stepper motor moving a plate and a reflective object sensor who measures a distance. This distance changes continuously and the signal from the sensor has almost a sinusoidal form. I have already built a VI where i define the steps of the stepper motor with "a for loop"..and i am taking the sensor signal with a daq assistant and collecting the data to a waveform chart "while loop". What i am trying to do is to take one signal measurement from the daq assistant per one step of the stepper motor. I tried to make it happen by defining in the properties (acquisition mode) of the daq assistant "one sample on demand" and the other choices but i didnt make it. I want strictly taking one signal measurement per one step without involving timing conditions. Finally my current thought is to make a mathscript (maybe??) inside the for loop of the stepper motor and in some way to combine the signal measurement with the steps. Thank you in advance. I would really appreciate if somebody could help me.
I attach my current VI.
05-18-2015 08:17 AM
05-18-2015 08:29 AM
First of all thanks for your answer. I am using NI USB-6343 and an easy driver to move the stepper motor. Can you be a little more specific for the trigger because i am new to labview programming and i am a little confused with some things in labview.
Thanks in advance
05-18-2015 08:41 AM
05-19-2015 04:21 AM
Hi GerdW,
Thanks again for your reply. I will check this out but i still cant find the solution with external triggering. In your opinion, could this be solved (one signal measurement per one step) with a mathscript node (matlab script) which will be in this already existing VI?? I am asking this because my goal is to initialize my signal so i can have an initial position (min value of my signal) where i can define later the positions that i want.
Thank you in advance.
05-19-2015 04:22 AM
05-19-2015 04:58 PM
Hi Chris,
I second Gerd's opinion. You can just use DAQmx. You can use one of the PFI digital inputs as clock. I also would recommend taking a look at some of the shipping examples. These examples can be accessed by going to Help in LabVIEW –> Find Examples and under Hardware Input and Output ->DAQmx
06-10-2015 06:29 AM
Hi GerdW & fblerg
Thank you for your answers. They helped me to do this and i actually did this with sample clock so i managed to take one voltage measurement per one step. I managed to initialize the signal by analyzing the data of the signal. I have a question about another way to define the steps of the stepper motor. With the current VI, i define the steps of the stepper motor from the DAQmx Timing>Samples per channel...so i define the steps from the front panel which it works. Is there any way to define the steps through the MATLAB script? I attach a VI where i am trying to do this but it is not working, apparently there is a mistake. I connected the samples per channel (DAQmx Timing) of the stepper motor to the MATLAB script but it seems the way i am doing this is wrong. I 'd really appreciate if someone could help me.
Thanks in advance