蜂鸣器外接在P2_4 口,不在协议栈中直接给高电平就能够成功点响,但只要一写入协议栈中蜂鸣器就会没有反应,代码大概就是在发送一串字符串出去后如果协调器没有接受,终端这里就会触发蜂鸣器进行提醒。不知道是在协议栈中P2_4是被占中了还是怎样,就是没一点响应。
代码如下:
if ( events & SDApp_MY_EVT ) { char theMessageData[] = "hello worker.!"; SDApp_DstAddr.addrMode = (afAddrMode_t)AddrGroup; //发送模式为组播的模式 SDApp_DstAddr.addr.shortAddr = 0x0002; //接收模块的组编号 // Take the first endpoint, Can be changed to search through endpoints SDApp_DstAddr.endPoint = SDApp_ENDPOINT ; //接收模块的端点房间号 //SDApp_epDesc 结构体 端点描述符有源端点的信息,也是10 if ( AF_DataRequest( &SDApp_DstAddr, &SDApp_epDesc, / 发送函数 0x0001, //族编号 (byte)osal_strlen( theMessageData ) + 1, //发送字符串的长度 (byte *)&theMessageData, //字符串内容数组的首地址 &SDApp_TransID, AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS ) { HalLedBlink( HAL_LED_1,5,50,1000 ); } else { P2SEL &= 0xef; //1110 1111 P2DIR |= 0x10; //0001 0000 P2_4 = 1; //在这里触发,但没有任何响应</strong></span> HalLedBlink( HAL_LED_2,5,50,1000 ); } |