System Console and Toolkit Tcl Command Reference Manual

ID 683101
Date 7/08/2024
Public
Document Table of Contents

1.1.133. monitor_set_callback

Description

Defines a TCL expression in a single string that will be evaluated after all the memories monitored by this service are read. Typically, this expression should be specified as a TCL procedure call with necessary argument passed in.

Usage

monitor_set_callback <service-path> <tcl command>

ReturnType

Nothing

Returns

no return value

Arguments

service-path
tcl command

Example

#
# Get monitor service
#
set service_path [get_service_paths monitor]

#
# Claim a monitor service
#
set monitor_path [claim_service monitor $service_path "my_lib" ""]

# Assume there is one device and one master
set master_path [lindex [get_service_paths master] 0]

#
# Define monitor service properties
#
monitor_set_interval $monitor_path 1000

monitor_set_callback $monitor_path [list example_callback_proc $monitor_path $master_path]

monitor_add_range $monitor_path $master_path 0x00 4
monitor_add_range $monitor_path $master_path 0x10 4

#TCL callback procedure for the monitor service
proc example_callback_proc {monitor_path master_path} {
	set w1 [monitor_read_data $monitor_path $master_path 0x00 4]
	set w2 [monitor_read_data $monitor_path $master_path 0x10 4]
	set i1 [monitor_get_read_interval $monitor_path $master_path 0x00 4]
	set i2 [monitor_get_read_interval $monitor_path $master_path 0x10 4]

	puts "0x00-0x03: $w1 ($i1 ms)"
	puts "0x10-0x13: $w2 ($i2 ms)"
}

#
# Activate the monitor service
#

monitor_set_enabled $monitor_path 1