Motor stop when comms lost

3 years 2 weeks ago #29533533 by milan@motion-impossible.c
Hi there,
I am hoping that someone could recommend a solution to a given problem.
I have a controller's (FBL2360) watchdog set to 500ms so when I loose the RS232 comms. the motor goes to speed zero. However, my deceleration rate can be set very low so the motor may take about 30 seconds to stop. How can I overcome this limitation and to make sure that the motor stops faster?
Thanks
Milan

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

3 years 2 weeks ago #29533536 by Gabriel_Isko
Replied by Gabriel_Isko on topic Motor stop when comms lost
The recommended approach would be to use a MicroBasic script. You can monitor for the controller to not have serial comms, and then set the acceleration accordingly.

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

3 years 2 weeks ago #29533540 by milan@motion-impossible.c
Thank you Gabriel I was hoping that a MicroBasic script could be used. How would you approach the monitoring with the script? Any example to show how to do this?

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

3 years 2 weeks ago #29533554 by milan@motion-impossible.c
Unfortunately none of the script examples shows how to process lost comms.
Looking at the "RWD - Serial Data Watchdog" I can only set the configuration value "setconfig(_RWD, nn)" but not able to monitor it when it's triggered.
I would expect something like this:
top:
if(getvalue(_RWD) = 1){
// change deceleration etc.
}
wait(50)
goto top

The "getvalue" is not valid command I believe so is there another way of checking the watchdog has triggered? Advice would be much appreciated.
Thanks

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

3 years 2 weeks ago - 3 years 2 weeks ago #29533555 by Gabriel_Isko
Replied by Gabriel_Isko on topic Motor stop when comms lost
Unfortunately I don't have an example, but I think you can use the status flag read command (_FS) and the acceleration and deceleration commands to set deceleration (_AC, _DC)

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

3 years 2 weeks ago #29533556 by milan@motion-impossible.c
Read status flag runtime query "result = getvalue(_FS, 1)" returns the following bits:
f1 = Serial mode
f2 = Pulse mode
f3 = Analog mode
f4 = Power stage off
f5 = Stall detected
f6 = At limit
f7 = Unused
f8 = MicroBasic script running
Do you suggest that the f1 will indicate whether the serial mode is active or not?

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

3 years 1 week ago - 3 years 1 week ago #29533568 by milan@motion-impossible.c
Just to complete this topic here is a solution.
First thing I had to do was to send command "!r" via uart to the controller.
scriptBuffer[0] = '!';
scriptBuffer[1] = 'r';
scriptBuffer[2] = '\r'; // carriage return character must be included
This command started the script which I pasted below. Make sure the watchdog is set to some value and is not 0.

top: ' label header

result = getvalue(_FS, 1)

if not(toBool(result Mod 2)) then ' if serial comms lost - bit 0 is zero
setconfig(_MDEC, 1, 30000)'motor 1 deceleration to 3000 RPM/s
setconfig(_MDEC, 2, 30000)'motor 2 deceleration to 3000 RPM/s
setconfig(_GO, 1, 0) 'motor 1 go to speed 0
setconfig(_GO, 2, 0) 'motor 2 go to speed 0
end if

wait(100) ' pause 100 ms
goto top ' return to label header

I hope this helps to someone.
Thanks for suggestions Gabriel.

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

Moderators: tonysantoni
Time to create page: 0.088 seconds