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

📄 softtrig.c

📁 源代码PC104用户手册PC104用户手册PC104用户手册
💻 C
字号:
/*
   Science & Technology CO.,LTD.
   W2-B5 High-Tech Industrial Park, ShenZhen, GuangDong, P.R.C.

   Tel:   86-755-6544000
   Fax:   86-755-6549140
   Zip:   518057

   Board:       SF93A-0102
   Compiler:    Turbo C (r) version 1.0, 1.5, 2.0
		Turbo C++ (r) version 1.0
		Borland C++ (r) version 2.0, 3.0

   Last update: Feb 22, 2002

  DESCRIPTION
  ~~~~~~~~~~~
  This program sets up the user PIT to generate interrupts at a selected
  rate.  An interrupt service routine (ISR) is provided that simply
  samples from one channel on the ADT600 each time the interrupt is
  activated.  The value is displayed on the screen as a foreground
  process.  Although the ISR in this program is trivial, all the
  ingredients for powerful interrupt driven data are included.

  NOTES
  ~~~~~
  You must change the first two lines in the main function to reflect the
  base address and IRQ settings for your ADT600.

*/
#include <dos.h>
#include <conio.h>

#include "ADT600.h"
#include "ADT600.inc"

/**********

  ProgramTitle

  The ProgramTitle function displays a description of the program on the
  screen.

**********/

void ProgramTitle(char St[])
{
 gotoxy(1,1); clreol();
 cprintf("ADT600  Sample Program");
 gotoxy(80 - strlen(St), 1);
 cprintf(St);
}

void main(void)
{
 InitializeBoardSettings(768, 10.0, BIPOLAR);

 clrscr();
 ProgramTitle("Single conversions, software trigger.");
 gotoxy(1, 25);
 cprintf("Press any key to exit. . .");
 gotoxy(28, 12);
 cprintf("Volts: ");

 ResetBoard();                       /* Reset the Board */

 SetChannel(0);                      /* Set channel 0 */

 while (kbhit() == 0)
  {
   StartConversion();                 /* Start a conversion */

   while (ConversionDone() == 0);    /* Wait until data is ready */

   gotoxy(35, 12);                  /* cprintf the data in volts */
   cprintf("%6.2f", DigitalToSBS(ReadData()));
   delay(100);
  }

 getch();                     /* Read character from keyboard */
 clrscr();
}

⌨️ 快捷键说明

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