ProCon说明   快速入门   运动控制   EtherCAT   实时程序   API函数   控件库   硬件说明   问题排查   示例代码  
  

锁存器

本节主要介绍内容如下:


       注意
        
  • 32位宽度
  • 脉冲轴带探针模式的回原点会在内部用到锁存器,请在回原点完成后重新设置锁存参数。
  • 锁存数据可缓存32个。
  • 热复位时锁存器会自动关闭。
  • 此功能为本地脉冲卡功能。


相关函数

          

YKM_SetCaptureConfigPCI 锁存器设置配置参数
YKM_GetCaptureConfigPCI 锁存器获取配置参数
YKM_GetCaptureStatusPCI 锁存器获取锁存状态
YKM_GetCaptureValuePCI 锁存器获取锁存值
YKM_StartCapturePCI 启动锁存器
YKM_StopCapturePCI 停止锁存器


       注意
        


运动说明

        

锁存器可快速锁存当前位置,无触发延时。



流程图

        



程序编写

          

RetCode result;
int exit_cmd = 0;
UINT32 axisIndex = 0;
UINT32 axisIndex = 0;
//库加载

result = YKM_LoadLib();
YKM_BusInfo busInfo;

//等待系统初始化完成
while (!exit_cmd)
{
  result = YKM_GetBusInfo(&busInfo);
  if (busInfo.running)
    break;
  Sleep(100);
}
//锁存器设置配置参数

YKM_CaptureConfig captureConfig;
memset(&captureConfig, 0, sizeof(YKM_CaptureConfig));
captureConfig.edge = 0;
captureConfig.source_type = 0;
result = YKM_SetCaptureConfigPCI(0, chlCap, captureConfig);
//启动锁存器

result = YKM_StartCapturePCI(0, 0);
//获取锁存器状态及值

while (!exit_cmd)
{
  UINT32 cardIndex = 0, channel = 0, status = 0;
  INT32 value = 0;
  YKM_GetCaptureStatusPCI(cardIndex, channel, &status);
  if (status != 0)
  {
    YKM_GetCaptureValuePCI(0, channel, &value);
    printf("CaptureValue: %d\t", value);
  }
  Sleep(10);
}



常见问题及说明

          



  
Copyright © 2015 深圳市优易控软件有限公司 www.proutech.com