Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make MG17Piezo ActiveX automated without using jog to move the Nanomax stage

Hi Mahendar,

I am currently running it in closed mode. But I don't understand what the top part of the code does. 20 divided by stepsize then adding 1 to it then truncating it to the next lowest integer. Is that part required in the code? What does it actually do?
0 Kudos
Message 21 of 39
(3,742 Views)

I do not find 20/stepsize in code that sent to you. can you mark it in that code and send me back ?

0 Kudos
Message 22 of 39
(3,739 Views)

Hi,

 

I've attached the document with a red arrow pointing towards the start of that part of the code.

 

Thanks

 

0 Kudos
Message 23 of 39
(3,736 Views)

Any ideas?

 

Thanks,

 

Tania

0 Kudos
Message 24 of 39
(3,732 Views)

I wrote code too many times with step-by-step improvement. I thaink, I might have written that to control the number of iterations of the for loop. If you use any other stop condition, you can just delete that.

 

Mahendar

 

0 Kudos
Message 25 of 39
(3,730 Views)

So 20 divide by stepsize, then +1, then truncating is basically just a limit for the number of iterations? Currently my stop condition is if the position reaches 20 (which is the maximum) then the code should stop running. Is that sufficient?

 

Tania

0 Kudos
Message 26 of 39
(3,727 Views)

If you are using while loop, it is sufficient. 

 

Mahendar

0 Kudos
Message 27 of 39
(3,725 Views)

And so if it is calculating the maximum number of iterations, this value stays the same till the code stops running?

 

Tania

0 Kudos
Message 28 of 39
(3,724 Views)

Value remain same means current position is same, peizo is not performing any motion at that moment.

0 Kudos
Message 29 of 39
(3,722 Views)

But if this is calculating the maximum number of iterations then how can it keep changing?

 

So for example if I choose step size to be 0.1. Then 20/0.1=200, 200+1=201, and no need to truncate because it's not a decimal number. So this number 201 is the maximum number of iterations for the while loop is my question? What is it computing?

Given that 201 is the no. of iterations, then the code inside the while loop starts running step size multiplied by number of iteration starting from 0 and until the iteration reaches 201 the loop will keep running unless some other condition is fulfilled and the code has to stop. Is this what you're saying?

 

Thanks

 

Tania

0 Kudos
Message 30 of 39
(3,719 Views)