RobotStudio event

write EventLog from FP

Options
Hello again,

Is it possible write log messages in the EventLog from FP SDK?

or is read only from FP?

According to the RAB manual. It is only read.


thanks
Marcos Foglino


Comments

  • RussD
    Options
    You are correct, however you can write to the error log using RAPID instructions such as ErrWrite and ErrLog. You could probably use trap routines and RAPID data or IO to generate error messages pretty easily by setting a signal or values (via FPSDK) whenever you want to write an error, then have the trap routine call the appropriate RAPID instruction to generate the error log entry.
    Russell Drown
  • Marcos
    Options
    Ok, thanks Russ!
  • Marcos
    Options
    Russ,

    Could you show me a example of how call this RAPID instruccions from FP SDK?



    thanks.
  • RussD
    Options

    You can't actually call the RAPID routine from the FPSDK, but you can use FPSDK to write to a RAPID data value or set a signal that can be connected to a TRAP routine in RAPID code that would execute the RAPID ErrWrite instruction.

    For example, whenever you need to log an error message you could use FPSDK to write a numeric value representing an error code to a PERS num called nError. This variable would be declared somewhere in your RAPID code.

    In the RAPID code you would set up an interrupt and trap routine connected to nError. THis is often done in an event routine, see the RAPID documentation for more info.

    VAR intnum nError_int;

    CONNECT nError_int WITH nErrorTrap;

    IPers nError, nErrorTrap;

    TRAP nErrorTrap

      TEST nError

        CASE 1:

            ErrWrite "Error 1", "error 1 happened";

        CASE 2:

            ErrWrite "Error 2", "error 2 happened";

        CASE 0:  

            !do nothing, error cleared

        DEFAULT:

            ErrWrite "Unknown Error", "unknown error happened";

      ENDTEST

      !reset the error value if necessary

      IF nError>0 THEN

        nError:=0;

      ENDIF

    ENDTRAP

     

    RussD2008-7-14 22:16:28
    Russell Drown