EasyManua.ls Logo

Agilent Technologies E8267C

Agilent Technologies E8267C
198 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
102 Chapter 2
Programming Examples
LAN Programming Examples
2. Save the code using the filename lanperl.
3. Run the program by typing perl lanperl at the UNIX term window prompt.
Setting the Power Level and Sending Queries Using PERL
#!/usr/bin/perl
# PROGRAM NAME: perl.txt
# Example of talking to the signal generator via SCPI-over-sockets
#
use IO::Socket;
# Change to your instrument's name
my $instrumentName = "xxxxx";
# Get socket
$sock = new IO::Socket::INET ( PeerAddr => $instrumentName,
PeerPort => 7777,
Proto => 'tcp',
);
die "Socket Could not be created, Reason: $!\n" unless $sock;
# Set freq
print "Setting frequency...\n";
print $sock "freq 1 GHz\n";
# Wait for completion
print "Waiting for source to settle...\n";
print $sock "*opc?\n";
my $response = <$sock>;
chomp $response; # Removes newline from response
if ($response ne "1")
{
die "Bad response to '*OPC?' from instrument!\n";
}

Table of Contents

Other manuals for Agilent Technologies E8267C

Related product manuals