OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 2226|回复: 2

我在用Freemodbus调试时发送给主机 主机不应答!!

[复制链接]

1

主题

4

帖子

0

精华

新手入门

积分
17
金钱
17
注册时间
2019-1-1
在线时间
2 小时
发表于 2019-1-1 23:22:06 | 显示全部楼层 |阅读模式
本帖最后由 mengguan235 于 2019-1-1 23:39 编辑

大神们  我在用Freemodbus调试时发送给主机  主机不应答!!
请问大神们什么地方出问题了!!
main函数
[mw_shl_code=c,true]#include "sys.h"
#include "delay.h"
#include "led.h"
#include "mb.h"  //FreeModbus
#include "mbport.h"
#include "port.h"

/************************************************
ALIENTEK¾«ó¢STM32¿a·¢°åêμÑé1
ÅüÂíμÆêμÑé
¼¼êõÖ§3Ö£owww.openedv.com
ìÔ±|μêÆì£ohttp://eboard.taobao.com
1Ø×¢Î¢DÅ1«Öúƽì¨Î¢DÅoÅ£o"ÕyμãÔ-×ó"£¬Ãa·Ñ»ñè¡STM32×êáÏ¡£
1ãÖYêDDÇòíμç×ó¿Æ¼¼óDÏT1«Ë¾  
×÷ÕߣoÕyμãÔ-×ó @ALIENTEK
************************************************/
int main(void)
{        
                u8 i = 0;
        NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
        delay_init();            //Ñóê±oˉêy3õê¼»ˉ        
        LED_Init();                          //3õê¼»ˉóëLEDᬽóμÄó2¼t½ó¿ú
        eMBInit(MB_RTU, 0x0A, 1, 38400, MB_PAR_NONE);  //3õê¼»ˉFreeModbus

  eMBEnable();  //Æô¶ˉFreeModbus
         
        while(1)
        {
                (void)eMBPoll();  //2éÑˉêy¾YÖ¡
     usRegInputBuf[0]++;  //2aêÔ¶áè¡êäèë¼Ä′æÆ÷óÃ
               
                if (usRegInputBuf[0] > 250)  //·àÖ13¬±ê
                {
                        usRegInputBuf[0] = 0;
                }
               
                delay_ms(10);
                i++;
                if (i >= 50)
                {
                        i = 0;
                        LED0 = !LED0;
                }
        }
}

#ifdef  USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */  
void assert_failed(uint8_t* file, uint32_t line)  
{  
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */  
   
  /* Infinite loop */  
  while (1)  
  {  
  }  
}
#else
void __aeabi_assert(const char * x1, const char * x2, int x3)
{
}
#endif


[/mw_shl_code]
微信图片_20190101233441.png


微信图片_20190101231719.png
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

1

主题

4

帖子

0

精华

新手入门

积分
17
金钱
17
注册时间
2019-1-1
在线时间
2 小时
 楼主| 发表于 2019-1-1 23:23:39 | 显示全部楼层
是我发送的报文不对吗    应该发送什么报文呢  
回复 支持 反对

使用道具 举报

1

主题

4

帖子

0

精华

新手入门

积分
17
金钱
17
注册时间
2019-1-1
在线时间
2 小时
 楼主| 发表于 2019-1-2 19:21:19 | 显示全部楼层
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-22 23:26

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表