YaskawaEurope / mlx-examples

This repository contains the sources of the MotoLogix code examples. The rendered pages can be seen on the Yaskawa Motologix website.
https://motologix.yaskawa.eu.com/examples
MIT License
3 stars 0 forks source link

MceStartStop; add reset after stop #26

Open yeu-degroot opened 1 year ago

yeu-degroot commented 1 year ago

There could be a risk that the command buffer fills up over time due to abrupted commands.

Consider adding an MLxReset after MLxStop:

// -------------------------------------
// stop and flush buffered motions with MLxStop
// -------------------------------------
50:
  fbStop.Enable := TRUE;
  IF fbStop.Sts_EN AND fbStop.Sts_DN AND (MLX.SystemState <> 9)
    AND (MLX.SystemState <> 10) AND (MLX.SystemState <> 11) THEN
    IF fbStop.Sts_ER THEN
      io.nErrorCode := 1000 + io.nSmStartStop;
      io.nSmStartStop := 70;
    ELSE
      io.nSmStartStop := 51;
    END_IF;
  END_IF;

// -------------------------------------
// NEW: reset system with MLxReset
// -------------------------------------
51:
  fbReset.Enable := TRUE;
  IF fbReset.Sts_EN AND fbReset.Sts_DN THEN
    IF fbReset.Sts_ER THEN
      io.nErrorCode := 1000 + io.nSmStartStop;
      io.nSmStartStop := 70;
    ELSE
      io.nSmStartStop := 45;
    END_IF;
  END_IF;