亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? f360_cc1100.c

?? 使用C8051F360高速單片機加無線收發(fā)芯片CC1100實現的無線語音通信的源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
//-----------------------------------------------------------------------------
// Wireless Voice Transmitter/Receiver with C8051F360
//-----------------------------------------------------------------------------
//
// This software system is written to control the PCB designed with C8051F360.
//

//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include <c8051f360.h>                 // SFR declarations
#include <intrins.h>                   // includes the _nop_() command

//-----------------------------------------------------------------------------
// Global CONSTANTS
//-----------------------------------------------------------------------------


#define SYSCLK 24500000                // speed of internal clock
#define SAMPLE_RATE 8000               // sampling rate for the ADC
#define SPI_DATARATE 153600            // used for timing in SPI state machine

#define TransmitFIFO_FIFOSIZE   236         // sets the size of data buffers
#define ReceiveFIFO_FIFOSIZE   236
#define ADCRXFIFO_FIFOSIZE 10
#define DACTXFIFO_FIFOSIZE 10


#define DAC_UPDATERATE 8000             // rate of DAC sample output

// Transmission-Related Constants
#define RXTX_BytesOfData 200           // number of bytes of compressed audio
                                       // data to be transmitted per data
                                       // packet


#define TransmitFIFO_TARGET 200             // target size of TransmitFIFO, used to make
                                       // sampling rate adjustments to avoid
                                       // FIFO over- and underflows

#define ReceiveFIFO_TARGET 10              // target size of ReceiveFIFO, used to make
                                       // sampling rate adjustments to avoid
                                       // FIFO over- and underflows


#define RXTX_NoPreambleLevel 20        // consecutive number of data packets
                                       // that will be missed before the
                                       // RF signal is considered lost and
                                       // transmission shuts down


#define I_TX 0x02                      // this value is written to the RF
                                       // transceiver's Interface register when
                                       // the RF switch is to be placed in the
                                       // TX position
#define I_RX 0x01                      // this value is written to the RF
                                       // transceiver's Interface register when
                                       // the RF switch is to be placed in the
                                       // RX position



#define Audio_QuietThreshold 2         // difference threshold in ADC codes
                                       // between two consecutive samples that
                                       // is used to determine whether a
                                       // signal is "loud" enough to transmit


#define AudioStateQuietToLoud 10       // number of instances where
                                       // the difference between consecutive
                                       // ADC samples is GREATER than
                                       // <Audio_QuietThreshold> that must be
                                       // accumulated before a "quiet"
                                       // audio signal should be considered
                                       // "loud"

#define AudioStateLoudToQuiet 400      // number of instances where
                                       // the difference between consecutive
                                       // ADC samples is LESS than
                                       // <Audio_QuietThreshold> that must
                                       // CONSECUTIVELY occur before a "loud"
                                       // audio  signal should be considered
                                       // "quiet"

#define RX_MinBytesInitPreamble 5      // number of consecutively received
                                       // preamble bytes that must be received
                                       // before the incoming data for the
                                       // first received packet can be
                                       // considered valid

#define TX_NumBytesInitPreamble 50     // number of preamble bytes sent during
                                       // a RXTX_Master's first data packet
                                       // transmission

#define TX_NumBytesPreamble 8          // number of preamble bytes transmitted
                                       // before each data packet, excluding
                                       // the RXTX_Master's first packet

#define RX_MinBytesPreamble 2         // minimum number of preamble bytes
                                       // the must be received before incoming
                                       // data can be considered valid,
                                       // excluding the reception of the
                                       // RXTX_Master's first packet


#define RXTX_SyncWordSize 3            // used to re-sync the slave <SPI_Timer>

#define Audio_StateSize   1            // used to re-sync the slave <SPI_Timer>



#define DPCM_MULTIPLIER 2              // used to amplify the decompressed
                                       // audio samples


// 10-bit DPCM quantization codes
#define low_low 1
#define low_mid 2
#define low_high 4
#define middle 8
#define high_low 16
#define high_mid 32
#define high_high 64


