简体   繁体   English

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

[英]Timer in VC++ for Non-GUI Applications

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!! 问题是我目前没有任何嵌入式模拟器(由于某些该死的原因!),我想对其进行测试...我正在使用Visual Studio 2008(多么可惜!)。...代码完全在C语言中但是由于VS 2008不支持C,所以我将文件存储为.cpp ....但是没有使用C ++概念!

What all I require is a Timer which would generate Interrupt after every 1 millisecond! 我需要的是一个计时器,它将在每1毫秒后产生一次中断!

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. 我不想制作GUI。 I searched for Timers and all were for MFC application.... If there isn't any option, I will make a rough MFC... 我搜索了Timers,所有这些都是针对MFC应用程序的。...如果没有任何选择,我将制作一个粗糙的MFC ...

Regards!! 问候!!

For high precision timers the your best bet is probably CreateTimerQueueTimer (not used personally). 对于高精度计时器,最好的选择可能是CreateTimerQueueTimer (不个人使用)。

Personally I used to use timeSetEvent but that was way back years and years ago. 我个人曾经使用过timeSetEvent但是那是几年前的事了。

You can try the Boost Asio Timers too. 您也可以尝试Boost Asio计时器 If you don't have it setup, please refer here: Getting Started on MS Windows . 如果没有安装程序,请参阅此处: MS Windows入门

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM