在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 指針的一種用法(優(yōu)化代碼)

            指針的一種用法(優(yōu)化代碼)

            作者: 時(shí)間:2016-11-29 來(lái)源:網(wǎng)絡(luò) 收藏
            /************************************************************************
            函數(shù)名 :unsigned char CAN_Send_dat(CAN_DAT *can_tmp,unsigned char pir)功能  :can發(fā)送參數(shù)  :*can_tmp 數(shù)據(jù)包 pir: 優(yōu)先級(jí) 0~3返回 ?。?->緩沖池滿(mǎn)需要等待下次裝入發(fā)送緩沖池 0->成功放入緩沖池************************************************************************/unsigned char CAN_Send_dat(CAN_DAT *can_tmp,unsigned char pir){unsigned char n,flag;unsigned char temp;unsigned char *P_addr,*P_addr_temp;flag = 0;if((TXB0CON&0x08)==0){P_addr = (unsigned char*)(&TXB0CON);flag = 1;}if((TXB1CON&0x08)==0){P_addr = (unsigned char*)(&TXB1CON);flag = 1;}if((TXB2CON&0x08)==0){P_addr = (unsigned char*)(&TXB2CON);flag = 1;}if(flag==1){P_addr_temp = P_addr;*P_addr = pir;P_addr++;if(can_tmp->IDR_RTR&0x02)//擴(kuò)展標(biāo)識(shí)符{*P_addr = ((can_tmp->ID[2]>>5)|(can_tmp->ID[3]<<3));temp = can_tmp->ID[2]&0x03;temp|=((can_tmp->ID[2]&0x1C)<<3);temp|= 0x08;P_addr++;*P_addr = temp;P_addr++;*P_addr = can_tmp->ID[1];P_addr++;*P_addr = can_tmp->ID[0];P_addr++;}else{*P_addr = ((can_tmp->ID[1]<<5)|(can_tmp->ID[0]>>3));;P_addr++;*P_addr = (can_tmp->ID[0]<<5);P_addr+=3;}*P_addr = can_tmp->length;P_addr++;for(n=0;nlength;n++){*P_addr =can_tmp->DATA[n];P_addr++;}*P_addr_temp |= 0x08;return 0;}return 1;}/************************************************************************函數(shù)名 :unsigned char CAN_Send_dat(CAN_DAT *can_tmp,unsigned char pir)功能  :can發(fā)送參數(shù) ?。?can_tmp 數(shù)據(jù)包 pir: 優(yōu)先級(jí) 0~3返回  :1->緩沖池滿(mǎn)需要等待下次裝入發(fā)送緩沖池 0->成功放入緩沖池************************************************************************/unsigned char CAN_Send_dat(CAN_DAT *can_tmp,unsigned char pir){unsigned char n;unsigned char temp;unsigned char *P_addr;if((TXB0CON&0x08)==0){// TXB0CON&=0xfc;//bit3=0標(biāo)準(zhǔn)標(biāo)識(shí)符,bit3=1擴(kuò)展標(biāo)識(shí)符,bit7-5:標(biāo)準(zhǔn)標(biāo)識(shí)符2-0位,bit7-5 擴(kuò)展ID[16-17]TXB0CON = pir;//|= pir;           //設(shè)置TXB0為最高優(yōu)先級(jí)3if(can_tmp->IDR_RTR&0x02)//擴(kuò)展標(biāo)識(shí)符{TXB0EIDL  = can_tmp->ID[0];//擴(kuò)展ID[0-7]TXB0EIDH  = can_tmp->ID[1];//擴(kuò)展ID[8-15]TXB0SIDL  = can_tmp->ID[2]&0x03;//擴(kuò)展ID[16-17]temp= ((can_tmp->ID[2]&0x1C)<<3);TXB0SIDL |= temp;//標(biāo)準(zhǔn)[0-3]TXB0SIDL |= 0x08;TXB0SIDH=((can_tmp->ID[2]>>5)|(can_tmp->ID[3]<<3));//標(biāo)準(zhǔn)標(biāo)識(shí)符的10-3位}else{TXB0SIDL = (can_tmp->ID[0]<<5);//標(biāo)準(zhǔn)[0-3]TXB0SIDH = ((can_tmp->ID[1]<<5)|(can_tmp->ID[0]>>3));}//if(can_tmp->IDR_RTR&0x01)can_tmp->length|=0x40;TXB0DLC=can_tmp->length;P_addr = &TXB0D0;for(n=0;nlength;n++){*P_addr =can_tmp->DATA[n];P_addr++;}TXB0CON=TXB0CON|0x08; /* bit3(TXREQ)=1請(qǐng)求發(fā)送 */return 0;}if((TXB1CON&0x08)==0){// TXB1CON&=0xfc;TXB1CON = pir;//|= pir;if(can_tmp->IDR_RTR&0x02)//擴(kuò)展標(biāo)識(shí)符{TXB1EIDL  = can_tmp->ID[0];//擴(kuò)展ID[0-7]TXB1EIDH  = can_tmp->ID[1];//擴(kuò)展ID[8-15]TXB1SIDL  = can_tmp->ID[2]&0x03;//擴(kuò)展ID[16-17]temp= ((can_tmp->ID[2]&0x1C)<<3);TXB1SIDL |= temp;//標(biāo)準(zhǔn)[0-3]TXB1SIDL |= 0x08;TXB1SIDH=((can_tmp->ID[2]>>5)|(can_tmp->ID[3]<<3));//標(biāo)準(zhǔn)標(biāo)識(shí)符的10-3位}else{TXB1SIDL = (can_tmp->ID[0]<<5);//標(biāo)準(zhǔn)[0-3]TXB1SIDH = ((can_tmp->ID[1]<<5)|(can_tmp->ID[0]>>3));}//if(can_tmp->IDR_RTR&0x01)can_tmp->length|=0x40;TXB1DLC=can_tmp->length;P_addr = &TXB1D0;for(n=0;nlength;n++){*P_addr =can_tmp->DATA[n];P_addr++;}TXB1CON=TXB1CON|0x08; return 0;}if((TXB2CON&0x08)==0){//TXB2CON&=0xfc;TXB2CON = pir;if(can_tmp->IDR_RTR&0x02)//擴(kuò)展標(biāo)識(shí)符{TXB2EIDL  = can_tmp->ID[0];//擴(kuò)展ID[0-7]TXB2EIDH  = can_tmp->ID[1];//擴(kuò)展ID[8-15]TXB2SIDL  = can_tmp->ID[2]&0x03;//擴(kuò)展ID[16-17]temp= ((can_tmp->ID[2]&0x1C)<<3);TXB2SIDL |= temp;//標(biāo)準(zhǔn)[0-3]TXB2SIDL |= 0x08;TXB2SIDH=((can_tmp->ID[2]>>5)|(can_tmp->ID[3]<<3));//標(biāo)準(zhǔn)標(biāo)識(shí)符的10-3位}else{TXB2SIDL = (can_tmp->ID[0]<<5);//標(biāo)準(zhǔn)[0-3]TXB2SIDH = (can_tmp->ID[1]<<5|(can_tmp->ID[0]>>3));}// if(can_tmp->IDR_RTR&0x01)can_tmp->length|=0x40;TXB2DLC=can_tmp->length;P_addr = &TXB2D0;for(n=0;nlength;n++){*P_addr =can_tmp->DATA[n];P_addr++;}TXB2CON=TXB2CON|0x08; return 0;}return 1;}


            關(guān)鍵詞: 指針優(yōu)化代

            評(píng)論


            技術(shù)專(zhuān)區(qū)

            關(guān)閉