📄 definitions.c
字号:
/*****************************************************************************
* *
* ********** *
* ************ *
* *** *** *
* *** +++ *** *
* *** + + *** *
* *** + CHIPCON CC1010 *
* *** + + *** FHP CONSTANTS *
* *** +++ *** *
* *** *** *
* *********** *
* ********* *
* *
*****************************************************************************
* This file contains settings that regulate the behaviour of the *
* Frequency Hopping Basic (FHP) and Frequency Hopping Protocol (FHP). *
* NOTE: This file must be included directly in the project and compiled. *
*****************************************************************************
* Author: OGR *
*****************************************************************************
* Revision history: *
* *
* $Log: Definitions.c,v $
* Revision 1.1 2003/07/29 11:24:47 tos
* Initial version in CVS.
*
*
* *
****************************************************************************/
#include <chipcon/cul.h>
// The maximal number of bytes that can be transmitted as a single packet
#define MAX_PACKET_LENGTH 100
// This struct specifies the settings of FHP
xdata FHP_SETTINGS fhpSettings = {
60, // period, the period in milliseconds between beacons
10, // overhead, the approximate time in milliseconds that passes from the chip is interrupted to the beacon is received
5, // slotSize, the time in milliseconds a slave uses to transmit a request to send a packet
2, // timeslots, the number of slotSize periods the master will listen for requests
1, // listenTime, the timeout in tenths of milliseconds when listening for beacons, packets and acknowledgements
TRUE, // useLEDs, whether status information is displayed on the LEDs on the evaluation board.
TRUE, // useAck, whether non-broadcasted packets are acknowledged.
14746 // clkFreq, the clock frequency of the main crystal oscillator of the chip in kilohertz
};
// This array specifies the frequency hopping sequence.
// The sequence should be random.
// The settings are obtained from SmartRF Studio.
code FHP_RXTXPAIR_SETTINGS rxtxpair_settings[]= {
// FreqA 2,1,0 FreqB 2,1,0 PLLR PLLT frequency
{ 0xC6,0xC0,0x00, 0x5B,0xAC,0x66, 0x68, 0x30 }, // 902.5MHz
{ 0xD8,0xC0,0x00, 0x5C,0xD4,0xD6, 0x70, 0x30 }, // 914MHz
{ 0x6C,0x60,0x00, 0x5C,0xE2,0x8D, 0x38, 0x30 }, // 914.5MHz
{ 0xB9,0x00,0x00, 0x5C,0x72,0x8D, 0x60, 0x30 }, // 910MHz
{ 0x9B,0xC0,0x00, 0x5D,0x68,0xF4, 0x50, 0x30 }, // 919.5MHz
{ 0xC8,0x80,0x00, 0x5C,0x7B,0x2B, 0x68, 0x30 }, // 910.5MHz
{ 0x8B,0x40,0x00, 0x5C,0xCD,0x38, 0x48, 0x30 }, // 913.5MHz
{ 0x8D,0x00,0x00, 0x5D,0xF7,0xE3, 0x48, 0x30 }, // 925MHz
{ 0xC8,0xC0,0x00, 0x5C,0x98,0xB5, 0x68, 0x30 }, // 911.5MHz
{ 0xC8,0xE0,0x00, 0x5C,0xA7,0x7A, 0x68, 0x30 }, // 912MHz
{ 0x6C,0xC0,0x00, 0x5D,0x34,0xD6, 0x38, 0x30 }, // 917.5MHz
{ 0xD7,0x40,0x00, 0x5C,0x30,0x44, 0x70, 0x30 }, // 907.5MHz
{ 0xC7,0x00,0x00, 0x5B,0xC9,0xF0, 0x68, 0x30 }, // 903.5MHz
{ 0x6D,0xE0,0x00, 0x5E,0x2B,0xB2, 0x38, 0x30 }, // 927MHz
{ 0xBC,0x40,0x00, 0x5E,0x12,0x8D, 0x60, 0x30 }, // 926MHz
{ 0xDA,0xC0,0x00, 0x5D,0xB0,0x44, 0x70, 0x30 }, // 922MHz
{ 0x5C,0x60,0x00, 0x5C,0x62,0x8D, 0x30, 0x30 }, // 909.5MHz
{ 0x99,0x60,0x00, 0x5B,0xFC,0x27, 0x50, 0x30 }, // 905.5MHz
{ 0x7C,0x80,0x00, 0x5D,0x5A,0x8D, 0x40, 0x30 }, // 919MHz
{ 0xA9,0xC0,0x00, 0x5C,0x8B,0x48, 0x58, 0x30 }, // 911MHz
{ 0xAA,0x80,0x00, 0x5C,0xF4,0x02, 0x58, 0x30 }, // 915MHz
{ 0xAA,0x20,0x00, 0x5C,0xBF,0xA5, 0x58, 0x30 }, // 913MHz
{ 0x8C,0x00,0x00, 0x5D,0x4D,0x38, 0x48, 0x30 }, // 918.5MHz
{ 0x5E,0x00,0x00, 0x5E,0x02,0x8D, 0x30, 0x30 }, // 925.5MHz
{ 0xA8,0xA0,0x00, 0x5B,0xEE,0x30, 0x58, 0x30 }, // 905MHz
{ 0xA9,0x60,0x00, 0x5C,0x56,0xEA, 0x58, 0x30 }, // 909MHz
{ 0x5D,0xA0,0x00, 0x5D,0xA2,0x8D, 0x30, 0x30 }, // 921.5MHz
{ 0xC9,0xA0,0x00, 0x5D,0x00,0x17, 0x68, 0x30 }, // 915.5MHz
{ 0x7D,0x40,0x00, 0x5D,0xEA,0x8D, 0x40, 0x30 }, // 924.5MHz
{ 0xC6,0xE0,0x00, 0x5B,0xBB,0x2B, 0x68, 0x30 }, // 903MHz
{ 0x8B,0xA0,0x00, 0x5D,0x0D,0x38, 0x48, 0x30 }, // 916MHz
{ 0x5B,0xE0,0x00, 0x5B,0xE2,0x8D, 0x30, 0x30 }, // 904.5MHz
{ 0x6C,0xA0,0x00, 0x5D,0x19,0x69, 0x38, 0x30 }, // 916.5MHz
{ 0xD9,0x80,0x00, 0x5D,0x27,0x20, 0x70, 0x30 }, // 917MHz
{ 0xCA,0xA0,0x00, 0x5D,0x76,0x3F, 0x68, 0x30 }, // 920MHz
{ 0x5D,0x40,0x00, 0x5D,0x42,0x8D, 0x30, 0x30 }, // 918MHz
{ 0x99,0xE0,0x00, 0x5C,0x48,0xF4, 0x50, 0x30 }, // 908.5MHz
{ 0x5D,0xC0,0x00, 0x5D,0xC2,0x8D, 0x30, 0x30 }, // 923MHz
{ 0x6B,0x80,0x00, 0x5C,0x22,0x8D, 0x38, 0x30 }, // 907MHz
{ 0xDC,0x00,0x00, 0x5E,0x39,0x69, 0x70, 0x30 }, // 927.5MHz
{ 0x5D,0x80,0x00, 0x5D,0x82,0x8D, 0x30, 0x30 }, // 920.5MHz
{ 0x9C,0x00,0x00, 0x5D,0x8F,0x5A, 0x50, 0x30 }, // 921MHz
{ 0x99,0x20,0x00, 0x5B,0xD5,0xC1, 0x50, 0x30 }, // 904MHz
{ 0xD7,0x00,0x00, 0x5C,0x14,0xD6, 0x70, 0x30 }, // 906.5MHz
{ 0x6B,0xA0,0x00, 0x5C,0x3D,0xFB, 0x38, 0x30 }, // 908MHz
{ 0xDB,0xC0,0x00, 0x5E,0x1D,0xFB, 0x70, 0x30 }, // 926.5MHz
{ 0x9C,0x40,0x00, 0x5D,0xB5,0xC1, 0x50, 0x30 }, // 922.5MHz
{ 0x7A,0xC0,0x00, 0x5C,0x0A,0x8D, 0x40, 0x30 }, // 906MHz
{ 0xCB,0x80,0x00, 0x5D,0xDD,0xA1, 0x68, 0x30 }, // 924MHz
{ 0xCB,0x60,0x00, 0x5D,0xCE,0xDC, 0x68, 0x30 }, // 923.5MHz
{ 0x7B,0xA0,0x00, 0x5C,0xB2,0x8D, 0x40, 0x30 }, // 912.5MHz
};
// This structure is used as a template for the frequencies in the
// hopping sequence.
// The Modem, FSEP, CURRENT, FREND, PA_POW, MATCH and PRESCALER
// fields are used for all frequencies, while the Freq and PLL
// fields are ignored as they are retrieved from rxtxpair_settings.
// The structure is generated with SmartRF Studio.
// 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: 38.4 kBaud
// Data Format: Manchester
// RF output power: 0 dBm
// IF/RSSI: RSSI Enabled
RF_RXTXPAIR_SETTINGS code RF_SETTINGS = {
0xA9, 0x2F, 0x2A, // Modem 0, 1 and 2
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
0xA0, // PA_POW
0x00, // MATCH
0x00, // PRESCALER
};
// This buffer may be commmented out if not using FHSPP
xdata byte sendBuffer[MAX_PACKET_LENGTH+2];
// Warning: The rest of this file should not be modified
#define NUMBER_OF_FREQUENCIES sizeof(rxtxpair_settings)/sizeof(rxtxpair_settings[0])
xdata RF_RXTXPAIR_CALDATA rxtxpair_caldata[NUMBER_OF_FREQUENCIES];
xdata const byte maxPacketLength = MAX_PACKET_LENGTH+2;
xdata byte message[MAX_PACKET_LENGTH+2];
// These variables may be modified runtime to give each system a unique sequence of
// frequencies to hopp through. Thus, the systems will not block each other.
// Also, an advanced protocol that eliminates channels that are too noisy may
// be employed.
// Note that frequencyPermutation is set to 0,1,2,... by initializeFrequencies.
xdata byte numberOfFrequencies = NUMBER_OF_FREQUENCIES;
xdata byte frequencyPermutation[NUMBER_OF_FREQUENCIES];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -