Gordon Gibby
¿ªÔÆÌåÓýI would really like to be able to computer control the frequency of a bitx RADUINO -- this would potentially allow one of these rigs to be a WINLINK server [and it might need an amplifier, yeah, I know!]? but even more so, I believe I can use the RADUINO
to control older Heathkits and turn them into computer controllable rigs that are basically impervious to EMP.
I suspect that either someone has already done this, or many of you could do it much faster than I, but I have managed now to make the Raduino appear to be a Yaesu FT857d and respond to WINLINK frequency commands on 80 and 40 meter bands, issued at 9600
baud 8N1 via the usb port....??
It actually only took a small amount of code.? The problem was that I'm a simple doc & electrical engineer, and "packet binary coded decimal" representation of frequencies is not something I've ever thought much about before.....much less how to decode that
back into an Unsigned Long....so that added several hours + some compiler flakiness that might have been caused by me putting in all kinds of incorrect castings.? ?
I do not (yet) know how to deal with any "un-syncing" of five-byte words between computer and Raduino (a problem to be investigated on another day) but I'm just? "tickled pink"? that now I can pick a station in WINLINK EXPRESS?and bingo....the Raduino move
to the correct frequency.? ? ?RMS_EXPRESS should work very similarly.??
Cheers,
Gordon
// --------------------------TRY TWO TO DO CAT---------------------------
//? The minimum command we have to listen for is change frequency
//? 5 bytes:? ?MM MK KK HH? 01? ?is the command
//? where MMM are the megaherts? (eg? 01 4
//? and the KKK are the kilohertz? (eg? ?234?
//? so for example? ?01, 42, 345, 56, 01 means
//? change frequency to 14,234.56 kilohertz
void checkSerialData() {
? int packed;?
? int i = Serial.available();
? // Note that the internal buffer on the arduino can hold up to 64 bytes
? ? if (i < 5) return;
?// if you got here then there are at least 5 ints (?bytes?)? waiting: get it.
printLine(1, (char *)"5bytes");
? ? ? ? delay(10);
?
? ? for (i=0; i<5; i++) {
? ? ? ? receivedserial[i] = Serial.read();
? ? ? ? // Serial.read pulls exactly one byte
? ? }
? ? // now chek for the command in the last byte
? ? switch (receivedserial[4]) {
? ? ? ? printLine(1, (char *)"checkCMD");
? ? ? ? delay(10);
? ? ? ? ?
? ? ? ? case 1:
// frequency is in packed BCD; binary coded decimal;
// so left 4 bits give top decimal number 0-9? and right 4 bits give bottom decimal number 0-9
//? ? ? ? case CAT_FREQ_SET:
? ? ? ? ? ? // convert the 4 bytes of numbers (tens of MHz), (hundreds of kHz), (kHz), (tens of hz)
? ? ? ? ? frequency = 0UL;?
? ? ? ? ? packed = receivedserial[0];
? ? ? ? ? frequency =? ? ?10000000UL *? ?(unsigned long) ( ((packed & 0xF0)>>4 )* 10? +? ?(packed & 0x0F) ) ;
? ? ? ? ? packed = receivedserial[1];
? ? ? ? ? frequency = frequency +? 100000UL *? ?(unsigned long) ( ((packed & 0xF0)>>4 )* 10? +? ?(packed & 0x0F));
? ? ? ? ? packed = receivedserial[2];
? ? ? ? ? frequency = frequency + 1000UL *? ?(unsigned long) ( ((packed & 0xF0)>>4 )* 10? +? ?(packed & 0x0F));?
? ? ? ? ? packed = receivedserial[3];
? ? ? ? ? frequency = frequency -40 + 10UL *? (unsigned long) ( ((packed & 0xF0)>>4 )* 10? +? ?(packed & 0x0F));?
? ? ? ? ??
? ? ? ? ? ?
? ? ? ? ? ?setFrequency(frequency);
? ? ? ? ??
? ? ? ? ? ?delay(30);
??
? ? ? ? ? ? ? Serial.write(ACK);
? ? ? ? ? ? break;
? ? ? ?
? ? ? ? default:
? ? ? ? ? ? printLine(1, (char *)"Othercmd");
? ? ? ? ? ? delay(10);
? ? ? ? ? ? Serial.write(ACK);
? ? ? ? ? ? break;
? ? }
}? ???
|