/*************************************************************************
 * 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;
}

