| 1 | package Lab::Instrument::WR640; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | #ABSTRACT: LeCroy WaveRunner 640 digital oscilloscope | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | $Lab::Instrument::WR640::VERSION = '3.881'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use v5.20; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Lab::Instrument; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Lab::SCPI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use English; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Time::HiRes qw(sleep); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Clone 'clone'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | our $DEBUG = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | our @ISA = ("Lab::Instrument"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | our %fields = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | supported_connections => ['VICP'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | #default settings for connections | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | connection_settings => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | connection_type => 'VICP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | remote_address => 'nulrs640', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | device_settings => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # too many characteristics can easily be "messed with" on the front | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # panel, so only allow changes when scope is "locked". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | device_cache => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | chan_cache => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | default_chan_cache => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | channel => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | chan_bwlimit => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | chan_coupling => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | chan_current_probe => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | chan_invert => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | chan_position => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | chan_probe => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | chan_scale => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | chan_yunit => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | select => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # non-front-panel cache items | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | NFP => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | HEADER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | VERBOSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | LOCKED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | shared_cache => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ID => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | HEADER => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | VERBOSE => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | LOCKED => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | channel => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # almost all of the WR640 command suite is non-SCPI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | scpi_override => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | foreach my $k ( keys( %{ $fields{default_chan_cache} } ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $fields{device_cache}->{$k} = $fields{default_chan_cache}->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | foreach my $k ( keys( %{ $fields{shared_cache} } ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $fields{device_cache}->{$k} = $fields{shared_cache}->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $self->{config}->{no_cache} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $self->{config}->{default_read_mode} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | $DEBUG = $self->{config}->{debug} if exists $self->{config}->{debug}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # initialize channel caches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | foreach my $ch (qw(C1 C2 C3 C4)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $self->{chan_cache}->{$ch} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | foreach my $k ( keys( %{ $self->{default_chan_cache} } ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | $self->{chan_cache}->{$ch}->{$k} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | = $self->{default_chan_cache}->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $self->{chan_cache}->{$ch}->{channel} = $ch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | foreach my $k ( keys( %{ $self->{shared_cache} } ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $self->{chan_cache}->{$ch}->{$k} = $self->{shared_cache}->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $self->{device_cache} = $self->{chan_cache}->{C1}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $self->{channel} = "C1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | #initialize scope.. this means setting up status bit masking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | #for non-destructive testing for device errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | sub _device_init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_device_init: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $self->write("*ESE 60") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | ; # 0x3C -> CME+EXE+DDE+QYE to bit 5 of SBR (read with *STB?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $self->write("*CLS"); # clear status registers | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | { # keep perl from bitching about this stuff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 1 | ▶ | no warnings qw(redefine); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # calling argument parsing; this is an extension of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | # _check_args and _check_args_strict routines in Instrument.pm, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # allowing more flexibility in how routines are called. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # In particular routine(a=>1,b=>2,..) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # routine({a=>1,b=>2,..}) can both be used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # note: if this code does not properly recognize the syntax, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # then you have to use the {key=>value...} form. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # calling: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # ($par1,$par2,$par3,$tail) = $self->_Xcheck_args(\@_,qw(par1 par2 par3)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # or, for compatibility: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # ($par1,$par2,$par3,$tail) = $self->_Xcheck_args(\@_,[qw(par1 par2 par3)]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | sub Lab::Instrument::_check_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_args: not called CC=16 SCAR=56.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $params = [@_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | $params = $params->[0] if ref( $params->[0] ) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $arguments = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if ( $#{$args} == 0 && ref( $args->[0] ) eq 'HASH' ) { # case 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$#{$args;} == 0 and ref $args->[0] eq "HASH"
MC/DC0%0/2
$#{$args;} == 0 and ref $args->[0] eq "HASH"
$#{$args;} == 0
ref $args->[0] eq "HASH"
Truth table0%0/3
A and B
A= $#{$args;} == 0B= ref $args->[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | %{$arguments} = ( %{ $args->[0] } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $simple = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if ( $#{$args} & 1 == 1 ) { # must have even # arguments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | my $found = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | for ( my $j = 0; $j <= $#{$args}; $j += 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ( ref( $args->[$j] ) ne '' ) { # a ref for a key? no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $simple = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | foreach my $p ( @{$params} ) { # named param | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | $simple = 0 if $p eq $args->[$j]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if ( exists( $found->{ $args->[$j] } ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | { # key used 2x? no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $simple = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $found->{ $args->[$j] } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if ($simple) { # case 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | foreach my $arg ( @{$args} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | if ( defined @{$params}[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $arguments->{ @{$params}[$i] } = $arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | else { # case 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | %{$arguments} = ( @{$args} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my @return_args = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | foreach my $param ( @{$params} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if ( exists $arguments->{$param} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | push( @return_args, $arguments->{$param} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | delete $arguments->{$param}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | push( @return_args, undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | push( @return_args, $arguments ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return @return_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | return $return_args[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | sub Lab::Instrument::_check_args_strict { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_args_strict: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $params = [@_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | $params = $params->[0] if ref( $params->[0] ) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my @result = $self->_check_args( $args, $params ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my $num_params = @result - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | for ( my $i = 0; $i < $num_params; ++$i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | if ( not defined $result[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | croak("missing mandatory argument '$params->[$i]'"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | return @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | return $result[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # utility function: check header/verbose and parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # query reply appropriately; remove quotes in present | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # ex: $self->_parseReply('ACQ:MODE average',qw{AVE PEAK SAM}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | # gives AVE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 1 | sub _parseReply { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parseReply: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $in = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | my $h = $self->get_header(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | if ($h) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ( $c, $in ) = split( /\s+/, $in ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | return '' unless defined($in) && $in ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $in and $in ne ""
MC/DC0%0/2
defined $in and $in ne ""
defined $in
$in ne ""
Truth table0%0/3
A and B
A= defined $inB= $in ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | # remove quotes on strings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | if ( $in =~ /^\"(.*)\"$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $in = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $in =~ s/\"\"/"/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | elsif ( $in =~ /^\'(.*)\'$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $in = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $in =~ s/\'\'/'/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | return $in unless $#_ > -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $v = $self->get_verbose(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | return $in unless $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | return _keyword( $in, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | # select keyword | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # example: $got = _keyword('input', qw{ IN OUT EXT } ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # returns $got = 'IN' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | sub _keyword { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | my $in = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_keyword: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | $in = shift if ref($in) eq 'HASH'; # dispose of $self->_keyword form... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | my $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $in =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | foreach my $k (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | if ( $in =~ /^$k/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | return $k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | Lab::Exception::CorruptParameter->throw("Invalid keyword input '$in'\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | # convert 'short form' keywords to long form | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | sub _bloat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | my $in = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bloat: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | $in = shift if ref($in) eq 'HASH'; # dispose of $self->_bloat | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my $tr = shift; # hash of short=>long: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $in =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $in =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | return $in if $in eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | foreach my $k ( keys( %{$tr} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | if ( $in =~ /^${k}/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | return $tr->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | return uc($in); # nothing matched | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | # parse a GPIB number with suffix, units | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # $result = _parseNRf($numberstring,$unit1[,$unit2,...]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # _parseNRf('maximum','foo) -> 'MAX' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | # _parseNRf('-3.7e+3kJ','j') -> -3.7e6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # _parseNRf('2.3ksec','s','sec') -> 2300 ('s' and 'sec' alternate units) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # note special cases for suffixes: MHZ, MOHM, MA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # also handling 'dB' -> (number)dB(magnitudesuffix)(unit V|W|etc) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # if problem, string returned starts 'ERR: ..message...' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | # see IEEE std 488-2 7.7.3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | sub _parseNRf { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | my $in = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parseNRf: not called CC=43 SCAR=75.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | $in = shift if ref($in) eq 'HASH'; # $self->_parseNRf handling... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my $un = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | $un = '' unless defined $un; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $us; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if ( ref($un) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $us = $un; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | elsif ( ref($un) eq 'SCALAR' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $us = [ $$un, @_ ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | elsif ( ref($un) eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | $us = [ $un, @_ ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $str = $in; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | $str =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $str =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | if ( $str =~ /^MIN/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return 'MIN'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if ( $str =~ /^MAX/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | return 'MAX'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $mant = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | my $exp = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | if ( $str =~ /^([+\-]?(\d+\.\d*|\d+|\d*\.\d+))\s*/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $mant = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | $str = $POSTMATCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | return $mant if $str eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if ( $str =~ /^e\s*([+\-]?\d+)\s*/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $exp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $str = $POSTMATCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | return $mant * ( 10**$exp ) if $str eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $kexp = $exp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my $kstr = $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | foreach my $u ( @{$us} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $u =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $u =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $str = $kstr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $exp = $kexp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | if ( $u =~ /^db/i ) { # db(magnitude_suffix)?(V|W|... unit)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my $dbt = $POSTMATCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | if ( $str =~ /^dBex(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 12 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $exp += 18; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | elsif ( $str =~ /^dBpe(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | $exp += 15; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | elsif ( $str =~ /^dBt(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $exp += 12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | elsif ( $str =~ /^dBg(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $exp += 9; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | elsif ( $str =~ /^dBma(${dbt})$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $exp += 6; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | elsif ( $str =~ /^dBk(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $exp += 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | elsif ( $str =~ /^dBm(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $exp -= 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | elsif ( $str =~ /^dBu(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $exp -= 6; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | elsif ( $str =~ /^dBn(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | $exp -= 9; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | elsif ( $str =~ /^dBp(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $exp -= 12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | elsif ( $str =~ /^dBf(${dbt})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | $exp -= 15; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | elsif ( $str =~ /^dB${dbt}$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $exp += 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | else { # regular units stuff: (magnitude_suffix)(unit)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | if ( $str =~ /^ex(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 14 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | $exp += 18; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | elsif ( $str =~ /^pe(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $exp += 15; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | elsif ( $str =~ /^t(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $exp += 12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | elsif ( $str =~ /^g(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | $exp += 9; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | ▶ | elsif ( $u =~ /(HZ|OHM)/i && $str =~ /^ma?(${u})$/i ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$u =~ /(HZ|OHM)/iu and $str =~ /^ma?($u)$/iu
MC/DC0%0/2
$u =~ /(HZ|OHM)/iu and $str =~ /^ma?($u)$/iu
$u =~ /(HZ|OHM)/iu
$str =~ /^ma?($u)$/iu
Truth table0%0/3
A and B
A= $u =~ /(HZ|OHM)/iuB= $str =~ /^ma?($u)$/iu
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $exp += 6; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | ▶ | elsif ( $u =~ /A/i && $str =~ /^ma$/i ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$u =~ /A/iu and $str =~ /^ma$/iu
MC/DC0%0/2
$u =~ /A/iu and $str =~ /^ma$/iu
$u =~ /A/iu
$str =~ /^ma$/iu
Truth table0%0/3
A and B
A= $u =~ /A/iuB= $str =~ /^ma$/iu
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $exp -= 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | ▶ | elsif ( $u !~ /(HZ|OHM)/i && $str =~ /^ma(${u})?$/i ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $u =~ /(HZ|OHM)/iu and $str =~ /^ma($u)?$/iu
MC/DC0%0/2
not $u =~ /(HZ|OHM)/iu and $str =~ /^ma($u)?$/iu
not $u =~ /(HZ|OHM)/iu
$str =~ /^ma($u)?$/iu
Truth table0%0/3
not(A) and B
A= not $u =~ /(HZ|OHM)/iuB= $str =~ /^ma($u)?$/iu
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $exp += 6; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | elsif ( $str =~ /^k(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $exp += 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | elsif ( $str =~ /^m(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | $exp -= 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | elsif ( $str =~ /^u(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $exp -= 6; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | elsif ( $str =~ /^n(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | $exp -= 9; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | elsif ( $str =~ /^p(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | $exp -= 12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | elsif ( $str =~ /^f(${u})?$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $exp -= 15; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | elsif ( $str =~ /^${u}$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $exp += 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | return $mant * ( 10**$exp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | return "ERR: '$str' number parsing problem"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | sub reset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | $self->write("*RST"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | $self->_debug(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $self->_reset_cache(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 1 | our $_rst_state = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | LOCKED => 'NON', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | HEADER => '1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | VERBOSE => '1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | sub _reset_cache { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reset_cache: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | for my $k ( keys( %{$_rst_state} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $self->{device_cache}->{$k} = $_rst_state->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | for ( my $ch = 1; $ch <= 4; $ch++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | $self->{chan_cache}->{"CH$ch"}->{select} = ( $ch == 1 ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | next if "CH$ch" eq $self->{channel}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | $self->{chan_cache}->{"CH$ch"}->{$k} = $_rst_state->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | $self->{device_cache}->{select} = ( $self->{channel} eq 'CH1' ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | foreach my $wfm (qw(MATH REFA REFB REFC REFD)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $self->{chan_cache}->{$wfm}->{select} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | # print error queue; meant to be called at end of routine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # so uses 'caller' info to label the subroutine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | sub _debug { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | return unless $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_debug: not called CC=3 SCAR=24.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | my ( $p, $f, $l, $subr ) = caller(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my ( $code, $msg ) = $self->get_error(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | last if $code == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | print "$subr\t$code: $msg\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | sub get_error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_error: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $err = $self->query("CHL? CLR"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $err =~ s/^(CHL\s*)?\"(.*)\"/$2/is; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | my (@lines) = split( /\n/, $err ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | my (@elines) = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | foreach my $x (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | $x =~ s/^\s*(.*)\s*$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | next if $x =~ /^connection\s/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | next if $x =~ /^disconnect/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | push( @elines, $x ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | return (@elines); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 1 | our $sbits = [qw(OPC RQC QYE DDE EXE CME URQ PON)]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | sub get_status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_status: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | my $bit = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | my $s = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | my $r = $self->query('*ESR?'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | $self->_debug(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | for ( my $j = 0; $j < 7; $j++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | $s->{ $sbits->[$j] } = ( $r >> $j ) & 0x01; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | $s->{ERROR} = $s->{CME} | $s->{EXE} | $s->{DDE} | $s->{QYE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | return $s->{ uc($bit) } if defined $bit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | return $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | sub test_busy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test_busy: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | return 1 if $self->query('BUSY?') =~ /^(:BUSY )?\s*1/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | sub get_id { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_id: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | $tail->{read_mode} = $self->{config}->{default_read_mode} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | unless exists( $tail->{read_mode} ) && defined( $tail->{read_mode} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $tail->{"read_mode"} and defined $tail->{"read_mode"}
MC/DC0%0/2
exists $tail->{"read_mode"} and defined $tail->{"read_mode"}
exists $tail->{"read_mode"}
defined $tail->{"read_mode"}
Truth table0%0/3
A and B
A= exists $tail->{"read_mode"}B= defined $tail->{"read_mode"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | if ( $tail->{read_mode} ne 'cache' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tail->{"read_mode"} ne "cache" or not defined $self->{"device_cache"}{"ID"}
MC/DC0%0/2
$tail->{"read_mode"} ne "cache" or not defined $self->{"device_cache"}{"ID"}
$tail->{"read_mode"} ne "cache"
not defined $self->{"device_cache"}{"ID"}
Truth table0%0/3
A or not(B)
A= $tail->{"read_mode"} ne "cache"B= not defined $self->{"device_cache"}{"ID"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | || !defined( $self->{device_cache}->{ID} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | $self->{device_cache}->{ID} = $self->query('*IDN?'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | $self->_debug(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | return $self->{device_cache}->{ID}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | sub recall { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recall: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | my ( $mem, $tail ) = $self->_check_args( \@_, 'n' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | my $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | if ( $mem =~ /^\s*([0-6])\s/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | $n = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | carp("recall memory n=$mem invalid, should be 0..6"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | $self->write("*RCL $n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | sub get_setup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_setup: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | my (@a) = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | foreach my $ch (qw(C1 C2 C3 C4 EX EX10 ETM10 LINE)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | ▶ | if ( $ch =~ /C\d/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | foreach my $q (qw(ATTN CPL OFST OFCT TRA TRCP VDIV)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | push( @a, $self->query( $ch . ':' . $q . '?' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | if ( $ch ne 'LINE' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | push( @a, $self->query( $ch . ":TRLV?" ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | push( @a, $self->query( $ch . ":TRSL?" ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | for ( my $j = 1; $j <= 8; $j++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | my $ch = "F$j"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | foreach my $q (qw(TRA VMAG VPOS)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | push( @a, $self->query( $ch . ":" . $q . "?" ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | foreach my $ch (qw(M1 M2 M3 M4)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | push( @a, $self->query( $ch . ":VPOS?" ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | foreach my $q ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | qw(ALST BWL COUT CMR COMB CFMT CHDR CORD CRMS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | ILVD RCLK SCLK SEQ TDIV TRDL TRMD TRPA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | TRSE WFSU) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | push( @a, $self->query( $q . '?' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | return (@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | sub get_visible { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_visible: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | my $ch = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | my $r = $self->query("$ch:TRA?"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | $r =~ s/^.*:TRA(ce)?\s+//i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | $r = uc($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | return 1 if $r eq 'ON'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | sub get_waveform { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_waveform: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | my $ch = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | return $self->query("$ch:WF?"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | Lab::Instrument::WR640 - LeCroy WaveRunner 640 digital oscilloscope | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | version 3.881 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | use Lab::Instrument::WR640; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | my $s = new Lab::Instrument::WR640 ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | address => '192.168.1.1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | Many of the 'quantities' passed to the code can use scientific | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | notation, order of magnitude suffixes ('u', 'm', etc) and unit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | suffixes. The routines can be called using positional parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | (check the documentation for order), or with keyword parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | There are a few 'big' routines that let you set many parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | in one call, use keyword parameters for those. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | In general, keywords passed TO these routines are case-independent, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | with only the first few characters being significant. So, in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | example above: state=>'Run', state=>'running', both work. In cases | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | where the keywords distinguish an "on/off" situation (RUN vs STOP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | for acquistion, for example) you can use a Boolean quantity, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | again, the Boolean values are flexible: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | TRUE = 't' or 'y' or 'on' or number!=0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | FALSE = 'f' or 'n' or 'off' or number ==0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | (only the first part of these is checked, case independent) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | The oscilloscope input 'channels' are CH1..CH4, but | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | there are also MATH, REFA..REFD that can be displayed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | or manipulated. To perform operations on a channel, one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | should first $s->set_channel($chan); Channel can be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | specified as 1..4 for the input channels, and it will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | be translated to 'CH1..CH4'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | The state of the TDS2024B scope is cached only when the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | front-panel is in a 'locked' state, so that it cannot be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | changed by users fiddling with knobs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | =head1 GENERAL/SYSTEM ROUTINES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | my $s = new Lab::Instrument::TDS2024B( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | usb_serial => '...', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | serial only needed if multiple TDS2024B scopes are attached, it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | defaults to '*', which selects the first TDS2024B found. See | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | Lab::Bus::USBtmc.pm documentation for more information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | =head2 reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | $s->reset() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | Reset the oscilloscope (*RST) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | =head2 get_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | ($code,$message) = $s->get_error(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | Fetch an error from the device error queue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | =head2 get_status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | $status = $s->get_status(['statusbit']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | Fetches the scope status, and returns either the requested | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | status bit (if a 'statusbit' is supplied) or a reference to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | a hash of status information. Reading the status register | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | causes it to be cleared. A status bit 'ERROR' is combined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | from the other error bits. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | Example: $s->get_status('OPC'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | Example: $s->get_status()->{'DDE'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | Status bit names: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | B<PON>: Power on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | B<URQ>: User Request (not used) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | B<CME>: Command Error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | B<EXE>: Execution Error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | B<DDE>: Device Error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | B<QYE>: Query Error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | B<RQC>: Request Control (not used) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | B<OPC>: Operation Complete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | B<ERROR>: CME or EXE or DDE or QYE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | =head2 test_busy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | $busy = $s->test_busy(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | Returns 1 if busy (waiting for trigger, etc), 0 if not busy. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | =head2 get_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | $s->get_id() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | Fetch the *IDN? string from device | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | =head2 recall | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | $s->recall($n); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | $s->recall(n => $n); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | Recall setup 0..6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | This software is copyright (c) 2023 by the Lab::Measurement team; in detail: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | Copyright 2016 Charles Lane | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 2017 Andreas K. Huettel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 2020 Andreas K. Huettel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||