| (PRIMARY_ANALOG '<=' PRIMARY_ANALOG)
| (PRIMARY_ANALOG '>' PRIMARY_ANALOG)
| (PRIMARY_ANALOG '>=' PRIMARY_ANALOG)
UNARY_EXPR ::= RELATIONAL_ANALOG | PRIMARY_BOOLEAN | ('!'+ PRIMARY_BOOLEAN)
EQUALITY_EXPR ::= UNARY_EXPR (('==' UNARY_EXPR) | ('!=' UNARY_EXPR))*
AND_EXPR ::= EQUALITY_EXPR ('&&' EQUALITY_EXPR)*
XOR_EXPR ::= AND_EXPR ('^^' AND_EXPR)*
OR_EXPR ::= XOR_EXPR ('||' XOR_EXPR)*
EXPR ::= OR_EXPR
5.3. Setting events in IAR-EW and C-SPY
You will need to setup a C-SPY macro file. Please consult the IAR-EW
documentation for more information.
Use the __jlinkExecCommand() C-SPY macro with first argument
“extbkpt”
to set an external event expression. For example, if you want to halt the
target if it consumes more than 100mA write the following in your C-SPY
macro file:
execUserPreload() {
__jlinkExecCommand("extbkpt I_tgpwr>100");
}
If you want to halt the target if its voltage goes out of the [3.0V – 3.6V]
range then you can write a macro like this:
execUserPreload() {
__jlinkExecCommand("extbkpt !(3000<U_tg && U_tg<3600)");
}
The
vmeter
command can be used to get the current state of the event
inputs:
__jlinkExecCommand("vmeter");
An example output of this command is:
Fri Feb 06 13:18:53 2009: J-Link Exec Command: VMETER: U_tg=3.254000
V, U_aux=0.000000 V, U_tgpwr=4.885000 V, I_tgpwr=17.000001 mA, D1=1,
target power enabled and OK
Fri Feb 06 13:18:53 2009: Error in C:\MyProject\test.mac at line 9, col 23:
Operation error.
Fri Feb 06 13:18:53 2009: Error while calling macro execUserPreload
NOTE:
As seen above, IAR C-SPY reports an error when calling the vmeter
command. You can safely ignore it.