Referring a Variable

Watch function

By registering a variable to the watch window, it is possible to display the value of that variable. In this section, you register a global variable called "count2" to the watch window and confirm that the value of the variable is incremented using a break point. The "count2" that is incremented every 500 milliseconds by using timer function is defined as a global variable.

Since the interrupt process functions peculiar to the embedded systems cannot have arguments, this variable is defined as a global variable so that other functions can share its value.

In the project tree, double click "main.c" to display the source.

Select the variable "count2" in the source code.

While "count2" is selected, right-click the mouse and select [Register to Watch1] from the menu.

This opens the Watch panel where you can confirm that the variable is now registered. The current value of count2 is 0.