harttest.cpp

来自「HART协议编程例程」· C++ 代码 · 共 55 行

CPP
55
字号
/*************************************************************************
 * Copyright (c) 1998 - 2000 by Borst Automation, Fachingen
 * All rights reserved
 *
 * Filename:  HartTest.cpp
 * Project:   HART Slave
 * Date:      Jul-24-00
 * Author(s): W. Borst
 *
 * Revision:
 * Date:      Name:       Version:  Description:
 * Jul-24-00  W. Borst    -----     Initial Draft
 *
 * Description: main program
 *
 *************************************************************************/
#include "stdafx.h"
#define __HARTTEST_H__
#include "HartTest.h"

int main(int argc, char* argv[])
{
	INT   iIn = 0; 
  DWORD dwLastSystemTime;

  //Avoid warning
  argc=argc;
  argv=argv;
  //Productive code goes here
  dwLastSystemTime = timeGetTime();
  printf("Hart Slave Simulation Running!\n"
         "Press 'ESC' to Stop!\n");
  StartHartSimulation();

  while (iIn != 27)
  { 
    if (kbhit())
    { 
      iIn = getch();
    }
    else
    {
      /* To make this realistic the interpreter
         is called every 100 ms */
      if ((timeGetTime() - dwLastSystemTime)>100)
      { RunHartCommandInterpreter();
        dwLastSystemTime = timeGetTime();
      }
    }
  }
  EndHartSimulation();
	return 0;
}

⌨️ 快捷键说明

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