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

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

?? link1.c

?? 2500-SPI通用程序
?? C
字號:
/*******************************************************************************************************
 *                                                                                                     *
 *        **********                                                                                   *
 *       ************                                                                                  *
 *      ***        ***                                                                                 *
 *      ***   +++   ***                                                                                *
 *      ***   + +   ***     This example shows how to transmit and receive packets with packet length  *
 *      ***   +             up to 255 bytes. The status byte is polled every 200 us in a timer1 int.   *
 *      ***   + +   ***                                                                                *
 *      ***   +++   ***     Link1.c                                                                    *
 *      ***        ***                                                                                 *
 *       ************                                                                                  *
 *        **********                                                                                   *
 *                                                                                                     *
 *******************************************************************************************************
 * Compiler:                Keil C51 V7.50                                                             *
 * Target platform:         Chipcon CCxxx0 (Silabs F320)                                               *
 * Author:                  SNA                                                                        *
 *******************************************************************************************************
 * Revision history:     See end of file                                                               *
 *******************************************************************************************************/
#include <Chipcon\srf04\regssrf04.h>
#include <Chipcon\srf04\halsrf04.h>
#include <Chipcon\srf04\ebsrf04.h>
#include <Link1.h>





//-------------------------------------------------------------------------------------------------------
// DESCRIPTION:
//      This program allows the user to set up a simple link between two SmartRf04EBs with 2 CCxx00 EM 
//      modules connected. The joystick is used to navigate through a menu, setting different parameters. 
//
//      Parameters          | Values 
//      ------------------------------------------------------
//      Packet Length       | 10, 30, 50, 70, ...., 230, 250
//      Number of Packets   | 100, 200, 300, ......, 900, 1000
//      Whitening           | Enabled, Disabled
//      Radio Mode          | Rx, Tx
//
//      RX UNIT: 
//                  * Enable/disable Whitening
//                  * Set radio mode to RX. 
//                  * Move joystick down until the message 
//                    "Press S1 to start" is showed on the LCD display  
//                  * Press S1
//                  
//                  The LCD display will show number of packets received with CRC OK
//
//      TX UNIT:
//                  * Set packet length and number of packets to transmit
//                  * Enable/disable Whitening (set to the same as on the RX unit)
//                  * Set radio mode to TX
//                  * Press S1 to Start
//
//                  The LCD will show number of packets transmitted
//
//                  After all the packets have been transmitted, S1 can be pressed again to transmit 
//                  or the joystick can be used to change packet length and number of packets 
//                  to transmit
//
//      IMPORTANT NOTICE!
//      Be aware that the status byte polling cannot fully be trusted 
//      (See the CC1100, CC1150, CC2500, or 2550 Errata Note). Link2 will show how packets longer than 
//      the FIFO can be sent/received without using any SPI polling.
//      To run this example, the following register settings must be used:
//          PKTCTRL1.APPEND_STATUS = 1
//          PKTCTRL0.CRC_EN = 1
//          MCSM2.RX_TIME = 7
//          MSCM1.RXOFF_MODE = MSCM1.TXOFF_MODE = 0
//-------------------------------------------------------------------------------------------------------




//-------------------------------------------------------------------------------------------------------
// Global Variables

BYTE xdata txBuffer[258];   // 1 length byte + 255 bytes payload + 2 status bytes
BYTE xdata rxBuffer[258];   // 1 length byte + 255 bytes payload + 2 status bytes

UINT16 xdata packetsReceived = 0;

UINT8 xdata joystickPosition = JOYSTICK_CENTER;
UINT8 xdata prevJoystickPosition = JOYSTICK_CENTER;

UINT8 state = SETUP;    // Variable used to hold the next state in the state machine in the main loop
//-------------------------------------------------------------------------------------------------------




