the newer version of cgminer has some formula for this (all possible values)
static void anu_find_freqhex(void)
{
float fout, best_fout = opt_anu_freq;
int od, nf, nr, no, n, m, bs;
float best_diff = 1000;
anu_freqfound = true;
for (od = 0; od < 4; od++) {
no = 1 << od;
for (n = 0; n < 16; n++) {
nr = n + 1;
for (m = 0; m < 64; m++) {
nf = m + 1;
fout = 25 * (float)nf /((float)(nr) * (float)(no));
if (fabsf(fout - opt_anu_freq) > best_diff)
continue;
if (500 <= (fout * no) && (fout * no) <= 1000)
bs = 1;
else
bs = 0;
best_diff = fabsf(fout - opt_anu_freq);
best_fout = fout;
anu_freq_hex = (bs << 14) | (m << 7) | (n << 2) | od;
if (fout == opt_anu_freq) {
applog(LOG_DEBUG, "ANU found exact frequency %.1f with hex %04x",
opt_anu_freq, anu_freq_hex);
return;
}
}
}
}
opt_anu_freq = best_fout;
applog(LOG_NOTICE, "ANU found nearest frequency %.1f with hex %04x", opt_anu_freq,
anu_freq_hex);
}
if thats too hard to read, here's the converted snippet from ScalaMiner (also probably hard to read... also untested, sorry)
def getAntMinerFreq(freq: Double) = {
var bestDiff = 1000.0
var bestOut = freq
var exactFound = false
for {
od <- 0 until 4
no = 1 << od
n <- 0 until 16
nr = n + 1
m <- 0 until 64
nf = m + 1
fout = 25.0 * nf / (nr * no)
if math.abs(fout - freq) <= bestDiff
if !exactFound
} {
val bs = if(500 <= (fout * no) && (fout * no) <= 1000) 1 else 0
bestDiff = math.abs(fout - freq)
bestOut = fout
val freqVal = (bs << 14) | (m << 7) | (n << 2) | od;
if(freqVal == fout) {
exactFound = true
bestOut = fout
}
}
bestOut
}