//-----------------------------------------------------------------------------
// CC1100 Registers
//-----------------------------------------------------------------------------
#define  MAIN            0x00
#define  INTERFACE       0x01
#define  RESETT          0x02
#define  SEQUENCING      0x03
#define  FREQ_2A         0x04
#define  FREQ_1A         0x05
#define  FREQ_0A         0x06
#define  CLOCK_A         0x07
#define  FREQ_2B         0x08
#define  FREQ_1B         0x09
#define  FREQ_0B         0x0A
#define  CLOCK_B         0x0B
#define  VCO             0x0C
#define  MODEM           0x0D
#define  DEVIATION       0x0E
#define  AFC_CONTROL     0x0F
#define  FILTER          0x10
#define  VGA1            0x11
#define  VGA2            0x12
#define  VGA3            0x13
#define  VGA4            0x14
#define  LOCK            0x15
#define  FRONTEND        0x16
#define  ANALOG          0x17
#define  BUFF_SWING      0x18
#define  BUFF_CURRENT    0x19
#define  PLL_BW          0x1A
#define  CALIBRATE       0x1B
#define  PA_POWER        0x1C
#define  MATCH           0x1D
#define  PHASE_COMP      0x1E
#define  GAIN_COMP       0x1F
#define  POWERDOWN       0x20
#define  TEST1           0x21
#define  TEST2           0x22
#define  TEST3           0x23
#define  TEST4           0x24
#define  TEST5           0x25
#define  TEST6           0x26
#define  TEST7           0x27
#define  STATUS          0x40
#define  RESET_DONE      0x41
#define  RSS             0x42
#define  AFC             0x43
#define  GAUSS_FILTER    0x44
#define  STATUS1         0x45
#define  STATUS2         0x46
#define  STATUS3         0x47
#define  STATUS4         0x48
#define  STATUS5         0x49
#define  STATUS6         0x4A
#define  STATUS7         0x4B

#define  TEST_NFC        0x28


//-----------------------------------------------------------------------------
// 16-bit SFR Definitions for 'F33x
//-----------------------------------------------------------------------------

sfr16 DP       = 0x82;                 // data pointer
sfr16 TMR3RL   = 0x92;                 // Timer3 reload value
sfr16 TMR3     = 0x94;                 // Timer3 counter
sfr16 IDA0     = 0x96;                 // IDAC0 data
sfr16 ADC0     = 0xbd;                 // ADC0 data
sfr16 ADC0GT   = 0xc3;                 // ADC0 Greater-Than
sfr16 ADC0LT   = 0xc5;                 // ADC0 Less-Than
sfr16 TMR2RL   = 0xca;                 // Timer2 reload value
sfr16 TMR2     = 0xcc;                 // Timer2 counter
sfr16 PCA0CP1  = 0xe9;                 // PCA0 Module 1 Capture/Compare
sfr16 PCA0CP2  = 0xeb;                 // PCA0 Module 2 Capture/Compare
sfr16 PCA0     = 0xf9;                 // PCA0 counter
sfr16 PCA0CP0  = 0xfb;                 // PCA0 Module 0 Capture/Compare



//-----------------------------------------------------------------------------
// Function PROTOTYPES
//-----------------------------------------------------------------------------
void SYSCLK_Init (void);               // initialize system clock to 24.5 MHz
void PORT_Init (void);                 // initialize crossbar
void ADC0_Init (void);                 // ADC captures on Tmr2 overflows
                                       // interrupts enabled
void Timer0_Init(void);                // used for  WaitUS()
void Timer2_Init (unsigned int);       // ADC start-of-conversion clock source
void Timer3_Init(unsigned int);        // sets DAC output rate
void IDAC0_Init(void);                 // enables IDAC output on P0.1
void SPI_Init(void);                   // enable 3-wire Slave SPI for RF trans.
                                       // DATA interface
void Variables_Init(void);             // set global variables to reset values

void PCA0_Init(void);                  // configure PCA0 to edge-triggered
                                       // capture mode

void Timer3_ISR (void);                // updates the DAC
void UART0_ISR (void);                 // RX and TX with RF transceiver
void ADC0_ISR (void);                  // checks for a quiet signal,
                                       // pushes samples onto ADCRXFIFO
