User manual
Demonstration
© 2011 Microchip Technology Inc. DS75019A-page 23
plm_demod_start()
This function starts the demodulator and configures the selected ADC channel, starts
the timer that triggers ADC conversions and optionally enables a DMA channel to ser-
vice the selected ADC input. Either DMA or ADC and timer interrupts get enabled. It is
mandatory to call this function before any calls to plm_recv() are made.
plm_demod_sync()
This function forces a demodulator resynchronization and may be called in cases when
the demodulator keeps indicating bit and byte synchronization, but higher protocol lay-
ers decide that the patterns received do not form valid frames, thus suggesting that the
byte synchronization is misaligned.
plm_xmit()
This function transmits a buffer and is a zero copy operation, meaning the pointer
passed is used to access payload bytes directly when needed. The operation is double
buffered, meaning the transmission of a previous buffer may already be in progress. In
all cases, the buffer passed is added to a single-entry wait queue and a TX_buffer_full
(PLM_TX_BF) flag is set. As soon as transmission becomes possible, the pointer is
copied to a working register and the TX_buffer_full flag is cleared. The application must
not write to the buffer that was passed until the modem code has finished sending. It is
possible to determine whether the buffer is still in use by examining the PLM_TX_BF
and PLM_TX_ACTIVE status flags. This function must not be called unless the
PLM_TX_BF flag is clear.
In addition, the application must generate a minimum of two preamble bytes before
sending any data bytes. This is required to synchronize the receiver with the data
transmission.
plm_recv()
This function fetches a received buffer. The two parameters passed are the address
and the size of a new buffer to fill in. The function returns an address within a previously
passed buffer, pointing to the first free location in that buffer. If the address returned is
equal to the previously passed buffer start address, no data has been received
between the calls. If the address returned points outside the buffer (at previous
buf+size), the buffer has been fully filled and could possibly overflow, if it was allowed.
A NULL pointer is returned on the very first call.
plm_get_status()
This function returns the following modem status flags:
• PLM_TX_ACTIVE – transmission is in progress
• PLM_TX_BF – transmit buffer is full
• PLM_BIT_SYNC – the receiver has found bit synchronization
• PLM_BYTE_SYNC – the receiver has found byte synchronization
• PLM_RESYNC – resynchronization has been requested
3.1.5 Resource Requirements
Any dsPIC33F DSC device with at least 2 Kbytes RAM, 16 Kbytes of Flash memory,
four Output Compare channels (PWM), one DMA channel, and one 10/12-bit ADC
input (500 ksps), can be used with the daughter board. Using dsPIC33F DSC devices
without the DMA feature will result in a higher processing power requirement for the
modem software, potentially starving the application of execution time. Also, using less
than four Output Compare channels will result in reduced operational range and per-
formance.