ads

20 martie 2017

Kenwood AT-300 ATU to ICOM Radio - II

In a previous post I wrote about a devil plan to connect a Kenwood AT-300 Automatic antenna tuner to an ICOM 7300 radio.

Here is the connection diagram (again, by hand) and the final iteration of the code.




// This is a simple sketch to controll a Kenwood AT-300
// from an ICOM radio.
// Compatible with: IC-7000, IC-7100, IC-7200, IC-7300, IC-706, IC-703

/* See the schematic on http://yo3hjv.blogspot.com/2017/03/kenwood-at-300-atu-to-icom-radio-ii.html
*/

// This program is beer-ware (buy me a beer when you see me) and i will //appreciate
// March 2017, Adrian YO3HJV, rev 7.0
///////////////////////////////////////////////////////////////////////////////////

// Define input and output

// ICOM RADIO

  int KEY = 10;
  int START = 2;    // for ISR

// KENWOOD  AT 300 TUNER

  int TS = 11;
  int TT = 12;

// LED indicators for debugging

  int GREEN = 6;
  int YELL = 4;

// SOME VARIABLES for future development
  int Istart = 0;    // check if TUNE is issued by the ICOM radio. StandBy at 5V, goes LOW
  int Ktt = 0;       // check if Tuner Start is issued by the Kenwood ATU. StandBy at 5V, goes LOW
  unsigned long duration;  
///////////////////////////////////////


void setup()
{
// SETUP WHICH ARE OUTPUTS AND WHICH ARE INPUTS
    //LEDs
    pinMode(GREEN, OUTPUT);
    digitalWrite (GREEN, HIGH);
    pinMode(YELL, OUTPUT);
    digitalWrite (YELL, HIGH);

    //ICOM
    pinMode(START, INPUT_PULLUP);
    pinMode(KEY, OUTPUT);
    digitalWrite (KEY, HIGH);

    //KENWOOD
    pinMode(TT, INPUT_PULLUP);
    pinMode(TS, OUTPUT);
    digitalWrite (TS, HIGH);  
}


void loop(){  
 
     if (digitalRead(START) == LOW)  {
 
             Tune();          // Execute external function TUNE
             delay (500);
             StandBy ();      // Execute external function StandBy     
     }
}


   void Tune () { 
     do {
         digitalWrite (YELL, LOW); // Light LED
         digitalWrite (TS, LOW);   // init ATU
         delay(150);               // wait for ATU uC to reset
         digitalWrite (KEY, LOW);  // start Tx RF 
         delay(300);               // keep Tx RF for at least 300 msec 
     }         
          while (digitalRead(TT) == LOW) ;  // TUNE untill TT is HIGH again
          }


   void StandBy () {
            digitalWrite(KEY, HIGH);
            digitalWrite (TS, HIGH);
            digitalWrite (YELL, HIGH); // Shut down LED
            delay(500);
   }

Niciun comentariu:

Arhivă blog

OnLine logbook YO3HJV

www.hrdlog.net

Ham News