debugger.Watch.SetValue


This function sets a variable value.

[Specification format]

debugger.Watch.SetValue(variableName, value)

[Argument(s)]

Argument

Description

variableName

Specify the variable name, register name, and I/O register name or SFR register name to set.

value

Specify the value to set.

[Return value]

If a variable value was set successfully: True

If there was an error when setting a variable value: False

[Detailed description]

-

This function sets the value specified by value in the variable, register, and I/O register or SFR register specified by variableName.

Caution

When a load module name or file name is specified as a variable (variableName), it needs to be enclosed in double quotation marks (" ") in some cases. See "CS+ Integrated Development Environment User’s Manual: Debug Tool" for details.

Example

When file name "C:\path\test.c" and variable "var" are specified

"\"C:/path/test.c\"#var"

Or

"\"C:\\path\\test.c\"#var"

[Example of use]

>>>debugger.Watch.GetValue("testVal")
128
>>>debugger.Watch.GetValue("testVal", WatchOption.Hexdecimal)
0x80
>>>debugger.Watch.GetValue("testVal", WatchOption.Binary)
0b10000000
>>>debugger.Watch.SetValue("testVal", 100)
True
>>>debugger.Watch.GetValue("testVal")
100
>>>debugger.Watch.GetValue("testVal", WatchOption.Hexdecimal)
0x64
>>>debugger.Watch.GetValue("testVal", WatchOption.Binary)
0b1100100
>>>debugger.Watch.SetValue("testVal", 0x256)
True
>>>debugger.Watch.GetValue("testVal", WatchOption.Hexdecimal)
0x256