[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [linrad] Frequency control

Hi, Leif!

I have a question about this:

> It would be trivial to replace this routine by something else 
> that could use any hardware port that one can get permission 
> to write to under Linux. If you know Linux well enough to use 
> the drive routines for serial or parallel ports you can make 
> a far more clever solution than the onew I have put into Linrad now.

I wrote a short routine to write to the serial port and put it in

Will it get executed repeatedly at some interval?

Should I put my open and close statements for the port in hwaredriver.c
as I did, or elsewhere?

How can I get the Hertz and decimal fractions of a Hertz value that
Linrad displays as the received frequency so that I can send it (with
appropriate prefix in MHZ and tenths of MHz) to the transceiver?

What keeps the frequency from jumping around when I am transmitting and
Linrad sees the transmitter frequency if I have AFC on?  There must be
be a way to lock the frequency in place.  I guess what I really want is
just the frequency I clicked on in the high resolution window;  I don't
want to play tag with the other station.  How to I grab that number for
my routine?

My routine is very simple ( and doesn't work, although it compiles
without errors):
/*added to your included*?
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>

/* text below put at the end of the other statements in hwaredriver */
int fd;
struct termios options;

int n;
fd=open("/dev/ttyS1",O_RDWR  | O_NOCTTY | O_NDELAY);
if (fd == -1)
perror("open_port: Unable to open /dev/ttyS1 - ");


/* set up port parameters */
options.c_cflag		|= (CLOCAL | CREAD);

/*  No parity */
options.c_cflag	&= ~PARENB;
options.c_cflag	&= ~CSTOPB;
options.c_cflag	&= ~CSIZE;
options.c_cflag	|= CS8;

tcsetattr(fd, TCSANOW,&options);

if (n<0)
fputs ("write() of 4 bytes failed!\n", stderr);

/* thatís it.  It should write "SW01;" to my Elecraft K2 and make the
band change, but it doesn't.  So I am wondering if the routine gets run
where I have it ;)

Thanks in advance, Leif, and 


Roger Rehr
W3SZ   FN20ah
2 Merrymount Road
Reading, PA  19609-1718