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

📄 manual_interrupt-based_ad_sample_or_scan.html

📁 Diamond公司Dscud通用驱动使用说明手册
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"        "http://www.w3.org/TR/html4/loose.dtd"><html lang="en"><head><title>Interrupt-Based AD Sample or Scan - Universal Driver Documentation</title><meta http-equiv="Content-type" content="text/html; charset=iso-8859-1"><meta name="robots" content="index,follow"><link rel="shortcut icon" href="/favicon.ico"><link rel="stylesheet" href="/dscud/style/wikiprintable.css"><script type="text/javascript" src="/dscud/style/wikibits.js"></script><style type='text/css'><!--a.new, #quickbar a.new { color: #CC2200; }#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }#article { margin-left: 152px; margin-right: 4px; }//--></style></head><body bgcolor='#FFFFFF'><div class='titlebox'><h1 class='pagetitle'>Interrupt-Based AD Sample or Scan</h1><span class='subtitle'>Universal Driver Documentation</span></div><div class='navbox'><a href="manual_Main_Page.html" class='printable' title ="Main Page">Main Page</a> || <a href="manual_Table_of_Contents.html" class='printable' title ="Table of Contents">Table_of_Contents</a> || <a href="http://www.diamondsystems.com/">Diamond Systems Website</a></div></div><div class='bodytext'><h3><a name="Description"> Description </a></h3>
<p>
Interrupt-based analog input operations are necessary when conversions must be performed at high sampling rates. They differ in operation from standard A/D samples and scans in that they perform a preset number of conversions per function call, rather than taking a single sample or scan. There are a number of different options that can be set for interrupt-based operations; these are explained in the interrupt-based operations chapter.
<p>
The Universal Driver functions for A/D sample and scan operations are <tt><a href="manual_DscADSampleInt.html" class='printable' title ="DscADSampleInt">dscADSampleInt</a>()</tt> and <tt><a href="manual_DscADScanInt.html" class='printable' title ="DscADScanInt">dscADScanInt</a>()</tt>.
<p>
<h3><a name="Step-By-Step_Instructions"> Step-By-Step Instructions </a></h3>
<p>
Create and initialize an A/D settings structure (<a href="manual_DSCADSETTINGS.html" class='printable' title ="DSCADSETTINGS">DSCADSETTINGS</a>).
<p>
Call <tt><a href="manual_DscADSetSettings.html" class='printable' title ="DscADSetSettings">dscADSetSettings</a></tt> and pass it a pointer to this structure in order to setup the driver for A/D operations.
<p>
Create and initialize an analog I/O interrupts structure (<a href="manual_DSCAIOINT.html" class='printable' title ="DSCAIOINT">DSCAIOINT</a>).
<p>
Initialize the <tt>sample_values</tt> buffer in the <tt><a href="manual_DSCAIOINT.html" class='printable' title ="DSCAIOINT">DSCAIOINT</a></tt> structure by allocating sufficient memory to store the results of the interrupt operations. The memory required is:
<p>
<tt>Memory = sizeof(WORD) * num_conversions</tt>
<p>
Call <tt><a href="manual_DscADSampleInt.html" class='printable' title ="DscADSampleInt">dscADSampleInt</a></tt> or <tt><a href="manual_DscADScanInt.html" class='printable' title ="DscADScanInt">dscADScanInt</a></tt> and pass it a pointer to the above-mentioned <tt><a href="manual_DSCAIOINT.html" class='printable' title ="DSCAIOINT">DSCAIOINT</a></tt> structure to begin interrupt operation. The interrupt operations will now run in a separate system thread until either they reach the maximum number of conversions specified (one-shot mode only) or they are cancelled by a call to <tt><a href="manual_DscCancelOp.html" class='printable' title ="DscCancelOp">dscCancelOp</a></tt>.
<p>
<h3><a name="Example_of_Usage_for_Interrupt-Based_A/D_Sample_or_Scan"> Example of Usage for Interrupt-Based A/D Sample or Scan </a></h3>
<p>
<pre>...

DSCB dscb;
DSCADSETTINGS dscadsettings;
DSCAIOINT dscaioint;

...

/* Step 1 */

dscadsettings.current_channel = 0;
dscadsettings.gain = 0;
dscadsettings.range = 0;
dscadsettings.polarity = 0;
dscadsettings.load_cal = 0;

/* Step 2 */

if ((result = dscADSetSettings(dscb, &dscadsettings)) != DE_NONE)
	return result;

/* Step 3 */

dscaioint.num_conversions = 1024;
dscaioint.conversion_rate = 10000;
dscaioint.cycle = FALSE;
dscaioint.internal_clock = TRUE;
dscaioint.low_channel = 0;
dscaioint.high_channel = 3;
dscaioint.external_gate_enable = FALSE;
dscaioint.internal_clock_gate = FALSE;
dscaioint.fifo_enab = TRUE;
dscaioint.fifo_depth = 256;
dscaioint.dump_threshold = 512;

/* Step 4 */

dscaioint.sample_values = (WORD*) malloc(sizeof(WORD) * 
	dscaioint.num_conversions);
memset(dscaioint.sample_values, 0, sizeof(WORD) * dscaioint.num_conversions);

/* Step 5 */

if ((result = dscADScanInt(dscb, &dscaioint)) != DE_NONE)
		return result;

...</pre>
<p>
<strong>NOTE:</strong> Boards can only achieve interrupt rates that divide evenly into their onboard counters, so the driver will attempt to find the rate closest to that which you specified.
<p></div><p><em> <br> This page was last modified 19:40, 30 Jan 2004.<br>Copyright (c) 2004 Diamond Systems.  All Rights Reserved.</em><!-- Time since request: 0.16 secs. --></body></html>

⌨️ 快捷键说明

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