canfeistval 使用笔记

1.关于SDO发送,SDO需要提前在0x1280中定义SDO服务,如果没有定义则无法发出SDO.

这时候可以使用

/**
 * @ingroup sdo 
 * @brief Used to send a SDO request frame to write in a distant node dictionnary.
 * @details The function Callback which must be defined in the user code is called at the
 * end of the exchange. (on succes or abort). First free SDO client parameter is
 * automatically initialized for specific node if not already defined.
 * @param *d Pointer to a CAN object data structure
 * @param nodeId Node Id of the slave
 * @param index At index indicated
 * @param subIndex At subIndex indicated
 * @param count number of bytes to write in the dictionnary.
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
 * @param *data Pointer to data
 * @param Callback Callback function
 * @param endianize When not 0, data is endianized into network byte order
 *                  when 0, data is not endianized and copied in machine native
 *                  endianness
 * @param useBlockMode true if block mode transfer is used
 * @return 
 * - 0 is returned upon success.
 * - 0xFF is returned when error occurs.
 */
UNS8 writeNetworkDictCallBackAI (CO_Data* d, UNS8 nodeId, UNS16 index,
		       UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize, UNS8 useBlockMode);

会自动从未使用的SDO服务中分配一个。

OD服务如下:

/* index 0x1200 :   Server SDO Parameter. */
                    UNS8 CIA402_highestSubIndex_obj1200 = 2; /* number of subindex - 1*/
                    UNS32 CIA402_obj1200_COB_ID_Client_to_Server_Receive_SDO = 0x600;	/* 1536 */
                    UNS32 CIA402_obj1200_COB_ID_Server_to_Client_Transmit_SDO = 0x580;	/* 1408 */
                    subindex CIA402_Index1200[] = 
                     {
                       { RO, uint8, sizeof (UNS8), (void*)&CIA402_highestSubIndex_obj1200, NULL },
                       { RO, uint32, sizeof (UNS32), (void*)&CIA402_obj1200_COB_ID_Client_to_Server_Receive_SDO, NULL },
                       { RO, uint32, sizeof (UNS32), (void*)&CIA402_obj1200_COB_ID_Server_to_Client_Transmit_SDO, NULL }
                     };

/* index 0x1280 :   Client SDO 1 Parameter. */
                    UNS8 CIA402_highestSubIndex_obj1280 = 3; /* number of subindex - 1*/
                    UNS32 CIA402_obj1280_COB_ID_Client_to_Server_Transmit_SDO = 0x600;	/* 1537 */
                    UNS32 CIA402_obj1280_COB_ID_Server_to_Client_Receive_SDO = 0x580;	/* 1409 */
                    UNS8 CIA402_obj1280_Node_ID_of_the_SDO_Server = 0x1;	/* 1 */
                    subindex CIA402_Index1280[] = 
                     {
                       { RO, uint8, sizeof (UNS8), (void*)&CIA402_highestSubIndex_obj1280, NULL },
                       { RW, uint32, sizeof (UNS32), (void*)&CIA402_obj1280_COB_ID_Client_to_Server_Transmit_SDO, NULL },
                       { RW, uint32, sizeof (UNS32), (void*)&CIA402_obj1280_COB_ID_Server_to_Client_Receive_SDO, NULL },
                       { RW, uint8, sizeof (UNS8), (void*)&CIA402_obj1280_Node_ID_of_the_SDO_Server, NULL }
                     };

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值