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 "g_count" to the watch window and confirm that the value of the variable is incremented using a break point. The "g_count" 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 " Config_CMT0_user.c " to display the source.

Select the variable "g_count" in the source code.

While "g_count" 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 g_count is 0.