//-------------------------------------------------------------------------------------------------------
//  void main(void)
//
//  DESCRIPTION:
//      This function takes care of all the MCU initialization and radio configuration. The main loop
//      is implemented as a state machine and a state diagram can be found in the
//      CC1100/CC1150DK & CC2500/CC2550DK Development Kit Examples and Libraries User Manual 
//-------------------------------------------------------------------------------------------------------
void main (void) {

    UINT16 xdata packetsSent = 0;
    
    #ifdef STAND_ALONE

    	// Select the Internal Oscillator as Multiplier input source and disable the watchdog timer
    	// SYSCLK = 4X Clock Multiplier / 2
    	CLOCK_INIT();
    #endif

	// Set up the crossbar and I/O ports to communicate with the SmartRF04EB peripherals
    IO_PORT_INIT();

    // Initialize the LCD display. The SMBus uses timer 0 to generate SCL
    ebLcdInit();

    // Initialize the ADC converter
    ebAdcInit(ADC_JOY);

    SPI_INIT(SCLK_6_MHZ);

    POWER_UP_RESET_CCxxx0();
   
    halRfWriteRfSettings(&rfSettings);

    halSpiWriteReg(CCxxx0_PATABLE, paTable);

    pktDataInit();

    // Setup Timer1 to overflow every 200 us
    //  1/24000000 * x = 200 us => x = 4800
    //  2^13 - 4800 = 3392 = 0110101000000b
    //  => TH1 = 106
    //  => TL1 = 0
    TH1 = 106;
    TL1 = 0;

    // Clock source: 24 MHz, Mode: 13-bits timer
    halSetupTimer01(TIMER_1, SYSCLK_DIV_1, MODE_0, INT_OFF);

    handleAndDisplayMenu();

    // Infinite loop
    while (TRUE) {
        switch (state) {

            case SETUP:
            
                // This wait is implemented to give the LCD display enought time to be update
                // between each iteration
                halWait(250);

                joystickPosition = ebGetJoystickPosition();

                if (prevJoystickPosition != joystickPosition)
                    parseMenu(joystickPosition);

                prevJoystickPosition = joystickPosition;

                if ((index == START) && (ebButtonPushed())) {
                    INT_ENABLE(INUM_TIMER1, INT_ON);
                    if (menuData.radioMode == RX) {
                        state = RX_START;
                        ebLcdUpdate("Waiting for", "data");
                    }
                    else
                        state = TX_START;
                }
                break;            
                
            case TX_START:

                // Create data packet
                createDataPacket();
                
                if (packetsSent++ < menuData.numberOfPackets) {

                    state = TX_WAIT;

                    // Transmit packet with delay of 500 ms (250 * 200 us = 500 ms). The delay is 
                    // implemented so that it will be possible to view the packet counter on the LCD 
                    // display
                    pktStartTx(250);
                }
                else {
                    halWait(5000);
                    ebLcdUpdate("Press S1", "to start");
                    packetsSent = 0;
                    state = SETUP;
                    INT_ENABLE(INUM_TIMER1, INT_OFF);
                }
                break;

            case TX_WAIT:

                if (!pktData.txInProgress) {
                    if (pktData.pktTransmitted) {
                        intToAscii(packetsSent);
                        ebLcdUpdate("Sent:", asciiString);
                        pktData.pktTransmitted = FALSE;
                        state = TX_START;
                        
                    } else if (pktData.txUnderflowFlag) {
                        pktData.txBytesLeft = 0;
                        pktData.txUnderflowFlag = FALSE;
                        state = TX_START;
                    }
                }
                break;

            case RX_START:
                state = RX_WAIT;
                
                //Receive packet (no timeout)
                pktStartRx(0);
               
                break;

            case RX_WAIT:
                if (!pktData.rxTimeoutReached) {

                    if (pktData.pktReceived) {

                        pktData.pktReceived = FALSE;

                        // Check CRC_OK
                        if (pktData.pRxBuffer[pktData.pRxBuffer[0] + 2] & CRC_OK) {
                            intToAscii(++packetsReceived);
                            ebLcdUpdate("Received:", asciiString);
                        }
                        state = RX_START;
                    }
                } else {
                    ebLcdUpdate("Press S1", "to start");
                    pktData.rxTimeoutReached = FALSE;
                    state = SETUP;
                }
                break;

            default:
                break;
        }
    }
}




//-------------------------------------------------------------------------------------------------------
//  void TIMER1_ISR(void)
//
//  DESCRIPTION:
//      This interrupt occurs every 200 us, when timer1 overflows. The timer regsisters are reloaded and
//      both packet handler functions are called (pktRxHandler and pktTxHandler).
//-------------------------------------------------------------------------------------------------------
void TIMER1_ISR(void) interrupt INUM_TIMER1 {

    // Reload timer1 registers to overflow every 200 us
    TH1 = 106;
    TL1 = 0;
    pktTxHandler();
    pktRxHandler();
} // TIMER1_ISR




//-------------------------------------------------------------------------------------------------------
//  void intToAscii(UINT16 value)
//
//  DESCRIPTION:
//		Takes a 16 bits integer as input and converts it to ascii. The result is put in a global
//      variable (UINT8 xdata asciiString[6])
//
//	ARGUMENTS:
//		UINT16 value
//			The value to be converted
//-------------------------------------------------------------------------------------------------------
void intToAscii(UINT16 value) {
    UINT8 i;
    UINT8 j = 0;
    UINT8 digit_start = 0;
    UINT16 digit = 0;
    UINT16 denom = 10000;

    if (value == 0) {
        asciiString[0] = '0';
        asciiString[1] = NULL;
    } else {
        for(i = 5; i > 0; i--) {
            digit = value / denom;
            if((digit_start == 1) || (digit != 0)) {
                digit_start = 1;
                value %= denom;
                asciiString[j++] = (digit + '0');
            }
            denom /= 10;
        }
        asciiString[j++] = NULL;
    }
}// intToAscii





