在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 51單片機(jī)+315M無線射頻模塊發(fā)射程序

            51單片機(jī)+315M無線射頻模塊發(fā)射程序

            作者: 時(shí)間:2016-11-30 來源:網(wǎng)絡(luò) 收藏

            recv_bit_p--;
            if(recv_bit_p == 0){//接收完一字節(jié)
            recv_bit_p = 8;
            //serial_out(recving_byte);//輸出接收到的字符
            recv_buf[recv_byte_p] = recving_byte;
            recv_byte_p++;
            if(recv_byte_p == recv_byts){
            recv_step = 0;
            recv_stat = RECV_SUCCESS;
            }
            }
            }
            }

            本文引用地址:http://www.biyoush.com/article/201611/323711.htm

            //=============================================================
            //接收程序 結(jié)束
            //=============================================================

            #define SEND_DELAY_TIME 20//防碰撞延遲(單位:毫秒)
            unsigned char send_delay = SEND_DELAY_TIME;
            #define VALID_PULS_COUNT 10
            unsigned char valid_puls_counts = VALID_PULS_COUNT;

            //碰撞檢測(cè)在該函數(shù)中實(shí)現(xiàn).由于無線模塊本身的限制,碰撞檢測(cè)為非完全檢測(cè),只能在發(fā)送前
            //檢測(cè)是否有其它單元在使用信道,在發(fā)送過程中受到的碰撞干擾是無法檢測(cè)到的.經(jīng)測(cè)試,效果還行
            void wirless(){
            if (send_stat == SEND_PROGRESSING && send_delay == 0){
            send();
            if (send_stat == SEND_SUCCESS)
            send_delay = SEND_DELAY_TIME;
            }else{
            recv();
            if (recv_step > HEAD_NEED_RECIVED)//如果檢測(cè)到當(dāng)前有其它單元正在發(fā)送,繼續(xù)等待
            send_delay = SEND_DELAY_TIME;
            else{
            if(TEST_PULS(w_data, PULS_0_WIDTH)//如果檢測(cè)到當(dāng)前有其它單元正在發(fā)送,繼續(xù)等待
            || TEST_PULS(w_data, PULS_1_WIDTH)
            //|| TEST_PULS(w_data, PULS_HEAD_WIDTH)
            || TEST_PULS(w_data, PULS_START_WIDTH)
            //|| TEST_PULS(w_data, PULS_STOP_WIDTH)
            ){
            if (valid_puls_counts)
            valid_puls_counts--;
            else
            send_delay = SEND_DELAY_TIME;
            }else{
            valid_puls_counts = VALID_PULS_COUNT;
            }
            }
            }
            }

            #define SCMD_SET_PORT 0x51
            #define SCMD_GET_PORT 0x52

            #define SCMD_RESET 0x61

            #define SCMD_LCD_OUTSTR 0x71
            #define SCMD_LCD_RESET 0x72
            #define SCMD_LCD_SETXY 0x73
            #define SCMD_LCD_SETLINE 0x74
            #define SCMD_LCD_CLEAR 0x75


            #define SRESP_GET_PORT_ERROR 0x41
            #define SRESP_SET_PORT_ERROR 0x42

            #define HEART_BEAT_INTERVAL 100//心跳間隔 X / 1000 秒
            unsigned int heart_beat_timer = HEART_BEAT_INTERVAL;
            unsigned int last_jiffies=0;

            void main(){

            init_serialcomm();
            //P0=0xff;
            //P2=0x00; ;
            sys_init();

            LED1 = 0;
            LED2 = 1;
            //send_string_com("ok",2);
            //lcd_reset();
            //lcd_power_on();
            //lcd_self_test();

            while(1){

            if (jiffies - last_jiffies >= 50){//每次中斷為50us,所以要20次才為1ms
            last_jiffies = jiffies;
            heart_beat_timer--;

            if (send_stat == 0 ){//碰撞測(cè)試

            ET0=0;
            ReadTemperature();

            clock_init_again();

            START_SEND(8);
            send_buf[1]=Te/10+0x30;
            send_buf[2]=Te%10+0x30;
            send_buf[3]=.;
            send_buf[4]=Te_D/10+0x30;
            send_buf[5]=(Te_D%10)+0x30;
            send_buf[6]=D;
            send_buf[7]=