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:
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:
~/prog
.
~/prog/Code_VCi.pl
with i=1, 2, ... 8.
Apply
button overwrites the file
~/prog/Code_VCi.pl
and creates a new version, e.g.:
~/prog/Code_VCi_00007.pl
.
~/prog/Code_VCi.pl
is inserted into the during-scan macro
when a scan is started.
That means that the virtual counter
scripts may also be changed by an editor that is independent of
Online.