// FIFO Routines
unsigned char TransmitFIFO_Pull();          // pulls compressed sample to be TXed
unsigned char ReceiveFIFO_Pull();          // pulls RXed compressed sample
unsigned short ADCRXFIFO_Pull();       // pulls ADC sample
unsigned short DACTXFIFO_Pull();       // pulls decompressed sample
void TransmitFIFO_Push(unsigned char);      // pushes compressed sample to be TXed
void ReceiveFIFO_Push(unsigned char);      // pushes RXed compressed sample
void ADCRXFIFO_Push(unsigned short);   // pushes ADC sample
void DACTXFIFO_Push(unsigned short);   // pushes decompressed sample
unsigned short ADCRXFIFO_Newest(void); // returns the value most recently
                                       // pushed onto the ADC FIFO, but does
                                       // not alter any of the index values

void CLEAR_FIFOS(void);                // resets all FIFOs to default values

// DPCM Compression Algorithms
void DPCM_Decompress(void);            // Compresses an ADC sample
void DPCM_Compress(void);              // Decompresses received samples

// RF Transceiver Register Routines
void SETREG(unsigned char, unsigned char);
                                       // updates register to value parameter

unsigned char READREG(unsigned char);  // return register value
unsigned char CC1100_Init(void);       // initializes RF transceiver
void CC1100_SwitchToRX(void);          // sets RF transceiver settings to RX
void CC1100_SwitchToTX(void);          // sets RF transceiver settings to TX
void C1020_POWERDOWN(void);            // shuts down components of the RF
                                       // transceiver to conserve power

void ASLEEP(void);                     // function that runs when the
                                       // communications channel is idle
void WaitUS(unsigned int);             // function will delay controller
                                       // for a set number of microseconds
void WaitMS_360(unsigned int);

void FIFO_ManagementRoutine(void);     // encapsulates all foreground function
                                       // calls concerning buffers, and
                                       // all checks and tests on buffer
                                       // sizes

void RXTX_InitMaster(void);
void RXTX_InitSlave(void);


//-----------------------------------------------------------------------------
// User-Defined Types
//-----------------------------------------------------------------------------


typedef union USHORT {                 // access a short variable as two
      unsigned short S;                // 8-bit integer values
      unsigned char C[2];
   } USHORT;

enum Logic{ FALSE, TRUE};

enum RXTX_Classes{
   RXTX_Master,
   // designates the endpoint that initiates the creation of the Communication
   // Channel

   RXTX_Slave,
   // designates the endpoint that joins an initiated Communication Channel

   RXTX_Searching
   // designates an endpoint that is searching for a master

};

typedef enum RXTX_StateMachineStates {

   RX_SearchForMaster,
   // Search for <RX_MinBytesInitPreamble> consecutive preamble bytes in
   // the RF transceiver's output data stream

   TX_InitPreamble,
   // Transmit <TX_NumBytesInitPreamble> preamble bytes before transmitting
   // the first data packet

   TX_Preamble,
   // Transmit <TX_NumBytesPreamble> preamble bytes

   TX_SyncWord,
   // Transmit sync word 0xFFFFEE

   TX_SwitchTime,
   // Delay for a time period specified in the SPI ISR's Transmission State
   // Machine, using the timer variable <SPI_Timer> as the time base

   TX_AudioState,
   // Transmit local shutdown state

   TX_Data,
   // Transmit <RXTX_BytesOfData> bytes from the TransmitFIFO

   RX_Preamble,
   // Search for <RX_MinBytesPreamble> consecutive bytes of received preamble

   RX_SyncWord,
   // Search for and synchronize receiver to the sync word 0xFFFFEE

   RX_AudioState,
   // Receive the remote (transmitter's) Shutdown State

   RX_Data,
   // Receive <RXTX_BytesOfData> bytes and push each to the ReceiveFIFO

   RXTX_TimeOut,
   // state is entered when <SPI_TIMER> times out.  Variable
   // <TimeOut_EntryMode> should be set before entering state <RXTX_TimeOut>


   Switch_ToTX01,
   Switch_ToTX02,
   Switch_ToTX03,
   Switch_ToTX04,
   Switch_ToTX05,
   Switch_ToTX06,
   Switch_ToTX07,
   // These states configure the RF Transceiver to its transmit mode

   Switch_ToRX01,
   Switch_ToRX02,
   Switch_ToRX03,
   Switch_ToRX04,
   Switch_ToRX05,
   Switch_ToRX06,
   // These states configure the RF Transceiver to its receive mode

   RXTX_WaitForTimeOut,
   // this state will pause state machine progress until the
   // RXTX_StateMachine's time base <SPI_Timer> reaches its time-out value

   RXTX_Shutdown,
   // Entered when the Communication Channel is to be terminated

   Uninitialized
   // Reset state of the RF state machine

} RXTX_StateMachineStates;

