📄 manual_instructions_for_after_and_instead_type_user_interrupts.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html lang="en"><head><title>Instructions for After and Instead Type User Interrupts - 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'>Instructions for After and Instead Type User Interrupts</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'>The user must tell Universal Driver to run the user's function when interrupts occur, and select either "after" or "instead" operating mode:
<p>
<pre>...
DSCUSERINTFUNCTION dscuserintfunction;
dscuserintfunction.func = (DSCUserInterruptFunction) MyUserInterruptFunction;
dscuserintfunction.int_mode = USER_INT_AFTER;
// or dscuserintfunction.int_mode = USER_INT_INSTEAD;
dscSetUserInterruptFunction(boardhandle, &dscuserintfunction);
...</pre>
<p>
Once <tt><a href="manual_DscSetUserInterruptFunction.html" class='printable' title ="DscSetUserInterruptFunction">dscSetUserInterruptFunction</a>()</tt> is called, the driver will know to use the user's interrupt function for all subsequent interrupt operations on the specified board that are initiated by the currently running program.
<p>
Now, to make use of the user interrupt function, you must call one of the many driver functions that use interrupts (<tt><a href="manual_DscADSampleInt.html" class='printable' title ="DscADSampleInt">dscADSampleInt</a>, <a href="manual_DscADScanInt.html" class='printable' title ="DscADScanInt">dscADScanInt</a>, <a href="manual_DscDAConvertScanInt.html" class='printable' title ="DscDAConvertScanInt">dscDAConvertScanInt</a>, <a href="manual_DscUserInt.html" class='printable' title ="DscUserInt">dscUserInt</a></tt>, etc.)
<p>
The user interrupt function will run only when interrupts occur. If the interrupt function terminates (for example if <tt><a href="manual_DscADSampleInt.html" class='printable' title ="DscADSampleInt">dscADSampleInt</a>()</tt> running in one-shot mode completes, or if <tt><a href="manual_DscCancelOp.html" class='printable' title ="DscCancelOp">dscCancelOp</a>()</tt> is called), then the user interrupt function will stop running as well.
<p>
To disable the user's interrupt function, you have two options:
<p>
A. Call <tt><a href="manual_DscSetUserInterruptFunction.html" class='printable' title ="DscSetUserInterruptFunction">dscSetUserInterruptFunction</a>()</tt> to cancel:
<p>
<ul><li> Set dscuserint.func = NULL.
</li><li> Set dscuserint.int_mode = DSC_USER_INT_CANCEL.
</li><li> Call dscSetUserInterrupt() again.
</li></ul><p>
The example code below illustrates these 3 steps:
<p>
<pre>...
DSCUSERINTFUNCTION dscuserintfunction;
dscuserintfunction.func = NULL;
dscuserintfunction.int_mode = USER_INT_CANCEL;
dscSetUserInterruptFunction(boardhandle, &dscuserintfunction);
...</pre>
<p>
-or-
<p>
B. Call <tt><a href="manual_DscClearUserInterruptFunction.html" class='printable' title ="DscClearUserInterruptFunction">dscClearUserInterruptFunction</a>()</tt>:
<p>
<pre>...
dscClearUserInterruptFunction(boardhandle);
...</pre>
<p>
If you try to clear the user interrupt function (using either method) while an "instead" interrupt routine is actively running, you will receive an error and the function will not be cleared. You are only allowed to clear an "after" interrupt function while the routine is running.
<p>
When the user calls one of these interrupt enabling functions, the behavior of the user interrupt function is determined by the "int_mode" parameter in the <tt><a href="manual_Struct_DSCUSERINTFUNCTION.html" class='printable' title ="Struct DSCUSERINTFUNCTION">DSCUSERINTFUNCTION</a></tt> structure.
<p>
If <tt>USER_INT_AFTER</tt> is used, then the user's function will be called every time the standard kernel-mode interrupt routine breaks to user-mode, as described above.
<p>
If <tt>USER_INT_INSTEAD</tt> is used, then the user's function will completely bypass the kernel-mode routine. Instead, every interrupt request will directly call the user's interrupt function, and will not perform any internal board upkeep. For this reason, if the user is using "instead" user interrupt functions in an A/D interrupt mode, the user interrupt function must perform all necessary upkeep (reset the interrupt flipflop, checking/reseting overflow, reading data from the FIFO, etc.). This mode should only be used if you are extremely familiar with the board's operation and interrupt requirements.
<p></div><p><em> <br> This page was last modified 16:02, 12 Feb 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 + -