A watch expression can be any legal C expression, with exception of the ternary '?' operator. Here are some examples of legal expressions:
c variable 'c'
a third element of array 'a'
a[c+3]*2 can you figure it out?
The expression syntax has been extended to allow usage of registers and absolute memory locations in expressions:
•use the '@' prefix to specify a register by the register name:
@IX register IX
•use the '@' prefix to specify full path to a register. This allows display of SFRs with identical names belonging to different CPU modules:
@"PCU Power Control Unit"\PCU_PCONF0
•use the '@' prefix to specify full path to a bit field:
@"PCU Power Control Unit"\PCU_PCONF0\STBY0
Same syntax can be used to access SFR registers via isystem.connect. Alternatively to typing full SFR path, either SFR or a specific bit field can be dragged from the SFR view to the watch window. Full path will be automatically added to the watch window.
•use the ':' prefix to access absolute memory. If the CPU has more than one memory area, use memory area specifier before the colon:
:0x1000 byte on address 1000h
XDATA:0x30 byte on XDATA 30h
•use the '`' prefix to access I/O module pins. Note that the character is a grave accent (ASCII code 96), not an apostrophe:
`DIN.DIN0 Value on DIN.DIN0 pin
Note that I/O module pins can be renamed in the Hardware / Options / I/O tab and in such case the new user-defined names must be used (e.g. DIN.myPinName).
Overriding default scope
The ANSI C expression evaluator was extended to allow accessing static variables (file or function scope) even when program execution is out of the relevant scope. The syntax is as follows:
To access a variable that is static on a file scope:
<module name>#<var name>
To access gs_byCount variable in the TESTFILE module
To access a variable that is static on a function scope:
<function name>##<var name>
To access s_byCount variable in the main function
Using several download files
If there are several download files in the workspace, the default file for debugging will be used to gather information on the variables added to the watch list.
To access a variable (for example iCounter) that is defined in a non-default download file (secondOutput.elf) use the following syntax: