文件名称:LT8900参考代码
文件大小:156KB
文件格式:RAR
更新时间:2014-05-02 07:09:26
LT8900参考代码
by chaofu.zhang //2010-06-01 #ifndef LT8900_H #define LT8900_H //=================================================== // LT8900 Parameter Definition //=================================================== #define SYNCWORD_0 0x34 #define SYNCWORD_1 0x56 #define SYNCWORD_2 0x78 #define SYNCWORD_3 0x9A #define SYNCWORD_4 0xBC #define SYNCWORD_5 0xDE #define SYNCWORD_6 0xF0 #define SYNCWORD_7 0x12 #define LT_XTAL_OSC_EN 1 //Enable crystal #define LT_RSSI_PDN 0 //RSSI operation #define LT_VCO_CAL_EN 1 //calibrate VCO for each RF operation //Reg32 (0x20) #define LT_PREAMBLE_LEN 7 //preamble = 4byte #define LT_SYNCWORD_LEN 3 //syncword = 64bit #define LT_TRAILER_LEN 0 //trailer = 4bit #define LT_DATA_PACKET_TYPE 0 //data packet type = NRZ law #define LT_FEC_TYPE 0 // No FEC #define LT_BRCLK_SEL 0 // NO BRCLK clock output #define LT_R32H ((LT_PREAMBLE_LEN << 5) + (LT_SYNCWORD_LEN << 3) + LT_TRAILER_LEN) #define LT_R32L ((LT_DATA_PACKET_TYPE << 6) + (LT_FEC_TYPE << 4) + (LT_BRCLK_SEL << 1)) //Reg40 (0x28) #define LT_FIFO_EMPTY_THRESHOLD 4 #define LT_FIFO_FULL_THRESHOLD 4 #define LT_SYNCWORD_THRESHOLD 7 #define LT_R40H ((LT_FIFO_EMPTY_THRESHOLD << 3)+ (LT_FIFO_FULL_THRESHOLD >> 2)) #define LT_R40L ((LT_FIFO_FULL_THRESHOLD<<6) + LT_SYNCWORD_THRESHOLD) //Reg41 (0x29) #define LT_CRC_ON 1 //CRC on #define LT_SCRAMBLE_ON 1 //scrable off #define LT_PACK_LENGTH_EN 1 //first data byte is packet length #define LT_FW_TERM_TX 1 #define LT_AUTO_ACK 0 //auto ACK #define LT_PKT_FIFO_POL 0 //PKT_FLAG is active high #define LT_CRC_INIT_DATA 0x00 //CRC initial data const char code LT_CH_Table[10][8] = { (0,10,20,30,40,50,60,70), (1,11,21,31,41,51,61,71), (2,12,22,32,42,52,62,72), (3,13,23,33,43,53,63,73), (4,14,24,34,44,54,64,74), (5,15,25,35,45,55,65,75), (6,16,26,36,46,56,66,76), (7,17,27,37,47,57,67,77), (8,18,28,38,48,58,68,78), (9,19,29,39,49,59,69,79) }; sbit MISO = P1^0; //input sbit RESET_N = P1^1; //output sbit CLK = P1^2; //output sbit MOSI = P1^3; //output sbit SS = P1^4; //output sbit FIFO_FLAG = P0^6; //input sbit PKT_FLAG = P0^7; //input char LT_RFPower = 0x0F; //maximum power unsigned char LT_SCAN_RSSI_CN_NO = (31 << 2); unsigned char LT_RX_ACK_TIME = 100; //wait RX ACK pack for 100us unsigned char LT_SCAN_RSSI_CH = 0; // scan channle = 2042+x unsigned char LT_SCAN_RSSI_TIME = 100; //scan RSSI wait time 100us char bdata LT_REG35 = 0; sbit LT_POWER_DOWN = LT_REG35^7; sbit LT_SLEEP_MODE = LT_REG35^6; sbit LT_BRCLK_ON_SLEEP = LT_REG35^4; char bdata LT_REG48H = 0; sbit LT_CRC_ERROR = LT_REG48H^7; sbit LT_FEC23_ERROR = LT_REG48H^6; sbit LT_FRAMER_ST_5 = LT_REG48H^5; sbit LT_FRAMER_ST_4 = LT_REG48H^4; sbit LT_FRAMER_ST_3 = LT_REG48H^3; sbit LT_FRAMER_ST_2 = LT_REG48H^2; sbit LT_FRAMER_ST_1 = LT_REG48H^1; sbit LT_FRAMER_ST_0 = LT_REG48H^0; char bdata LT_REG48L = 0; sbit LT_SYNCWORD_RECV = LT_REG48L^7; sbit LT_PKT_FLAG = LT_REG48L^6; sbit LT_FIFO_FLAG = LT_REG48L^5; char W_FIFO = 0; char R_FIFO = 0; #endif
【文件预览】:
lt8900参考代码
----RF收发汇编参考代码.asm()
--------RF收发汇编参考代码.asm(29KB)
----RF收发C语言参考代码()
--------LT8900_Receive()
--------LT8900_TX()