0

我正在尝试使用 S-Function(C 语言)在 Simulink 中创建一个闪烁过程,我需要发送一些帧,两个连续帧之间的时间应该是 200 毫秒。我怎样才能实现这个等待时间?有没有实施的可能?

4

2 回答 2

0

您可以在下面找到我在函数中遵循的步骤:

1.create first frame
2.send first frame
3.save the time when I send first frame
4.if(current_time - time_send_FF == x ms)
    5. calculate nr of consecutive frame
    6. for each consecutive frame
        7. create consecutive frame
        8. send consecutive frame
        9. save the time when I send consecutive frame 
        10. if(current_time - time_send_CF == x ms)
            11. jump to step 6
        else 
            12. check again if(current_time - time_send_CF == x ms)
   else
        13.check again  if(current_time - time_send_FF == x ms)

问题是我无法存储发送第一个/连续帧的时间,因为即使我使用全局 DWOrk/RWork 数组,它也会不断增加,当我尝试计算 current_time 和 time_send_FF 之间的差异时,结果始终为 0 . 我可以使用时钟块作为输入来访问系统时间。我应该尝试什么其他方法...谢谢!

于 2014-04-02T11:59:33.967 回答
0

如果您想每 200 毫秒更新一次,请将您的 S-Function 放入每 200 秒触发一次的子系统中。

于 2014-04-01T12:24:21.097 回答