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$

3 Answers 3

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
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$
1
  • $\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, 2015 at 17:04
0
$\begingroup$

As per your earlier question, my apologies for not replying before now but I didn't realize there were any SigLib questions on here. I know it has been a long time but I don't like threads that I should respond to to be left unanswered. I'm sure you've moved on by now but I figured there is no harm in answering your question.

Thank you very much to Matt and Jim for answering your question and clarifying that this is an error in the comment and it should, indeed, be "Carrier phase increment per sample", not "Carrier frequency". Thank you for reporting, I will ensure that this is fixed in the next release.

To answer your follow up question, regarding "can this be used practically at very (very) low frequencies". I don't see any reason why not but depending on the SNR you may find a PSK or QAM signal to perform better.

If you need any further assistance then please do not hesitate to contact me through the Numerix-DSP website. Best regards, John

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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