Device-GPIB
view release on metacpan or search on metacpan
lib/Device/GPIB/Tektronix/LA1240.pm view on Meta::CPAN
{
warn "Not a Tek 1240 Logic Analyzer at $self->{Address}: $self->{Id}";
return;
}
# These are actually event codes
$self->{ErrorStrings} = {
101 => 'Command header error',
102 => 'Header delimiter error',
103 => 'Command argument error',
104 => 'Argument delimiter error',
105 => 'Non-numeric Argument (numeric expected)',
106 => 'Missing argument',
107 => 'Invalid message unit delimiter',
108 => 'Binary block checksum error',
109 => 'Binary block byte count error',
121 => 'Illegal hex character',
122 => 'Unrecognised arument type',
123 => 'Argument too large',
124 => 'Non-binary Argument (binary or hex expected)',
201 => 'Remote Only command received while in local mode',
202 => 'Command aborted - change to local',
203 => 'I/O deadlock detected',
205 => 'Argument out of range',
206 => 'Group execute trigger ignored',
251 => 'Header/Location conflict in ACQMEM, REFMEM, INSETUP, or RAMPACK',
252 => 'System error (illegal command)',
253 => 'Integer overflow (range 0-65535)',
254 => 'RAM pack not installed',
255 => 'Illegal ROM pack command',
256 => 'REFMEM not compatible with ACQMEM',
257 => 'TEST command cannot be executed when RQS is off',
261 => 'Possible loss of data - change to local during upload',
262 => 'Acquisition terminated - change to local',
263 => 'Auto-run terminated - change to local',
264 => 'Key operation terminated - change to local',
265 => 'Conflict in SETUP memory',
266 => 'Data block location out of range',
267 => 'UNKNOWN CODE', # not in any of my documents
271 => 'Command too long',
401 => 'ONLINE (Power On)',
711 => 'Request ACQMEM upload',
712 => 'Request REFMEM upload',
713 => 'Request REFMEM download',
714 => 'Request SETUP upload',
715 => 'Request SETUP download',
721 => 'End of acquisition',
722 => 'End auto-run',
723 => 'End of KEY',
724 => 'End auto-run, memories equal',
725 => 'End auto-run, memories not equal',
731 => 'Diagnostics test complete',
};
return $self;
}
sub id($)
{
my ($self) = @_;
my $id = $self->sendAndRead('ID?');
if ($id eq 'STATUS 41') # restarted
{
$id = $self->sendAndRead('ID?');
}
return $id;
}
sub getEvent($)
{
my ($self) = @_;
return $self->sendAndRead('EV?');
}
# Get all events until 0 and return as an array
sub getEvents($)
{
my ($self) = @_;
my @ret;
while (1)
{
my $event = $self->getEvent();
my $eventnum = 0;
if ($event =~ /EVENT (\d+)/)
{
$eventnum = $1;
}
return @ret if $eventnum == 0;
push(@ret, $eventnum);
}
}
sub getEventsAsStrings($)
{
my ($self) = @_;
my @events = $self->getEvents();
return map $self->errorToString($_), @events;
}
sub remote($)
{
my ($self) = @_;
return 1 if !$self->isSerial(); # No equivalent in GPIB
return 1 if $self->{IsInRemoteMode};
my $result = $self->sendAndRead('REM'); # Only supported in Serial
if ($result ne 'READY')
{
print("remote: Unexpected reply: $result\n");
return 0;
}
$self->{IsInRemoteMode} = 1;
( run in 1.185 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )