Long ago, in June of 2000, I wrote a standalone program to upload/download an ascii text channel list to/from the Icom IC-R2, an ancestor to the R6, which nevertheless looks very similar.
I remember the frequency encoding was strange, with lots of
special cases, including different encoding if the spacing was
.625 kHz, and handling of the MW band in a totally different
format depending on whether 9kHz or 10Khz spacing was being used,
and perhaps some other gotchas that have escaped me over the past
two and a half decades. But I believe I got the R2 frequency
handling solid. I distributed that software for free to a large
mailing list of R2 users, and after a few initial bug reports were
fixed (that had to do with things other than the frequency), it
was very stable.
I dug up my source code, and have just now posted it on the web,
at
https://ag6qr.net/priv/VmhNvUR7k8k92fQs7PfN/r2pepperSource.zip
It's written in C++. The meat of the frequency handling code is in the class CFrequency, which is declared in r2radio.h, with the member function definitions in r2radio.cpp.
The C++ class stores frequencies in an internal format consisting
as an integer number of kHz, plus flags saying whether it's spaced
in 62.5 kHz intervals, and whether it's a 9kHz spaced MW
frequency.
The key member functions are
CFrequency::setFromData, converts the raw data bytes from the radio's internal format into an integer number of kHz,
CFrequency::putToData, converts a frequency in integer kHz to the radio's internal data storage format
CFrequency::setFromAscii converts an Ascii buffer into the integer number internal representation
CFrequency::putToAscii converts the internal representation into an Ascii buffer.
I don't know if the R6 uses the same strange internal representation as the R2 did, but it sounds like there may be some common ground here. I don't have access to an R6.
It has been literally decades since I've touched this code, but I
remember writing it, and I just glanced over it, and it looks
reasonably familiar. I'll try my best to answer questions.
You're welcome to contact me privately off this list, because the
details of the internal representation of frequencies on these old
scanners may not be of general interest to the entire list. I
apologize, I haven't been actively participating in this list
recently, and I've missed many posts.
--Rich Cochran/AG6QR
Hi everyone,
Made progress with the Icom IC-R6, most things now coded, except for one rather important field (frequency).
One that's sorted just the device settings GUI to code before the first pull request, hopefully get some user feedback and test images at that stage.
Would appreciate some fresh eyes on the frequency encoding.