跳转至

DLLPcoGetFiredCount

函数 DLLPcoGetFiredCount 读取轴所在驱动器的 PCO 已触发脉冲计数。即时 SDO 读(不经指令队列),计数自上次 PCO ARM 起累计。

所属:C/C++ API 函数索引

C/C++

ErrorCode DLLPcoGetFiredCount(INT_PTR hClientHandle, int axis, int* outCount);

C#

controller.Commands[TaskId].PCO.Count(axis)

参数

hClientHandle (INT_PTR)

客户端会话句柄,来自 DLLSysConnect 获取。

axis (int)

轴号(0-indexed)。

outCount (int*)

输出:已触发次数。

返回值

返回 ErrorCodeNoError (0) 表示成功,正值为错误码,详见 SDK 发布头 ErrorCode.h。

说明

PCO 配置经 DLLExecute 下发(PCO CONFIG / PCO ARM 等,词汇见 Terminal 指令 · PCO);本函数是 PCO 唯一的查询接口,对应 OneScript PcoCount

示例

int fired = 0;
ErrorCode err = DLLPcoGetFiredCount(handle, 0, &fired);
if (err == NoError) {
    printf("fired = %d\n", fired);
}

相关函数