VC中的定时器++对于非 GUI 应用程序

发布于 2024-10-05 04:22:00 字数 347 浏览 1 评论 0原文

我想测试专为在微控制器上运行而设计的代码,并且它与平台无关。

问题是我目前没有任何嵌入式模拟器(由于某些该死的原因!),我想测试它...我正在使用 Visual Studio 2008(真可惜!!)...代码完全用 C 语言编写但由于 VS 2008 不支持 C,我将文件存储为 .cpp...但没有使用 C++ 概念!

我所需要的只是一个每 1 毫秒生成一次中断的定时器!

还有一件事......我可以配置一些东西,以便如果我按键盘上的某个键就会生成中断......

我不想制作GUI。我搜索了Timers,都是MFC应用程序......如果没有任何选项,我会做一个粗略的MFC......

问候!

I want to test a code which is designed for running on a Microcontroller and it is platform independent.

Problem is I currently don't have any Embedded simulator (due to some damn reason!) and I want to test it... I am using Visual Studio 2008 (What a Pity!!).... Code is entirely in C but as VS 2008 doesn't support C, I have stored files as .cpp.... But No C++ concept is used!!

What all I require is a Timer which would generate Interrupt after every 1 millisecond!

And One more thing.... Can I configure something so that an Interrupt will be generated if I press certain key on Keyboard....

I don't want to make GUI. I searched for Timers and all were for MFC application.... If there isn't any option, I will make a rough MFC...

Regards!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

多情出卖 2024-10-12 04:22:00

对于高精度计时器,最好的选择可能是 CreateTimerQueueTimer(个人没有使用过)。

我个人曾经使用 timeSetEvent 但这已经是很多年前的事了。

For high precision timers the your best bet is probably CreateTimerQueueTimer (not used personally).

Personally I used to use timeSetEvent but that was way back years and years ago.

薯片软お妹 2024-10-12 04:22:00

您也可以尝试 Boost Asio 计时器。如果您还没有设置,请参阅此处:入门在 MS Windows 上。

You can try the Boost Asio Timers too. If you don't have it setup, please refer here: Getting Started on MS Windows.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文