#!/usr/local/bin/perl ## ## write_lla_function - set the value of an EAC DAC ## ## Usage: write_lla_function lla function ## Example write_lla_function eac1 3 22 ## ## Returned Data = ## LCCDDDZ = L -> LLA command message ## = CC -> 2 hex digits of channel number ## 0-5 lla channel ## = DDD -> 3 hex digits of data value 0-26 ## ## FxxxxxZ = bad command data ## bhimebau 9/13/04 - script creation use Socket; if (@ARGV != 3) { print "\nUSAGE: write_lla_function \n"; print "EXAMPLE: write_lla_function eac1 2 25\n"; print "Sets function 25 on lla 2 of eac1\n\n"; exit; } $eac=shift; $channel=shift; $function=shift; if (($channel>5)||($channel<0)) { print "error - channel number must be between 0 and 5\n"; exit; } if (($function<1)||($function>27)) { print "error - function must be between 1 and 27\n"; exit; } # Socket setup $iaddr = inet_aton("$eac") || die "no host: $eac"; $paddr = sockaddr_in("17000",$iaddr); $proto = getprotobyname("tcp"); socket(S,PF_INET,SOCK_STREAM,$proto) || die "socket: $!"; connect(S, $paddr) || die "connect: $!"; select(S); $|=1; select("stdout"); $lla_string=sprintf("L%02x%03xZ",$channel,$function); print S "$lla_string\n"; $result = ; close (S); print "$result";