ECAT_Init接口初始化函数

[cpp]  view plain  copy
  1. /  
  2. /** 
  3.  
  4.  \brief    This function initialize the EtherCAT Slave Interface.这个函数初始化EtherCAT从站的接口 
  5. *////  
  6.   
  7. void ECAT_Init(void)  
  8. {  
  9.     UINT8 i;  
  10.     /*Get Maximum Number of SyncManagers获得SM最大的数目*/  
  11.     HW_EscReadByte(nMaxSyncMan, ESC_SM_CHANNELS_OFFSET);  
  12.   
  13.     /* disable all Sync Manager channels 去使能所有的SM通道*/  
  14.     for (i = 0; i < nMaxSyncMan; i++)  
  15.         HW_DisableSyncManChannel(i);  
  16.   
  17.     /* initialize the mailbox handler 初始化所有的邮箱处理*/  
  18.     MBX_Init();  
  19.   
  20.     /* initialize variables 初始化变量*/  
  21.      bApplEsmPending = FALSE;  
  22.      bEcatWaitForAlControlRes = FALSE;  
  23.      bEcatFirstOutputsReceived = FALSE;  
  24.      bEcatOutputUpdateRunning = FALSE;  
  25.      bEcatInputUpdateRunning = FALSE;  
  26.   
  27.     bWdTrigger = FALSE;  
  28.     EcatWdValue = 0;  
  29.   
  30.     Sync0WdCounter = 0;  
  31.     Sync0WdValue = 0;  
  32.     bDcSyncActive = FALSE;  
  33.     bLocalErrorFlag = FALSE;  
  34.     u16LocalErrorCode = 0x00;  
  35.   
  36.     u16ALEventMask = 0;  
  37.   
  38.     /* initialize the AL Status register初始化AL状态寄存器 */  
  39.     nAlStatus    = STATE_INIT;  
  40.     SetALStatus(nAlStatus, 0);  
  41.     nEcatStateTrans = 0;  
  42. #if LEDS_SUPPORTED || ESC_SUPPORT_ECAT_LED  
  43.     u8EcatErrorLed = LED_OFF;  
  44. #endif  
  45.   
  46.     bEscIntEnabled = FALSE;  
  47.   
  48. #if COE_SUPPORTED  
  49.     /* 初始化COE的部分 */  
  50.     COE_Init();  
  51. #endif  
  52.   
  53. }  
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值