Virtual Counters

Virtual counters appear in the Scan Device Selection widget (7.14). They can be selected like other counters. Virtual counters are pieces of Perl code that respond to the methods reset and read. Here is an example 7.15:

Figure 7.15: A Virtual Counter
Image vc1

The virtual counter code is used in the following way. It is inserted in the during-scan macro at two places. First in the section where all devices are resetted and second at the end where all the devices are read. Both times the code is taken as an argument of an eval Perl statement. In the first case Online includes the statement my $method = "reset"; in the second Online includes my $method = "read";.

How an error is raised: a virtual counter may return 0, of course. So this is no way to tell Online to interrupt the scan. Instead the user has to set the Spectra symbol INTERRUPT_SCAN. This is done in the following way:
$Spectra::SYM interrupt_scan = 1;.

For virtual counters the following statements apply:

Figure 7.16: The Virtual Counter File Menu
Image vc1_file

Figure 7.17: The Virtual Counter Versions
Image vc1_prog