Here is the connection diagram (again, by hand) and the final iteration of the code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
Later edit:
This is the final look after some work on a test PCB. I let the USB port accesible for future development: