#!/usr/bin/perl
use strict;
use Math::Round;
# SET PARAMETERS HERE
# Reference clock frequency in MHz
# 6.4 for T855-10
# 0.2 for T857-10
my $refClock = 12.8;
# Channel step size in MHz
my $channelStep = 0.01;
# 1 for a transmitter, 0 for a receiver.
my $transmitter = 0;
# Frequencies you want to get lines for
my @frequencies = (
439.900,
439.910,
439.920,
439.930,
439.940,
439.950,
439.960,
439.970,
439.980,
439.990,
);
##### NO USER SERVICABLE PARTS BELOW HERE #####
my $scalingFactor = 64 * $channelStep;
foreach my $frequency (@frequencies) {
my $target = $frequency;
if ($transmitter == 0) {
$target -= 45;
}
my $M = int($target / $scalingFactor);
$target -= $M * $scalingFactor;
my $A = round($target / $channelStep);
my $R = $refClock / ($channelStep * 2);
# Hex Conversion
my $MHex = $M << 2;
# Convert into a proper string
printf("0%01X 0%01X 0%01X ", $MHex & 0x00F, ($MHex >> 4) & 0x00F, ($MHex >>8) & 0x00F);
printf("0%01X 0%01X ", $A & 0x0F, $A >> 4);
printf("0%01X 0%01X 0%01X ", $R & 0x00F, ($R >> 4) & 0x00F, ($R >>8) & 0x00F);
printf("\t%.3d\t%.2d\t%.3f ", $M, $A, $frequency);
if($transmitter == 1) {
print "TX USING ";
} else {
print "RX USING ";
}
printf("%d KHZ STEPS", $channelStep * 1000);
print "\n";
}
No comments:
Post a Comment