⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 基于cc1010的设计实例
💻 C
字号:
/*****************************************************************************
 *                                                                           *
 *        **********                                                         *
 *       ************                                                        *
 *      ***        ***                                                       *
 *      ***   +++   ***                                                      *
 *      ***   + +   ***                                                      *
 *      ***   +                    CHIPCON CC1010 EXAMPLE PROGRAM            *
 *      ***   + +   ***               TX                                     *
 *      ***   +++   ***                                                      *
 *      ***       ***                                                        *
 *       ***********                                                         *
 *        *********                                                          *
 *                                                                           *
 *****************************************************************************
 * This program puts the CC1010 into TX mode and does not send data.         *
 * Separation should be set to 0 for good results.                           *
 *****************************************************************************
 * Author:              KHT                                                  *
 *****************************************************************************
 * Revision history:                                                         *
 *                                                                           *
 * $Log: main.c,v $
 * Revision 1.5  2004/01/12 16:44:52  tos
 * Cosmetic update/fix.
 *
 * Revision 1.4  2003/12/08 13:53:02  tos
 * Cosmetic fix on comment.
 *
 * Revision 1.3  2003/06/27 16:27:47  tos
 * Synchronised executables (hex-file) with library update:
 * Adjusted/tuned LOCK monitor delay in halRFSetRxTxOff()
 * in accordance with CC1000 datasheet.
 *
 * Revision 1.2  2003/05/12 11:14:09  tos
 * Changed fsep+pa.
 *
 * Revision 1.1  2002/12/02 14:11:11  kht
 * Added TX example
 *
 *                                                                           *
 ****************************************************************************/

#include <chipcon/reg1010.h>
#include <chipcon/cc1010eb.h>
#include <chipcon/hal.h>



void main() {

#ifdef FREQ868
// X-tal frequency: 14.745600 MHz
// RF frequency A: 868.277200 MHz	Rx
// RF frequency B: 868.277200 MHz	Tx
// RX Mode: Low side LO
// Frequency separation: 64 kHz
// Data rate: 2.4 kBaud
// Data Format: Manchester
// RF output power: 4 dBm
// IF/RSSI: RSSI Enabled

RF_RXTXPAIR_SETTINGS code RF_SETTINGS = {
    0x4B, 0x2F, 0x15,    // Modem 0, 1 and 2: Manchester
    //0x43, 0x2F, 0x15,    // Modem 0, 1 and 2: NRZ
    0x75, 0xA0, 0x00,    // Freq A
    0x58, 0x32, 0x8D,    // Freq B
    0x01, 0xAB,          // FSEP 1 and 0
    0x40,                // PLL_RX
    0x30,                // PLL_TX
    0x6C,                // CURRENT_RX
    0xF3,                // CURRENT_TX
    0x32,                // FREND
    0xFF,                // PA_POW => 4 dBm
    //0xA0,                // PA_POW => 0 dBm
    0x00,                // MATCH
    0x00,                // PRESCALER
    };
#endif


#ifdef FREQ915
// X-tal frequency: 14.745600 MHz
// RF frequency A: 915.027455 MHz	Rx
// RF frequency B: 915.027455 MHz	Tx
// RX Mode: Low side LO
// Frequency separation: 64 kHz
// Data rate: 2.4 kBaud
// Data Format: Manchester
// RF output power: 4 dBm
// IF/RSSI: RSSI Enabled

RF_RXTXPAIR_SETTINGS code RF_SETTINGS = {
    //0x4B, 0x2F, 0x15,    // Modem 0, 1 and 2: Manchester
    0x43, 0x2F, 0x15,    // Modem 0, 1 and 2: NRZ
    0xAA, 0x80, 0x00,    // Freq A
    0x5C, 0xF4, 0x02,    // Freq B
    0x01, 0xAB,          // FSEP 1 and 0
    0x58,                // PLL_RX
    0x30,                // PLL_TX
    0x6C,                // CURRENT_RX
    0xF3,                // CURRENT_TX
    0x32,                // FREND
    0xFF,                // PA_POW => 4 dBm
    //0xA0,                // PA_POW => 0 dBm
    0x00,                // MATCH
    0x00,                // PRESCALER
    };
#endif


#ifdef FREQ433

// X-tal frequency: 14.745600 MHz
// RF frequency A: 433.302000 MHz	Rx
// RF frequency B: 433.302000 MHz	Tx
// RX Mode: Low side LO
// Frequency separation: 64 kHz
// Data rate: 2.4 kBaud
// Data Format: Manchester
// RF output power: 0 dBm
// IF/RSSI: RSSI Enabled
RF_RXTXPAIR_SETTINGS code RF_SETTINGS = {
    //0x4B, 0x2F, 0x0E,    // Modem 0, 1 and 2: Manchester
    0x43, 0x2F, 0x0E,    // Modem 0, 1 and 2: NRZ
    0x58, 0x00, 0x00,    // Freq A
    0x41, 0xFC, 0x9C,    // Freq B
    0x02, 0x80,          // FSEP 1 and 0
    0x60,                // PLL_RX
    0x48,                // PLL_TX
    0x44,                // CURRENT_RX
    0x81,                // CURRENT_TX
    0x0A,                // FREND
    0xFF,                // PA_POW
    //0x40,                // PA_POW => 0 dBm
    0xC0,                // MATCH
    0x00,                // PRESCALER
    };

#endif

    // Calibration data
    RF_RXTXPAIR_CALDATA xdata RF_CALDATA;

    // Disable watchdog timer
    WDT_ENABLE(FALSE);

    // Set optimum settings for speed and low power consumption
    MEM_NO_WAIT_STATES();
    FLASH_SET_POWER_MODE(FLASH_STANDBY_BETWEEN_READS);

    // Calibrate
    halRFCalib(&RF_SETTINGS, &RF_CALDATA);

    // Turn on RF for TX
    halRFSetRxTxOff(RF_TX, &RF_SETTINGS, &RF_CALDATA);
    RF_START_TX();

    // Endless loop
    while (TRUE);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -