0
$\begingroup$

I would like to implement the example code from SigLib's example "fsk.c". The defines are below

#define SAMPLE_LENGTH                   ((SLArrayIndex_t)512)

#define NUMBER_OF_LOOPS                 4L

#define SAMPLE_RATE                     9600.0

#define BAUD_RATE                       1200.0
/* Number of samples per symbol */

#define SYMBOL_LENGTH                   ((SLArrayIndex_t)(SAMPLE_RATE / BAUD_RATE)) 

#define MAX_RX_STRING_LENGTH            ((SLArrayIndex_t)80)   
/* Frequency of sine wave in table */

#define CARRIER_TABLE_FREQ              ((SLData_t)100.0)       
/* Number of samples in each of cos and sine table */

#define CARRIER_SINE_TABLE_SIZE  ((SLArrayIndex_t)(SAMPLE_RATE / CARRIER_TABLE_FREQ))     
/* Must be an integer number of cycles */
/* Rx Filter length */

#define RX_FILTER_LENGTH    ((SLArrayIndex_t)((2 * SYMBOL_LENGTH) + 1)) 
/* Low carrier frequency */

#define FREQ_1300_HZ                    1300.0
/* High carrier frequency */

#define FREQ_2100_HZ                    2100.0
/* Carrier frequency for '0' */

#define CARRIER_FREQ_ZERO               FREQ_2100_HZ
/* Carrier frequency for '1' */

#define CARRIER_FREQ_ONE                FREQ_1300_HZ
/* Bandwidth of detection filter */

#define FILTER_BANDWIDTH                400.0

The initialization call to the function is this:

`SIF_FskModulate (pCarrierTable, (CARRIER_TABLE_FREQ / SAMPLE_RATE), CARRIER_SINE_TABLE_SIZE);`

In the code, the second parameter: (CARRIER_TABLE_FREQ / SAMPLE_RATE) is commented with: /* Carrier frequency */

This number works out to a fractional amount - 100.0/9600 = small. How is this used? What would the FSK carrier be set to, or is that determined by the rate at which you load the pData array into the DAC?

Can someone clarify what that means in terms of using this code?

Thank you!

$\endgroup$
0
$\begingroup$

The comment is mistaken. The carrier frequency is 100 Hz. The sample rate is 9600 Hz. The carrier frequency divided by the sample rate is the carrier phase increment (phase change per sample), not the carrier frequency. The units are radians / $2\pi$ (i.e. the phase increment is normalized from 0 to 1, not 0 to $2\pi$). That phase increment can be used to index into a sine table to create a sinusoid.

$\endgroup$
0
$\begingroup$

Calling this parameter "carrier frequency" is misleading, in the sense that it isn't the carrier frequency of the final FSK signal. The parameter (CARRIER_TABLE_FREQ / SAMPLE_RATE) is simply the inverse of the number of values in the sine table, and consequently - as correctly pointed out by Jim Clay - it is the phase increment per sample divided by $2\pi$.

The actual carrier frequency of the FSK signal is determined by CARRIER_FREQ_ZERO and CARRIER_FREQ_ONE. Usually, the FSK carrier frequency is defined as the average of these two frequencies (i.e. 1700 Hz in this example), with a frequency deviation of $\pm 400$ Hz, dependent on the source bit.

$\endgroup$
  • $\begingroup$ Matt, thank you (and Jim) for taking the time to answer. I don't know what your familiarity of this function is, but can you offer an opinion. Given that all parameters are correctly scaled, can this be used practically at very (very) low frequencies? I am talking sub-50Hz, at a very modest (whopping) 4 baud rate. It would be used for NFMI communications. Your thoughts...? $\endgroup$ – user10326 Jan 18 '15 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.