AN2274 Freescale Semiconductor / Motorola, AN2274 Datasheet - Page 16

no-image

AN2274

Manufacturer Part Number
AN2274
Description
Generic Tone Generation on the StarCore SC140 Core
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Using and Testing the Generic Tone Generator
3.3.1 DTMF Frequency Accuracy Test
The digital oscillator algorithm has reasonable frequency accuracy. The tests listed in Table 2 validate the use of
the digital oscillator algorithm for DTMF generation, showing that it complies with the requirements of the ITU-T
Recommendation Q.24 [6] for frequency accuracy. This test uses 4096 samples, generated with a –20 dBm0 level
(11 percent of maximum scale). The measured DTMF tone precision is smaller than 0.2 percent.
16
#include "fsl_tone_gen.h"
#define TBUFSZ 4096
#define DTMF
//#define MFR1
//#define MFR2
#ifdef DTMF
#define NUMBER_OF_TONES 16
#endif
#ifdef MFR1
#define NUMBER_OF_TONES 15
#endif
#ifdef MFR2
#define NUMBER_OF_TONES 30
#endif
void test_pgm ()
{
fract16 samples[TBUFSZ];
#pragma align samples 8
}
Example 8. Driver for Generating Time Domain Samples Using ADSFS [5]
Generic Tone Generation on the StarCore™ SC140/SC1400 Cores, Rev. 1
char samples2[10];
Word32 txid; // to write samples in text files
char file_name[20];
int channel, len;
TONE_GENERIC testcases[NUMBER_OF_TONES];
GEN_CHANNEL gen_channel[1];
int flag;
test_initialize(testcases);
for (channel = 0; channel < NUMBER_OF_TONES; channel++) {
}
// Opens a file
sprintf(file_name,"c:\\gen_out%d.dat",channel);
txid = open_file (file_name, WRITEONLY);
if (txid <= 0)
// Tone generation
fsl_tone_gen_init (gen_channel, &testcases[channel]);
flag = fsl_tone_gen (gen_channel, samples, TBUFSZ);
// Saves samples
for (len=0; len<TBUFSZ; len++) {
}
close_file (txid);
error (1);
write_file(txid,(unsigned char *)samples2,
sprintf(samples2,"%d\n",samples[len]));
Freescale Semiconductor

Related parts for AN2274