在SimpleMAC自带的的 talk.c 里,实现的是串口聊天程序。在两个PC机端各自输入什么对方就接受什么。但这个程序时点对点的,PAN ID已设定一致,即: ST_RadioSetNodeId(0x1604); ST_RadioSetPanId(0x1604); 我现在要想组网,各个节点往协调器发送自己UART接受的数据。参考 talk.c,我的程序如下。但还是没有实现,有劳GGJJ帮忙看一下,在此先谢了! void sendSerialData(u8 length, u8 *data) //节点向SUN发送数据 { u8 packet[128]; //Length packet[0] = (length + 11 + 2); packet[1] = FCF_DATA + FCF_ACKREQ + FCF_INTRAPAN; packet[2] = FCF_SHORTDST + FCF_SHORTSRC; //New sequence number currSeqNum++; packet[3] = currSeqNum; //dst PAN ID packet[4] = (ST_RadioGetPanId()>>0)&0xFF; packet[5] = (ST_RadioGetPanId()>>8)&0xFF; //Short dst addr packet[6] = (0xFFFF>>0)&0xFF; packet[7] = (0xFFFF>>8)&0xFF; //Short src addr packet[8] = (ST_RadioGetNodeId()>>0)&0xFF; packet[9] = (ST_RadioGetNodeId()>>8)&0xFF; //payload type packet[10] = PT_GENERIC_DATA; //一般数据包类型 packet[11] = PT_CHARS; //字符串标志 halCommonMemCopy(packet+11, data, length); txComplete = FALSE; enqueueTxPacket(TRUE, 0xFFFF, packet, 0); }/* end sendSerialData() */ switch(packetType) { //SUN接受到数据并输出 case (GENERIC_DATA_PACKET): //executes on SUN and PLANET RX_DETAILS(printf("GENERIC_DATA_PACKET\r\n");) if(rxData.packet[payloadStart+1]==PT_CHARS){ //字符串标志的 for(i=12;1 |