Runtime Commands execution speed / Load Home Counter

8 years 4 months ago - 8 years 4 months ago #29529979 by Herman
I would like to set Load Home Counter as fast as possible.

When I give 4 concatenated commands: !G 0_!EX_!H 1_!MG it does not work.

Loading the counter will let the motor spin for a moment ! The counter value is correctly loaded.

I added !EX and !MG just to prevent for adverse effects in closed loop speed mode while loading the counter


It works OK if when I give the commands one by one (approx half a second pause between the commands) !



Could you help me

Herman

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29529980 by roboteq
All 4 commands are executed one after the other without delay. So the !MG may be undoing the !EX in your case.

In any case, to avoid problems when loading a new counter value, best strategy is to swich to open loop, load the counter, switch to closed loop

You must have at least a 1ms delay from the time you sent the command to switch to open loop, to the time you send the command to switch back to closed loop.

Please Log in or Create an account to join the conversation.

8 years 4 months ago - 8 years 4 months ago #29529981 by Herman
Thks Tony,

one cmd/sec works fine:
!G 0
^MMOD 1 0
!H 1
^MMOD 1 1

I will try to speed up to 2ms/cmd
Question: Is there a ASCII character which I could add for a delay between concatenated cmds ??

I did not know the controller accepts (these) configuration cmds during runtime !!

Herman

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29529988 by TechSupport
You could try making a microbasic script. In scripting you would use the following syntax to create a delay in mS.

wait()

wait(10) would create a 10mS delay.

Please Log in or Create an account to join the conversation.

8 years 4 months ago - 8 years 4 months ago #29529989 by Herman
Running this sequence (!G = zero and motor not running)

^MMOD 1 0
!H 1 (default home count value)
^MMOD 1 1

Running at 2ms per command resets the counter but still let the motor spin for a moment.
It spins only when actual encoder position is not the home position. But the main command (!G) is set to zero, so I don't understand why the motor spins !!

Increasing to more than 100ms per command stops the motor from spinning for a moment.

I don't know what causes this behaviour, I am interested whats happening.

For my application it is not a problem to reset the counter in approx. 400ms.

bdw I use PI closed loop speed

Herman

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29529990 by TechSupport
Are you giving the motor enough time to get to the home position?

When you are in the closed loop mode, the motor will spin sometimes or all the time even when you give a 0 command because of the PID not being properly tuned enough to do so. What it means is that if you go to open loop mode, give the !G 1 0, then it tells the motor to stop moving. Then when you move to the closed loop speed mode, the motor should still be at rest unlesss you tell it otherwise.

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29529991 by Herman
Sorry but I still don't understand:

Controller in closed loop speed mode, motor is not spinning and gets continuously (each 2ms) 0 commands. The motor stays still: I understand

Than I go to open loop,
wait 2ms,
reset the encoder counter
wait 2ms and go to closed loop.

After 2ms I will continue to give 0 commands (each 2ms)

That will spin the motor for a moment ! Why ??
Which action is causing this ??

Herman

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29529992 by TechSupport
If you are resetting the counter back to 0 via !H or !C?

!C 1 0 will force encoder counter back 0, whereas the !H 1 will load a preset value that was pre-defined, not that it should really matter if you are using closed loop speed mode.

Since you are using speed mode, you can give a specific speed command instead using !S.

!S 1 300 will tell motor 1 to go to 300RPM's.

Try sending the !S command instead of the !G when in the closed loop speed mode. This is the only mode where you can specify a speed command using !S. All other modes will work differently with that same command.

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29529993 by Herman
I reset with !H to default preset value (thats zero)
Nice to know that !C 1 0 will do the same


I will try !S instead of !G but I don't understand why that would help


Herman

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29529994 by TechSupport
!G isn't the same as !S. The !G is the go command that tells the motor command value to go from 0 to +1000 or -1000. Those value will translate into speed from rest to max speed. But since the command is only in those values, it refers back to a % of the output speed. So +1000 and -1000 is full max speed that you specified in your speed and acceleration parameters. +500 and -500 is half the max speed.

!S says go to specific desired speed.

With that in mind, my suggestion to use !S instead of !G is to see if you get a different behavior.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.079 seconds