typedef enum TimeOut_EntryModes{
   TimeOut_RXSuccessful,
   // indicates that the state machine has just successfully completed the
   // reception of a data packet

   TimeOut_TXSuccessful,
   // indicates that the state machine has just successfully completed the
   // transmission of a data packet

   TimeOut_RXNoPreamble,
   // state machine failed to find the minimum number of bytes of preamble
   // needed to determine that a valid data packet has been received before
   // SPI_Timer reached its terminal value

   TimeOut_RXNoSyncWord
   // state machine failed to find a valid Sync Word before SPI_Timer reached
   // its terminal value

} TimeOut_EntryModes;



typedef enum Audio_States{
   Audio_Quiet = 0x10,
   // state indicates that audio is below the audible threshold

   Audio_Loud = 0x30,
   // audio is above audible threshold

   Audio_ChannelShutdown = 0x40
   // special state transmitted after both Endpoints' Audio States have
   // been set to

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
理论电影国产精品| 国产精品网曝门| 日韩一级视频免费观看在线| 久久色.com| 日本美女一区二区| 一本久久a久久免费精品不卡| 欧美一二三四在线| 亚洲免费资源在线播放| 国产精品主播直播| 日韩欧美一区二区视频| 亚洲成人黄色影院| 91丨porny丨户外露出| 国产日韩一级二级三级| 麻豆精品国产传媒mv男同| 欧美午夜理伦三级在线观看| 一区二区中文字幕在线| 国产电影一区二区三区| 精品福利在线导航| 久久精品国产精品亚洲红杏| 欧美日本不卡视频| 亚洲自拍偷拍av| 色一情一伦一子一伦一区| 国产精品福利一区二区三区| 国产成人av一区二区三区在线 | 另类小说图片综合网| 色先锋资源久久综合| 自拍偷拍国产精品| 成人免费看视频| 国产精品嫩草影院av蜜臀| 国产精品自在在线| 久久久久久久精| 国产精品一区二区在线观看不卡 | 成人综合在线视频| 国产欧美1区2区3区| 国产精品夜夜爽| 欧美经典一区二区| 国产91丝袜在线18| 亚洲欧洲www| 色88888久久久久久影院按摩| 自拍视频在线观看一区二区| 91麻豆精品在线观看| 一区二区成人在线观看| 欧美日韩国产a| 水蜜桃久久夜色精品一区的特点| 欧美日本精品一区二区三区| 亚洲一级二级三级在线免费观看| 欧美视频中文一区二区三区在线观看 | 国产精品久久免费看| 精品一区二区免费| 国产日韩欧美亚洲| 91天堂素人约啪| 亚洲一级二级三级在线免费观看| 色综合中文字幕国产 | av不卡在线观看| 夜夜爽夜夜爽精品视频| 欧美日韩视频专区在线播放| 日韩高清欧美激情| 国产欧美一区视频| 在线观看日韩av先锋影音电影院| 日韩黄色片在线观看| 久久精品人人做人人综合 | 久久99精品网久久| 亚洲欧洲美洲综合色网| 欧美精品在线一区二区| 国产高清久久久久| 亚洲最大成人综合| 精品999久久久| 色综合色狠狠综合色| 美女视频黄a大片欧美| 国产精品欧美久久久久无广告 | 欧美人与禽zozo性伦| 国内成+人亚洲+欧美+综合在线| 国产精品网站在线播放| 在线播放一区二区三区| 福利电影一区二区| 青青国产91久久久久久| 国产精品对白交换视频| 日韩午夜三级在线| 欧美视频一二三区| 成人av免费在线观看| 欧美aaaaaa午夜精品| 一区二区中文字幕在线| 精品成人一区二区三区| 欧美亚一区二区| 国产麻豆精品一区二区| 日韩高清一区在线| 一区二区三区成人| 中文字幕一区二区三区色视频 | 国产精品国产三级国产aⅴ无密码| 91精品国产一区二区三区香蕉| 成人av在线影院| 久久国产视频网| 亚洲国产精品一区二区久久恐怖片| 国产亚洲制服色| 精品免费日韩av| 欧美日韩国产a| 在线视频欧美区| 91性感美女视频| 成人理论电影网| 国产一区二区三区免费看| 日韩国产一二三区| 亚洲一区二区五区| 综合久久国产九一剧情麻豆| 日本一区二区免费在线| 精品sm在线观看| 日韩欧美激情四射| 亚洲国产日韩一级| 亚洲人成网站在线| 中文字幕中文字幕中文字幕亚洲无线| 精品国产亚洲在线| 日韩欧美中文一区| 精品久久久久久久久久久久久久久 | 欧美一区二区视频网站| 日本高清不卡视频| 91视频观看视频| 91在线观看一区二区| 99视频在线精品| 一本大道av伊人久久综合| av电影一区二区| 91免费版在线| 欧美中文字幕一二三区视频| 在线免费观看日韩欧美| 欧美日韩一区二区三区不卡| 欧美日韩国产影片| 欧美一区二区三区喷汁尤物| 91精品国产黑色紧身裤美女| 欧美一区二区播放| 精品少妇一区二区三区在线播放| 2023国产精华国产精品| 亚洲国产精品传媒在线观看| 中文字幕一区在线观看视频| 亚洲最大成人综合| 日本欧洲一区二区| 国产精品性做久久久久久| caoporn国产一区二区| 欧美在线制服丝袜| 亚洲精品老司机| 日韩中文字幕亚洲一区二区va在线 | 日本不卡的三区四区五区| 日韩在线观看一区二区| 国产自产视频一区二区三区| 国产98色在线|日韩| 91豆麻精品91久久久久久| 91精品综合久久久久久| 久久久一区二区三区| 亚洲色图视频网| 免费观看在线色综合| 丁香亚洲综合激情啪啪综合| 欧洲亚洲精品在线| 精品久久久久香蕉网| 亚洲欧美视频在线观看| 日本vs亚洲vs韩国一区三区二区 | 日韩欧美一二三区| 中文字幕精品综合| 亚洲高清免费视频| 国产经典欧美精品| 欧美色视频在线| 国产网红主播福利一区二区| 亚洲制服欧美中文字幕中文字幕| 极品少妇xxxx精品少妇| 在线观看视频一区二区 | 日韩三级视频在线观看| 国产精品第一页第二页第三页| 亚洲bt欧美bt精品| 成人黄色777网| 欧美一区二区三区视频在线 | 99在线精品观看| 日韩三级精品电影久久久 | 在线视频国内自拍亚洲视频| 精品成人一区二区三区四区| 亚洲午夜视频在线| 成人免费看视频| 性欧美疯狂xxxxbbbb| 99精品视频在线播放观看| 精品99999| 奇米精品一区二区三区四区 | 成人午夜精品在线| 欧美一级精品大片| 亚洲一区二区三区不卡国产欧美| 大美女一区二区三区| 久久综合999| 美女脱光内衣内裤视频久久影院| 欧洲一区在线观看| 国产精品欧美久久久久一区二区| 国内久久婷婷综合| 欧美v日韩v国产v| 日本不卡视频一二三区| 欧美日韩成人一区二区| 亚洲综合区在线| 91久久香蕉国产日韩欧美9色| 国产精品久久久久久久岛一牛影视 | 亚洲柠檬福利资源导航| 国产成人午夜精品影院观看视频| 欧美精品一卡二卡| 日韩精品亚洲专区| 欧美精品一卡二卡| 日韩av在线播放中文字幕| 69堂国产成人免费视频| 日本最新不卡在线| 亚洲一级二级在线|