The following short program probes VME crate 0 for all HYTEC 2530 ADC modules. It uses the fact that offset 2 in the register space of these modules is a 16 bit register that contains the value 2530:
Example 5-4. Using VME Tcl to locate all 2530 modules
lappend auto_path [file join $env(DAQROOT) TclLibs]
package require Vme
# is there an ADC at 'base'?
proc is2530 {base {name hytec}} {
vme create $name -device standard $base 256
$value = [$name get -l 2]
vme delete $name
return [expr $value == 2530]
}
# Main program.
set modules [list]
for {set base 0} {$base < $f80000} {incr base 0x080000} {
if {[is2530 $base]} {
lappend modules $base
}
}
if {[llength $modules] > 0} {
puts "Found Hytec 2530 modules at: "
foreach addr $modules {
puts [format %0x6 $addr]
}
} else {
puts "No HYTEC 2530 modules found."
}