<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > EDA/PCB > 設(shè)計應(yīng)用 > 一種基于SOPC技術(shù)的EPA控制器

          一種基于SOPC技術(shù)的EPA控制器

          作者: 時間:2011-07-01 來源:網(wǎng)絡(luò) 收藏

            其部分報文處理程序如下:

            /*報文發(fā)送*/

            void SendTask(void *pdata){

            struct netconn *conn;

            struct ip_addr remote_addr,local_addr;

            struct netbuf * buf;

            struct udp_pcb * udpbuf;

            struct pbuf * buf;

            char text[] = A static test;

            /*設(shè)置遠程主機的IP地址*/

            remote_addr.addr = htonl(0x8080023D);

            /*設(shè)置本地主機的IP地址*/

            local_addr.addr = htonl(0x80800233);

            for(;;){

            /*建立一個新連接*/

            conn = netconn_new(NETCONN_UDP);

            /*綁定本地IP地址和端**/

            netconn_bind(conn,local_addr,0x88BC);

            /*連接遠程主機*/

            netconn_connect(conn,remote_addr,0x88BC);

            buf = netbuf_new();

            /*建立任意的數(shù)據(jù)*/

            netbuf_ref(buf,text,sizeof(text));

            netconn_send(conn,buf);

            netconn_delete(conn);

            netbuf_delete(buf);

            OSTimeDlyHMSM(0,0,1,0);

            buf = pbuf_alloc(PBUF_RAW, 60,

            PBUF_RAM);

            memcpy(buf->payload,text,

            sizeof(text));

            udpbuf = udp_new();

            udpbuf->local_port = 0x88bc;

            udpbuf->remote_port = 0x88bc;

            udpbuf->local_ip = local_addr;

            udpbuf->remote_ip = remote_addr;

            udp_bind(udpbuf, udpbuf->local_ip,

            udpbuf->local_port);

            udp_sendto(udpbuf,buf,remote_addr,udpbuf->remote_port);

            udp_remove(udpbuf); //釋放

            udp_pcb內(nèi)存

            pbuf_free(buf);

            OSTimeDlyHMSM(0,0,1,0);

            /* Main initializes lwIP, creates a single task and starts task scheduler. */

            void ReceiveTask(void * pdata){//該任務(wù)

            和IP協(xié)議棧相關(guān),該任務(wù)由

            _sys_thread_new函數(shù)來創(chuàng)建

            struct netbuf * buf1,*buf2,*buf1_temp;

            struct netconn * conn1,*conn2;

            void * payload;

            u16_t len;

            struct ip_addr remote_addr,local_addr;

            char text[] = I get a packet,please

            give me another,I need you, baby.;

            remote_addr.addr = htonl

           ?。?x8080023D);

            local_addr.addr = htonl(0x80800233);

            conn1 = netconn_new(NETCONN_

            UDP);

            conn2 = netconn_new(NETCONN_

            UDP);

          p2p機相關(guān)文章:p2p原理


          蜂鳴器相關(guān)文章:蜂鳴器原理


          關(guān)鍵詞: SOPC EPA 控制器

          評論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();