1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 2K.1beta (1.48)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>The user_controller.c API</TITLE>
<META NAME="description" CONTENT="The user_controller.c API">
<META NAME="keywords" CONTENT="rtic">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="rtic.css">
<LINK REL="previous" HREF="node43.html">
<LINK REL="up" HREF="node42.html">
<LINK REL="next" HREF="node45.html">
</HEAD>
<BODY bgcolor="white">
<!--Navigation Panel-->
<A NAME="tex2html600"
HREF="node45.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/share/latex2html/icons/next.png"></A>
<A NAME="tex2html598"
HREF="node42.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/share/latex2html/icons/up.png"></A>
<A NAME="tex2html594"
HREF="node43.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="/usr/share/latex2html/icons/prev.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html601"
HREF="node45.html">Enhancing RTiC-Lab</A>
<B> Up:</B> <A NAME="tex2html599"
HREF="node42.html">Generating a user_controller.c File</A>
<B> Previous:</B> <A NAME="tex2html595"
HREF="node43.html">Necessary Functions</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00420000000000000000">
The <TT>user_controller.c</TT> API</A>
</H1>
<P>
The following tokens have been implemented in order to simplify the
controller implementation and to communicate with the reactive tasks.
<P>
<UL>
<LI><TT>float GET_SENSOR(x)</TT>: This macro is used to sample the
<TT>x</TT>th A/D channel. Here, <IMG
WIDTH="17" HEIGHT="20" ALIGN="BOTTOM" BORDER="0"
SRC="img58.png"
ALT="$x$"> is an integer denoting the A/D
channel, where <!-- MATH
$x \in [0,NUM\-\_CONTROL\-\_INPUTS)$
-->
<IMG
WIDTH="320" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img59.png"
ALT="$x \in [0,NUM\-\_CONTROL\-\_INPUTS)$">.
<P>
</LI>
<LI><TT>void SET_VOLTAGE(x,y)</TT>: This macro is used to load a voltage
into the D/A boards. More explicitly, it will load a voltage <TT>y</TT>
(a float) into D/A channel <TT>x</TT> (an integer), <!-- MATH
$\forall
x\in[0,NUM\-\_CONTROL\-\_OUTPUTS)$
-->
<IMG
WIDTH="347" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img60.png"
ALT="$\forall
x\in[0,NUM\-\_CONTROL\-\_OUTPUTS)$">.
<P>
</LI>
<LI><TT>float GET_SCALAR_PARAMETER(id)</TT>: This macro will retrieve
the latest value of scalar parameter identified with the unique
(integer) identifier <TT>id</TT>, <!-- MATH
$\forall id \in
[0,NUM\-\_CONTROL\-\_PARAMS)$
-->
<IMG
WIDTH="344" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img61.png"
ALT="$\forall id \in
[0,NUM\-\_CONTROL\-\_PARAMS)$">.
<P>
</LI>
<LI><TT>void RETURN_VAL(x,y)</TT>: This macro will assign the value of
<TT>y</TT> (a float) to the <TT>x</TT>th data point (an integer) that will
be returned to the reactive tasks (<TT>xrtic</TT>). The user can then
either store this data to disk, plot it to screen, print it to <TT>stdout</TT>, or use any other user supplied modules from within Linux. In
this case, <!-- MATH
$x \in [0,RTIC\-\_MAX\-\_DATA\-\_BUF)$
-->
<IMG
WIDTH="297" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img62.png"
ALT="$x \in [0,RTIC\-\_MAX\-\_DATA\-\_BUF)$">.
<P>
</LI>
<LI><TT>int NEW_PARAMS</TT>: This macro returns TRUE (1) if a parameter has
been updated via <TT>xrtic</TT>, otherwise it returns FALSE (0). This
macro is guaranteed to return TRUE over the execution of the very
first controller cycle.
<P>
</LI>
<LI><TT>float GET_RUN_PERIOD</TT>: This macro returns the run-time
period of the controller in seconds. Thus, each time the user changes
the run-time frequency via either <TT>user_GUI.par</TT> or <TT>xrtic</TT>, the output of this macro will change accordingly.
<P>
</LI>
<LI><TT>float GET_RUN_TIME</TT>: This macro returns time (in
nano-seconds) since the controller began its execution.
<P>
</LI>
<LI><TT>volatile float *MATRIX_VALS(id)</TT>: This macro returns a
pointer to the starting location of the elements associated with the
matrix of identifier <TT>id</TT>.
<P>
</LI>
<LI><TT>float MATRIX_ELEMENT(id,m,n) </TT>: This macro returns the value
of the element identified by row <TT>m</TT> (an integer) and column <TT>n</TT> (an integer) of the matrix or vector identified by the unique
identifier <TT>id</TT> (an integer), Here, note that <!-- MATH
$m \in
[1,number\,of\,rows]$
-->
<IMG
WIDTH="206" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img63.png"
ALT="$m \in
[1,number\,of\,rows]$">; that <!-- MATH
$n \in [1,number\,of\,columns]$
-->
<IMG
WIDTH="230" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img64.png"
ALT="$n \in [1,number\,of\,columns]$">; that <!-- MATH
$id
\in [0,NUM\-\_CONTROL\-\_PARAMS)$
-->
<IMG
WIDTH="333" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img65.png"
ALT="$id
\in [0,NUM\-\_CONTROL\-\_PARAMS)$">, and that <!-- MATH
$max(m)\times max(n) \le
RTIC\-\_MAX\-\_ARRAY$
-->
<IMG
WIDTH="375" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img66.png"
ALT="$max(m)\times max(n) \le
RTIC\-\_MAX\-\_ARRAY$">.
<P>
</LI>
<LI><TT>int MAT_DIM_M(id)</TT>: This macro returns the row dimension of
the matrix identified by the unique identifier <TT>id</TT> (an integer),
<!-- MATH
$\forall id \in [0,NUM\-\_CONTROL\-\_PARAMS)$
-->
<IMG
WIDTH="344" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img61.png"
ALT="$\forall id \in
[0,NUM\-\_CONTROL\-\_PARAMS)$">.
<P>
</LI>
<LI><TT>int MAT_DIM_N(id)</TT>: This macro returns the column dimension of
the matrix identified by the unique identifier <IMG
WIDTH="23" HEIGHT="21" ALIGN="BOTTOM" BORDER="0"
SRC="img67.png"
ALT="$id$"> (an integer),
<!-- MATH
$\forall id \in [0,NUM\-\_CONTROL\-\_PARAMS)$
-->
<IMG
WIDTH="344" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img61.png"
ALT="$\forall id \in
[0,NUM\-\_CONTROL\-\_PARAMS)$">.
<P>
</LI>
</UL>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html600"
HREF="node45.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/share/latex2html/icons/next.png"></A>
<A NAME="tex2html598"
HREF="node42.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/share/latex2html/icons/up.png"></A>
<A NAME="tex2html594"
HREF="node43.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="/usr/share/latex2html/icons/prev.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html601"
HREF="node45.html">Enhancing RTiC-Lab</A>
<B> Up:</B> <A NAME="tex2html599"
HREF="node42.html">Generating a user_controller.c File</A>
<B> Previous:</B> <A NAME="tex2html595"
HREF="node43.html">Necessary Functions</A>
<!--End of Navigation Panel-->
<ADDRESS>
Michael Barabanov
2001-06-19
</ADDRESS>
</BODY>
</HTML>
|