The following piece of code shows how a DSO (digital sampling oscilloscope, LC584, LC424, etc.) is operated using the virtual counter interface.
#
# A virtual counter is defined by a piece of Perl code that responds to
# the methods 'reset' and 'read'. 'reset' is called after the other
# counters have been resetted, 'read' after the other counters have been read.
# In the following example a random number is returned, 'reset' is not needed:
#
if( $method =~ /reset/i)
{
return 1;
}
if( $method =~ /read/i)
{
Spectra::cls();
#
# "12" - read channel 1 and 2, can be "1", "2", "12", "123", "all"
# 1024 - the number of data points
# 1 - sparsing factor
# 0 - offset
#
Spectra::wf( "dso1", "12", 1024, 1, 0);
mkdir $SYM{ scan_name} if( ! -d $SYM{ scan_name});
my $dir = $ENV{ PWD};
chdir $SYM{ scan_name};
my $fname = "$SYM{ scan_name}_dso_s$SYM{ sindex}";
Spectra::gra_command( "set lc_dso_c1/com_5=\"Motor $SYM{scan_device} at $SYM{ position}\"");
Spectra::gra_command( "write/fio/y(lc_dso_c1)/y(lc_dso_c2) $fname");
chdir $dir;
}