Skip to main content

Can I execute a PRACTICE script or command when a specific event occurs? - Knowledgebase / PRACTICE - Lauterbach Support

Can I execute a PRACTICE script or command when a specific event occurs?

Authors list

Yes. TRACE32 provides the ON and GLOBALON commands to define actions that are automatically executed when a specific event occurs.

The general syntax is:

ON|GLOBALON <event> <action>

The difference between the two commands is:

  • ON creates an event handler that is active only while the current PRACTICE script is running. It is typically used when a script controls a test sequence and needs to react to specific events.

  • GLOBALON creates a persistent event handler that remains active until it is explicitly disabled. It is useful for reactions that should stay enabled independently of the currently running PRACTICE script.

For a complete list of supported events and actions, refer to the descriptions of the ON and GLOBALON commands in the General Commands Reference Guide O and the General Commands Reference Guide G.

To remove an event handler, use:

ON|GLOBALON <event> inherit

Examples

1. Execute a PRACTICE script when program execution stops:

GLOBALON PBREAK DO myscript.cmm

2. Continue PRACTICE script execution when an error occurs:

ON ERROR CONTinue

3. Execute the subroutine powerup_handler when target power is switched on:

ON POWERUP GOSUB powerup_handler



Helpful Unhelpful

3 of 5 people found this page helpful

Add a comment

ID-0
To prove you are a human, please tell us the text you see in the CAPTCHA image