⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 speedtst.cpp

📁 精工打印头LTP3445的使用范例。有原理图和源码
💻 CPP
字号:
#include <dos.h>
#include <time.h>
#include <stdio.h>
void main(void)
{
   static unsigned long first, second;
   printf("\nThe program calculates time interval to perform 10 million of writes to 0x378\nTakes about 20 seconds. Please wait...\n");

   first = *(long*)MK_FP(0x40, 0x6c);  /* Gets system
                           time */
   for(unsigned long i=0;i<10000000L;i++)
      outportb(0x378, i&0xff);

   second = *(long*)MK_FP(0x40, 0x6c); /* Gets system time
                           again */

   static int in = second-first;
   static float f = (second-first)/18.2;
   printf("10 million of writes to 0x378 took %d timer ticks (%5.3f seconds)\n",in, f);
   printf("About %5.3f us per write\n", f/10.);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -