RobotStudio event

I'm looking to include in my code a part that would handle errors and stop commands.

Options
I am not sure how to program it. Basically, I have one Digital output that switches on, during the course of my code. I want this Digital output to turn Off every time a specify error occurs or a group of errors occur. Also, I want the Digital Output to turn OFF, when i stop the program. How do I go about adding this feature into my code?

Answers

  • Shell
    Options
    To manage errors you can use the RAISE instruction, create a custom errornum and then raise it, the code will jump to the ERROR section of the procedure, then you can check what error has been raised and turn off that signal.
    If you want to turn OFF a signal when your program is stopped you can link that signal to the motoron signal on a crossconnection or you can create an "onStop" event on the controller configuration that will call a procedure every time the program is stopped, then on that procedure you can turn off that signal.
  • lemster68
    lemster68 ✭✭✭
    Options
    I don't know why I didn't think of it before, but the system output Cycle On should do exactly what you were asking.
    Lee Justice
  • soup
    soup ✭✭✭
    Options
    I'd use the Stop event routine to turn off the signal at each stop (or tie it to a system output like suggested above).

    And a IError trap that turns the output off if the error number matches a list of custom error numbers.