完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
大家好,我有一个PIC32 MX695F512H运行MLAYV2013-0615。我已经修改了它与我的桌面应用程序交流。我可以与我的应用程序交流,只要应用程序启动通信。如何更改Debug Task*(),以便我的PIC32向桌面应用程序发送一个命令。比如说,当SDENFIN变量等于1时,我想把信息发送到App。但是当我设置断点时,我可以看到在这两种情况下IP地址和MAC地址都是不同的。有人能帮我解决这个问题吗?我试着把ReltEnod保存到一个全局变量中,后来尝试使用它,但不能得到正确的结果。
以上来自于百度翻译 以下为原文 Hi all, I have a PIC32MX695F512H running MLA_v2013-06-15. I have modified it to communicate with my desktop app. I am able to communicate with my app provided the app initiates the communication. How can I change the DiscoveryTask() so that my PIC32 sends a command to the desktop application. lets say, I would like to send information to app when sendInfo variable equals 1. switch(DiscoverySM) { case DISCOVERY_HOME: MySocketPopup = UDPOpenEx(0,UDP_OPEN_SERVER,ANNOUNCE_PORT_NEW_POPUP, ANNOUNCE_PORT_NEW_POPUP); if(MySocketPopup == INVALID_UDP_SOCKET ) //|| MySocketPopup == INVALID_UDP_SOCKET ) return; else DiscoverySM++; break; case DISCOVERY_LISTEN: if(sendInfo == 0) { // Do nothing if no data is waiting if(!UDPIsGetReady(MySocketPopup) )// && !UDPIsGetReady(MySocketPopup)) return; //you need to find third byte foe finding command k=0; while(k<12) { UDPGet(&i); array[k]=i; k++; } UDPDiscard(); } // We received a discovery request, reply when we can DiscoverySM++; // Change the destination to the unicast address of the last received packet memcpy((void*)&UDPSocketInfo[MySocketPopup].remote.remoteNode, (const void*)&remoteNode, sizeof(remoteNode)); //memcpy((void*)&UDPSocketInfo[MySocketPopup].remote.remoteNode,(const void*)&remoteNode,sizeof(remoteNode)); // No break needed. If we get down here, we are now ready for the DISCOVERY_REQUEST_RECEIVED state case DISCOVERY_REQUEST_RECEIVED: if(!UDPIsPutReady(MySocketPopup) ) //|| !UDPIsPutReady(MySocketPopup)) return; if(sendInfo == 0) { //Send back the command or query byte UDPPut(array[1]); UDPPut('r'); UDPPut('n'); } else { UDPPutArray(ReceivedArray,strlen(ReceivedArray)); UDPPut('r'); UDPPut('n'); sendInfo = 0; } // Send the packet UDPFlush(); //UDPClose(MySocket); // Listen for other discovery requests DiscoverySM = DISCOVERY_LISTEN; break; case DISCOVERY_DISABLED: break; } But when I set breakpoints, I can see that the IPAddress and MAC address is different in both cases. Can someone help me solve this issue ? I tried saving the remoteNode to a global variable and tried using it later, but couldnt get it correcty. |
|
相关推荐
7个回答
|
|
|
HII将建议您在桌面应用程序中实现一个UDP服务器,它将侦听某个端口号。当变量设置为1时,您可以为目的地端口打开UDP套接字,将其作为应用程序的UDP服务器端口,连接到服务器并向应用程序发送UDP发现消息。
以上来自于百度翻译 以下为原文 Hi I would suggest you implement a udp server within your desktop app which will listen on a certain port number. As the variable is set to 1 , you may open udp socket for client with destination port as APP's UDP server port, connect to server and send udp discovery message to the app. Thanks, |
|
|
|
|
|
谢谢你的回答,这就是问题所在,我怎样才能从PIC开始传送呢?
以上来自于百度翻译 以下为原文 Thanks for responding am.sh That;s the problem, how can I initiate the transfer from pic ? |
|
|
|
|
|
您好,请参考微芯片解决方案中的UDP客户端DMEO应用程序。考虑到APP和PIC32板在同一网络中,2个选项:1)一旦变量为1,就打开PIC32上的UDP套接字。连接到服务器Socket,这是桌面/手机上的应用程序。当UDP客户端连接到App Server时,UDP客户端连接到应用服务器。当变量为1时,用本地/ GOLABL缓冲区中存储的消息发送UDP包。
以上来自于百度翻译 以下为原文 Hi, Please do refer to udp client dmeo application in the microchip solution. Considering the APP and the PIC32 board are in the same network, 2 options: 1) Open the udp socket on PIC32 as soon as the Variable is 1. Connect to server socket which is your APP on desktop/cell phone. Send udp packet with the message stored in the local/gloabl buffer. OR 2) As soon as the board boots up, udp client connects to the APP server. As soon as the Variable is 1, send udp packet with the message stored in the local/gloabl buffer. Thanks, |
|
|
|
|
|
你好,我在哪里可以找到UDP演示应用程序?不要在我的Microchip解决方案中。
以上来自于百度翻译 以下为原文 Hi, Where can I find the UDP demo application ? Ii dont have it in my microchip solution>tcpip folder |
|
|
|
|
|
嗨,你好像正在使用Microchip MLA库。我不确定MLA上的演示路径,但是,我记得MLA在以太网媒体上有UDP演示。如果你使用Picro32的和声库,可以在这里找到演示的TCPIpUDPyServTCPIpUDPyServTCPPIpUDPcliclithServer:R驱动器& GT;:Microchip和声 V1Y09AppTCPIP谢谢,
以上来自于百度翻译 以下为原文 Hi, You seems to be using the Microchip MLA Library. I am not sure about the path of the demos on MLA, however, I remember MLA had UDP Demos over Ethernet media. If you are using the Harmony Library for PIC32 , the demos tcpip_udp_server tcpip_udp_server tcpip_udp_client_server can be found here: Thanks, |
|
|
|
|
|
嗨,我好像找不到我的MLA(2013-06-15)。(谢谢)
以上来自于百度翻译 以下为原文 Hi, I cant seem to find it in my MLA (2013-06-15). :( Thanks |
|
|
|
|
|
嗨,我建议参考这些演示文稿的和声库。我在前面的文章中提到了这些演示的和谐路径。如果你使用MLA库,你可能需要做API调整。谢谢,
以上来自于百度翻译 以下为原文 Hi, I would recommend to refer to Harmony Library for these demos. I mentioned the path for these demos in Harmony in earlier post. You may need to do API adjustments if you are using MLA library. Thanks, |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475 浏览 0 评论
5794 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1124浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1098浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 13:58 , Processed in 0.852187 second(s), Total 82, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
405