Hi Josh and all,
KD7HGL (Josh Logan) wrote:
Since I have a ts-2000 I would be interested in seeing the source code.
Are you using the ts-2000 for RX or only TX? If you are using it for
RX how have you setup the radio.
73, JOSH KD7HGL
I will append below my file users_extra.c, which can be compiled
automatically when you make linrad.
The routine users_extra() displays the selected Linrad Rx frequency near
the bottom left of the screen. When I am using Linrad for JT65, the Rx
Frequency is always a rounded, even-kHz frequency such as 144.118. When
you click on the wide graph and this frequency changes, the new
frequency is used to set VFO_A on the TS-2000.
I have my TS-2000 set to use 4800 baud, because a program I use for HF
contesting uses that rate. I think the TS-2000 defaults to using 9600
baud, so you might want to change those statements accordingly. At 9600
baud you may also want to set the number of stop bits to 1.
If you want to see my changes to wide_graph.c (implementing the even-kHz
frequency setting) and screen.c (implementing "transmit blanking" on the
Linrad waterfalls), let me know and I will send them to you off list.
In my present setup I use the TS-2000 for Tx only.
-- 73, Joe, K1JT
#######################################################################
// users_extra.c
// Built on example code by ON5GN and SM5BSZ.
#include <time.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
extern float users_extra_update_interval;
void set_freq_ts2000(double freq);
void init_users_extra(void)
{
// This routine is called just before a receive mode is entered.
// Use it to set your own things from the keyboard.
// Set users_extra_update_interval to the highest rate at which
// you want your routines called.
// The users_extra routines will be called only when the CPU is idle
// and if the time interval you have specified is exceeded.
users_extra_update_interval=0.25;
}
void users_extra(void)
{
// Color codes:
//0 - black
//1 - blue
//2 - green
//3 - cyan
//4 - red
//5 - magenta
//6 - brown
//7 - grey
//8 - dark grey
//9 - light blue
//10 - light green
//11 - light cyan
//12 - light red
//13 - light magenta
//14 - yellow
//15 - white
char s[80];
double ts2000_freq;
static double ts2000_freq0=-999;
// Hide the mouse while we update the screen so it will
// not be destroyed by what we write.
hide_mouse(0,screen_width,0,text_height);
// Display frequency in MHz, rounded to nearest kHz:
ts2000_freq=floor(hwfreq-1.600); // Freq in kHz
sprintf(s,"Freq: %7.3f",0.001*ts2000_freq); // Display in MHz
settextcolor(14); // yellow
lir_text(1,59,s);
// Set TS-2000 to the (rounded) Rx frequency
ts2000_freq=1000.0*ts2000_freq; // Freq in Hz
if((ts2000_freq>144000000.0) & (ts2000_freq != ts2000_freq0)) {
set_freq_ts2000(ts2000_freq);
ts2000_freq0=ts2000_freq;
}
// Restore text color
settextcolor (7);
}
void set_freq_ts2000(double freq)
// Set TS-2000 VFO_A to freq (in Hz)
{
int fd1; // file descriptor for serial port
struct termios options; // port options
char ft[15]="";
fd1=0;
fd1=open("/dev/ttyS0",O_RDWR | O_NOCTTY | O_NDELAY);
if (fd1 == -1) {
perror("open_port: Unable to open /dev/ttyS0 - ");
}
else {
tcgetattr(fd1,&options); // Set parameters for serial port
cfsetispeed(&options,B4800); // Use 4800 baud because TR does
cfsetospeed(&options,B4800);
options.c_cflag|= (CLOCAL | CREAD); // CLOCAL: ignore modem status
lines
// CREAD: enable serial port input
options.c_cflag&= ~PARENB; // Parity: NONE
options.c_cflag|= CSTOPB; // Two stop bits
options.c_cflag&= ~CSIZE; // Clear CSIZE; then
options.c_cflag|= CS8; // set to 8 bits
options.c_oflag &= ~OPOST; // No post-processing of output
tcsetattr(fd1, TCSAFLUSH,&options);
// Freq in Hz; 11 digits, leading zeros, no decimal point, and
// trailing semicolon.
sprintf(ft, "FA%011.0f;", freq);
write(fd1, ft, 14); // Send command to TS-2000
close(fd1); // Close the serial port
}
}
#############################################################
This message is sent to you because you are subscribed to
the mailing list <linrad@antennspecialisten.se>.
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
To switch to the DIGEST mode, E-mail to <[EMAIL PROTECTED]>
To switch to the INDEX mode, E-mail to <[EMAIL PROTECTED]>
Send administrative queries to <[EMAIL PROTECTED]>