Go Down

### Topic: Un-twisting a 1200 baud modem tone (NCO) (Read 1 time)previous topic - next topic

#### ZackC2

##### May 03, 2011, 02:59 am
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

#### kg4wsv

#1
##### May 03, 2011, 03:56 am
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

#### ZackC2

#2
##### May 04, 2011, 12:28 am
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: [Select]
`//      Phase:          0   45   90  135  180  225  270  315byte 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_vectISR(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.

#### kg4wsv

#3
##### May 05, 2011, 04:55 pm
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

Go Up

Please enter a valid email to subscribe