IFIX VBA的几个小窍门

 1、从后台调度中访问或修改全局变量的代码

 

描述:

在iFIX中使用调度要后台运行的时候需要启动FixBackgroundServer程序,而该程序实际上是启动了独立于Workspace的进程,所以在后台调度中不能直接访问全局变量。下面的例子代码描述了怎样访问的方法:

 

 

" First get a pointer to the Application object in the Workspace

Dim WrkSpcApp As Object

Set WrkSpcApp = GetObject("", "Workspace.Application")

 

" Get a pointer to the Variable object called Variable1 in the User globals

Dim TargetVar As Object

Set TargetVar = WrkSpcApp.Documents("User").Page.FindObject("Variable1")

 

" Set the current value in the variable object to a 1

TargetVar.CurrentValue = 1

 

2、脉冲输出示例

Dim PauseTime, Start

CloseDigitalPoint "Fix32.FIX.DDD.F_CV"

PauseTime = 0.8  " 设置暂停时间。

  Start = Timer  " 设置开始暂停的时刻。

  Do While Timer < Start + PauseTime

    DoEvents  " 将控制让给其他程序。

  Loop

OpenDigitalPoint "Fix32.FIX.DDD.F_CV"

 

3、显示通讯状态

Is there a way to view communication status of the driver without using Mission Control?

Resolution

Using a digital input block reading a hardware register, the A_cualm field will be utilized. Chain the DI block to an event action block to a digital output tag using the SIM driver. In the event action block use the following script:

IF the A_cualm =com

Then set DO =1

Else set the DO=0

A data link can be made to the Sim block. The value of this block will determine the status of the communcation.</

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值