如何使用C ++生成数字脉冲 [英] How can I generate a Digital Pulse with C++

查看:154
本文介绍了如何使用C ++生成数字脉冲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试通过Matlab输出数字脉冲.
因为此信号对于matlab来说太小,所以我认为必须编写一个C ++源代码并从MATLAB调用它.
我有一个数据采集板(我的PC上的PCI卡),该板通过传感器连接到外部板.该传感器必须通过DAQ-Board的数字输出端以这个脉冲(大约40 kHz-高13µs和低13µs)为该时钟供电,最终通过模拟输入到DAQ-Board来获取数据.

希望有人能帮忙.

我很高兴听到任何提示或建议.

Hi,

I''m trying to Output a Digital Pulse through Matlab.
Because this signal is too Small for matlab, I figured I must write a C++ Source Code and calling it from MATLAB.
I have a Data Acquisition Board (a PCI-Card on my PC) which connected to an external Board with a Sensor. this sensor must be Clocked with this Pulse (about 40 kHz - so 13µs High and 13µs Low) through a Digital Output from the DAQ-Board, eventually to acquire Data through an Analog Input to the DAQ-Board.

I hope someone can help.

I will be pleasured to hear any tips or suggestions.

Regards.

推荐答案

通常很难在PC上通过软件生成40 kHz方波(频率精度会因PC的繁忙程度而有很大差异. ).而且我什至不确定是否可以达到40 kHZ.

但是根据DAQ板,您应该能够通过使用板上的计时器/计数器来产生这样的信号.如果您的DAQ板确实具有这样的功能,则应在手册中进行说明.
Generating 40 kHz square waves by software on a PC is typically not easy to do (frequency accuracy will vary widely based on how busy or not your PC is). And i''m not even sure if 40 kHZ is possible.

But depending on the DAQ board you should be able to generate such a signal by using timers/counters on the board. If your DAQ board does have such a feature, it should be described in the manual.


通过阅读您的帖子,您似乎需要某种实时功能;不幸的是,这在Windows上均不可用,无论是使用Matlab,C/C ++还是任何其他语言.这是由于操作系统体系结构所致:Microsoft Windows无法确保严格的计时性能(即微秒级).
为此,您应该使用第三方的实时扩展.最著名的是 Venturcom RTX ,您可以在以下网站上找到有关它的更多详细信息:

< ahref ="http:www.intervalzero.com =""rtx.htm" ="> http://www.intervalzero.com/rtx.htm [
By reading your post it seems that you need some kind of real-time feature; unfortunately this is not available on Windows, both using Matlab, C/C++ or any other language. This is due to the operating system architecture: Microsoft Windows is not able to ensure strict timing performances (i.e. in the order of microseconds).
To do it you should use real-time extensions from a third-party; the most famous are RTX from Venturcom and you can find more details on it on this web-site:

<ahref="http: www.intervalzero.com="" rtx.htm"="">http://www.intervalzero.com/rtx.htm[^]

However be aware that such extensions require a developer license and runtime royalties (I don''t know the prices but someone told be that they we talk about some tousand dollars for the developer license and about 200 dollars for each runtime).


@ r.ps

谢谢你们的回答.
是的,我的DAQ板支持时钟/计时器.但是MATLAB不支持.
我已经问过MATLAB支持人员,他们告诉我必须使用C ++源代码并使用MEX文件来解决此问题.
我在用DAQ-Board驱动程序作为API安装的C ++/VB/ActiveX中有很多示例.
绕线与他们一起工作以实现此输出信号?如果可能的话.
@r.ps

Thank you both for the answer.
Yes my DAQ-Board support the Clock/timer. But MATLAB don´t.
I already asked MATLAB Support, they told me I must use a C++ Source and make MEX-File from it to workaround this Problem.
I have many examples in C++/VB/ActiveX installed with the DAQ-Board driver as APIs.
Shound work with them to realize this Output Signal ? If it is possible.


这篇关于如何使用C ++生成数字脉冲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