6
* Copyright 2009, Dave Freese, W1HKJ
13
static const char FT847name_[] = "FT-847";
14
static const char *FT847modes_[] =
15
{ "LSB", "USB", "CW", "CW-R", "AM", "FM", "CW-N", "CW-NR", "AM-N", "FM-N", NULL};
17
static const int FT847_mode_val[] =
18
{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x08, 0x82, 0x83, 0x84, 0x88 };
20
static const char FT847_mode_type[] =
21
{ 'L', 'U', 'L', 'U', 'U', 'U', 'L', 'U', 'U', 'U' };
23
//static const int FT847_def_bw[] = { 2, 2, 1, 1, 3, 2, 2, 3 };
24
//static const char *FT847widths_[] = { "300", "500", "2400", "6000", NULL};
25
//static const int FT847_bw_val[] = { 0, 1, 2, 3 };
27
RIG_FT847::RIG_FT847() {
30
// bandwidths_ = FT847widths_;
31
comm_baudrate = BR9600;
42
afreq = A.freq = B.freq = 14070000;
43
amode = A.imode = B.imode = 1;
50
// has_bandwidth_control =
52
has_ptt_control = true;
56
void RIG_FT847::init_cmd()
59
for (size_t i = 0; i < 5; i++) cmd[i] = 0;
62
void RIG_FT847::initialize()
65
sendCommand(cmd, 0); // CAT on
66
cmd[4] = 0x8E; // satellite mode off
69
showresp(WARN, HEX, "init", cmd, replystr);
72
bool RIG_FT847::get_info()
78
ret = waitN(5, 100, "get info", HEX);
80
afreq = fm_bcd(&replystr[ret - 5], 8)*10;
81
amode = replystr[ret - 1];
82
for (i = 0; i < 10; i++) if (FT847_mode_val[i] == amode) break;
90
long RIG_FT847::get_vfoA ()
100
void RIG_FT847::set_vfoA (long freq)
103
freq /=10; // 847 does not support 1 Hz resolution
104
cmd = to_bcd(freq, 8);
108
showresp(WARN, HEX, "set vfo A", cmd, replystr);
111
int RIG_FT847::get_modeA()
116
void RIG_FT847::set_modeA(int val)
120
cmd[0] = FT847_mode_val[val];
124
showresp(WARN, HEX, "set mode A", cmd, replystr);
127
long RIG_FT847::get_vfoB()
137
void RIG_FT847::set_vfoB(long freq)
140
freq /=10; // 847 does not support 1 Hz resolution
141
cmd = to_bcd(freq, 8);
145
showresp(WARN, HEX, "set vfo B", cmd, replystr);
148
void RIG_FT847::set_modeB(int val)
152
cmd[0] = FT847_mode_val[val];
156
showresp(WARN, HEX, "set mode B", cmd, replystr);
159
int RIG_FT847::get_modeB()
164
// Tranceiver PTT on/off
165
void RIG_FT847::set_PTT_control(int val)
168
if (val) cmd[4] = 0x08;
172
showresp(WARN, HEX, "set PTT", cmd, replystr);
175
int RIG_FT847::get_smeter()
180
int ret = waitN(1, 100, "get smeter", HEX);
182
sval = (replystr[ret - 1] & 0x1F) / 32.0;
186
int RIG_FT847::get_power_out()
191
int ret = waitN(1, 100, "get power", HEX);
193
fwdpwr = (replystr[ret - 1] & 0x1F) / 32.0;