04-28-2014 07:59 AM - edited 04-28-2014 08:09 AM
Hi,
I had a program where I could insert an amount of revolutions, rotation direction and the motor speed. This program works perfect, but for my application I would like to change the amount of revolutions to the amount of steps that my stepper need to do. For my stepper 48 steps = 1 revolution. I did change some parameters in the C code and I thought it would work, but it didn't. Here is my code:
last line couldn't fit on my screen it's just a }
The result from this program is a little strange, the text bellow describes the steps that are done with my input of steps to do.
Steps to do Steps done
1 2
2 6 =+4
3 12 =+6
4 20 =+8
5 30 =+10
Is there maybe someone who can help me with this problems? I have attached my VI, although I think the problem isn't located there.
04-28-2014 08:23 AM
What is happening in the motor.step method? I somehow doubt your want to be putting "steps" as the argument since you are using that for the FOR loop. A definition of what the step method is would clear that up.
04-30-2014 03:27 AM
I took a closer look to an example code to do 1 step every loop. The example program works, but when I made some adjustments for my application it didn't work. Although it doesn't work I think I'm getting close to make it work. My guess is that there is a little problem with my C code.
When I run my VI it does send a 1 or 2 (clockwise or counter clockwise) via VISA. But in the C code something goes wrong, instead of doing 1 step in CW or CCW direction it gives me the ERROR status output.
Here is my VI and C++ code: