Read Operating Frequency from IC-7410

freqnow

Now gathering information from IC-7410.

gboolean freq_read( gpointer data ) {
  int outputcount = 6;
  static char command1[6] = {0xfe, 0xfe, 0x80, 0xe0, 0x03, 0xfd}; /* Read Operating Freq */
  unsigned char buf[255];
  int res;
  char string[128];
  double freq;

  write(fd, &command1, outputcount);
  while( (res = read(fd,buf,255)) !=11 ) {
   ;
  }
/* freq data in buf[8]-[5] */
   sprintf(string, "%02x%02x%02x%02x", buf[8],buf[7],buf[6],buf[5]);
   freq = (double) atoi(string) / 1000.0;
   g_print("freq is now %10.3f kHz \n", freq);
  return TRUE; /* MUST return TRUE */
}

I am not checking the response from IC-7410 strictly, just observing if its length is as expected or not.

/* main() */
    g_timeout_add( (guint) 250, (GSourceFunc) freq_read, (gpointer) "test" );

freqdisplay

Getting S-meter level should be likewise. The rest of the problem is how you can generate nice looking displays out of just numbers. (The above figure from grig.)

Leave a Reply

Your email address will not be published. Required fields are marked *