//-------------------------------------------------------------------------------------------------------
//  void pktDataInit(void)
//
//  DESCRIPTION:
//      Function to initial the pktData struck.
//
//-------------------------------------------------------------------------------------------------------
void pktDataInit(void) {

    // Setup pointers to tx and rx buffer
    pktData.pTxBuffer = txBuffer;
    pktData.pRxBuffer = rxBuffer;

    pktData.txInProgress = FALSE;
    pktData.txStartupTimeoutActive = FALSE;
    pktData.rxTimeoutReached = FALSE;
    pktData.rxTimeoutActive = FALSE;
    pktData.pktTransmitted = FALSE;
    pktData.pktReceived = FALSE;
    pktData.rxBytesLeft = 0;
    pktData.rxBytesLeft = 0;
    pktData.lengthByteRead = FALSE;
    pktData.txUnderflowFlag = FALSE;
}// pktDataInit






/******************************************************************************************************
 * Revision history:                                                                                  *
 *
 * $Log: Link1.c,v $
 * Revision 1.12  2007/01/25 12:14:34  a0190596
 * no message
 *
 * Revision 1.11  2007/01/23 15:46:20  a0190596
 * TX_WAIT state in Link1.c has been changed to properly handle underflow of the TX FIFO.
 *
 * Revision 1.10  2006/11/14 13:37:16  a0190596
 * Removed FEC option
 *
 * Revision 1.9  2006/10/06 13:25:41  a0190596
 * no message
 *
 * Revision 1.8  2006/04/25 14:55:57  a0190596
 * added POWER_UP_RESET_CCxxx0()
 *
 * Revision 1.7  2006/03/31 13:15:41  a0190596
 * POWER_UP_RESET_CCxxx0() removed
 *
 * Revision 1.6  2006/03/17 10:19:39  a0190596
 * New file structure might have caused variables, defines, and functions to move.
 * Comments are added.
 *
 * Revision 1.5  2005/10/25 12:04:26  sna
 * Moved IO_PORT_INIT(); outside #ifdef
 * Register settings moved to separate *.h file
 *
 * Revision 1.4  2005/07/11 12:11:04  sna
 * no message
 *
 * Revision 1.3  2005/06/14 11:08:00  sna
 * no message
 *
 * Revision 1.2  2005/05/04 11:22:20  sna
 * Removed Manual Calibration
 *
 * Revision 1.1  2005/04/20 12:41:36  sna
 * Initial version in CVS
 *
 *
 *
 ******************************************************************************************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品午夜在线观看| 欧美激情在线观看视频免费| 91丨porny丨蝌蚪视频| 国产精品12区| www.亚洲色图.com| 色综合久久久久| 91蜜桃免费观看视频| 色狠狠色噜噜噜综合网| 色偷偷久久一区二区三区| 色婷婷香蕉在线一区二区| 欧美色欧美亚洲另类二区| 欧美日韩精品久久久| 日韩亚洲欧美中文三级| 亚洲精品在线免费播放| 亚洲国产精品成人综合色在线婷婷 | 欧美日韩二区三区| 欧美精三区欧美精三区| 精品国产在天天线2019| 中文字幕在线不卡| 一个色综合av| 久久国产三级精品| 99久久国产免费看| 欧美美女bb生活片| 国产亚洲福利社区一区| 综合亚洲深深色噜噜狠狠网站| 亚洲中国最大av网站| 久久精品国产精品亚洲综合| 成人美女视频在线观看| 色噜噜狠狠成人中文综合| 日韩一卡二卡三卡国产欧美| 欧美激情一区在线| 日韩电影免费在线看| 成人sese在线| 日韩精品影音先锋| 亚洲女人****多毛耸耸8| 麻豆精品久久精品色综合| 白白色亚洲国产精品| 日韩欧美在线不卡| 亚洲男人天堂av网| 国产麻豆9l精品三级站| 欧美乱妇20p| ㊣最新国产の精品bt伙计久久| 日韩国产精品久久久| 99久久免费精品| 久久亚洲捆绑美女| 亚洲二区在线观看| 不卡一区二区三区四区| 精品美女在线播放| 亚洲mv大片欧洲mv大片精品| 风间由美一区二区三区在线观看 | 在线免费观看一区| 国产嫩草影院久久久久| 男人的j进女人的j一区| 日本精品免费观看高清观看| 国产精品久久看| 韩国女主播一区| 日韩午夜av电影| 午夜a成v人精品| 在线免费观看成人短视频| 国产日韩影视精品| 老司机精品视频在线| 777亚洲妇女| 日韩专区在线视频| 欧美日韩一区小说| 亚洲午夜免费视频| 色综合色狠狠综合色| 日韩理论片中文av| 91亚洲国产成人精品一区二区三 | 99re成人在线| 国产精品欧美综合在线| 国产 日韩 欧美大片| 久久久夜色精品亚洲| 国产在线视频不卡二| 精品国产伦一区二区三区免费| 天天操天天综合网| 777久久久精品| 日本欧美加勒比视频| 日韩视频中午一区| 日本欧美一区二区在线观看| 欧美va亚洲va香蕉在线| 国内精品久久久久影院一蜜桃| 欧美成人猛片aaaaaaa| 国产一区二区精品久久91| 国产区在线观看成人精品 | 欧美日韩国产首页| 婷婷综合在线观看| 日韩欧美色综合网站| 国产精品综合一区二区三区| 国产欧美一区二区在线观看| 成年人午夜久久久| 亚洲国产aⅴ成人精品无吗| 欧美群妇大交群的观看方式| 天堂av在线一区| 国产亚洲精品精华液| 色综合久久天天| 性欧美疯狂xxxxbbbb| 欧美成人性福生活免费看| 国产a区久久久| 亚洲午夜精品一区二区三区他趣| 在线播放一区二区三区| 国产米奇在线777精品观看| 中文字幕一区二区三区在线不卡| 欧美日韩在线播放三区| 国内精品伊人久久久久av影院| 国产精品久久久久久久久果冻传媒| 91国在线观看| 国产精品一区二区视频| 亚洲免费资源在线播放| 日韩亚洲欧美一区二区三区| 国产v综合v亚洲欧| 婷婷久久综合九色综合绿巨人| 久久欧美中文字幕| 欧美体内she精视频| 国产福利精品导航| 香港成人在线视频| 国产精品久久久久四虎| 制服丝袜成人动漫| 91蜜桃传媒精品久久久一区二区| 久久国产精品第一页| 亚洲一区二区四区蜜桃| 国产亚洲福利社区一区| 欧美人妖巨大在线| 色婷婷av一区二区| 丰满少妇久久久久久久| 免费在线观看一区| 一个色在线综合| 国产精品久久久99| 欧美成人官网二区| 欧美精品久久久久久久多人混战 | 日韩av中文在线观看| 椎名由奈av一区二区三区| 欧美精品一区二区久久久| 91麻豆精品国产自产在线 | 精品国产一区二区精华| 日本道精品一区二区三区| 成人黄页在线观看| 国产精品自拍在线| 麻豆久久久久久| 午夜精品视频在线观看| 亚洲精品美国一| 亚洲欧美另类久久久精品| 国产精品高清亚洲| 最新中文字幕一区二区三区| 中文字幕第一区第二区| 亚洲国产经典视频| 久久久久久久国产精品影院| 欧美精品一区二区三区蜜桃| 日韩欧美一级精品久久| 日韩精品一区二区三区中文精品| 欧美一区二区三区免费大片| 91精品婷婷国产综合久久| 欧美高清视频在线高清观看mv色露露十八| 色综合天天综合色综合av| 成人黄页毛片网站| 一本色道久久综合亚洲91| 99精品黄色片免费大全| 在线视频一区二区三区| 欧日韩精品视频| 欧美精品色综合| 欧美一区二区三区四区高清| 日韩一区二区三区在线观看| 欧美成人女星排名| 欧美经典一区二区| ...xxx性欧美| 午夜精品一区二区三区电影天堂 | 中文字幕一区二区三区四区| 中文字幕欧美激情| 亚洲女性喷水在线观看一区| 一区二区欧美在线观看| 天堂久久久久va久久久久| 国内精品伊人久久久久影院对白| 国产成人啪免费观看软件| 国产成人综合在线观看| 91色婷婷久久久久合中文| 欧美裸体一区二区三区| 久久久久久久久久电影| 一区二区中文字幕在线| 偷窥国产亚洲免费视频| 激情国产一区二区 | 日韩欧美另类在线| 中文字幕二三区不卡| 一区二区免费在线| 久久精品国产久精国产| 97成人超碰视| 精品美女一区二区三区| 综合色中文字幕| 免费不卡在线视频| 91免费国产在线观看| 精品欧美黑人一区二区三区| 亚洲天堂2016| 国产精品1区2区| 欧美日韩一区二区三区在线看| 国产午夜亚洲精品午夜鲁丝片| 亚洲一区二区三区四区在线| 麻豆视频一区二区| 日本道色综合久久| 国产精品私房写真福利视频| 三级在线观看一区二区 | 亚洲地区一二三色| 国产成人亚洲综合色影视|