Pages: [1]   Go Down
Author Topic: Un-twisting a 1200 baud modem tone (NCO)  (Read 891 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a Numerically Controlled Oscillator (NCO) that's producing 1200 and 2200Hz tones, but I need to generate the 2200Hz tone a few db's stronger than the 1200Hz to cancel the "twist" in the radios.  Can anyone suggest an easy and efficient way of doing this?

I have plenty of RAM available, and should be able to create a second sine table with smaller values, but will switching back and forth between the two tables suddenly cause extra noise?

Zack
Logged

0
Offline Offline
Faraday Member
**
Karma: 7
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
will switching back and forth between the two tables suddenly cause extra noise?
Yes, and if this is packet it won't work anyway.  Bell 202 requires phase continuity, which means the next tone begins at the same place on the curve (same phase angle) that the previous one ends.

-j
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe I'm mis-understanding the NCO, but it seems like the phase should be maintained.  I'm thinking of two arrays, such as the following (ultra-simplified) example:

Code:
//      Phase:          0   45   90  135  180  225  270  315
byte arySineHigh[] = {127, 217, 255, 217, 127,  39,   0,  39} //full "volume"
byte arySineLow[]  = {127, 198, 227, 198, 127,  56,  27,  56} //reduced "volume"

...

//TIMER1_OVF_vect
ISR(TIMER1_COMPA_vect) {

   if (bToneHigh) {
  analogWrite(PIN_AUDIO_OUT, arySineHigh[highByte(iTonePhase)]);
  iTonePhase += TONE_HIGH_STEPS_PER_TICK;
  } else {
  analogWrite(PIN_AUDIO_OUT, arySineLow[highByte(iTonePhase)]);
    iTonePhase += TONE_LOW_STEPS_PER_TICK;
  }
}

Using this example, it just seems like there's going to be a pretty good bump when, say, we go from the Low Tone at 45 degrees (198) to the high tone at 90 degrees (255).  Maybe I'm just over thinking the problem, but I'm a bit lost on how to even test this theory.
Logged

0
Offline Offline
Faraday Member
**
Karma: 7
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
it just seems like there's going to be a pretty good bump when, say, we go from the Low Tone at 45 degrees (198) to the high tone at 90 degrees (255).
That may be because your example is a bit too simplified.  more resolution may help.

FYI, analogWrite() does not do an analog write; it does PWM.  You'll probably have to use multiple digital outs and an R2R ladder, along with some caps to smooth it out.

Check out the WhereAVR to see how it's done.

-j
Logged

Pages: [1]   Go Up
Jump to: