MxVMC Handler Function Transforms

You can create Signal Transforms that execute in the context of the Virtual MicroController. These Transforms manipulate data in the MxVMC Connector as it passes between the MxVDev Harness and the SUT software.  You implement the Transforms as C functions in the source code for your SUT project, usually in the AppIF.c file.  They are often referred to as Handler Functions.

The Handler Functions are executed when the corresponding Signal value changes.  You associate the MxVMC Transform with a particular Signal in the Signal Dictionary. These handlers can come in handy in several situations. Some examples are provided in the comments of the AppIF.c file included with the TurnDoor sample project.

For input signals, the signal transition handler is invoked immediately after the signal value is modified (in response to a transition in the test case). For output signals, the signal transition handler is invoked immediately before the changed output is reported back up to the test case.

Using Handler Functions

To associate a Handler Function with a signal:

1.Select Project->Signal Dictionary from the main menu.

2.Select the Signal and click the Edit button.

3.Select the Handlers tab.  

Handler Function Name - In the Handler Function Name field, enter the name of the C function that you want to invoke. Use 'MMNULL' if no handler function is needed.
Indicator - You can pass a value to the Handler Function via the Indicator. When a Signal changes, the value of the C variable CurrentSigInd is set to the value of Indicator below. The definition of CurrentSigInd can be found in MxVHarness.h.
The Handler Function can access CurrentSigInd when it executes.  The Indicator value is usually used when you want to have one Handler Function handle several signals.  In this case there will be one handler in the AppIF.c file which contains a switch statement, switching on the value of 'CurrentSigInd'.
The type is 'DEC' for decimal or 'HEX' for hexadecimal values.


Related Topics:


Signal Dictionary