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
|
<!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>Example Calls</TITLE>
<META NAME="description" CONTENT="Example Calls">
<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="node48.html">
<LINK REL="up" HREF="node47.html">
<LINK REL="next" HREF="node50.html">
</HEAD>
<BODY bgcolor="white">
<!--Navigation Panel-->
<A NAME="tex2html664"
HREF="node50.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/share/latex2html/icons/next.png"></A>
<A NAME="tex2html662"
HREF="node47.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/share/latex2html/icons/up.png"></A>
<A NAME="tex2html658"
HREF="node48.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="tex2html665"
HREF="node50.html">Adding Tokens</A>
<B> Up:</B> <A NAME="tex2html663"
HREF="node47.html">Adding Modules</A>
<B> Previous:</B> <A NAME="tex2html659"
HREF="node48.html">The API</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<H3><A NAME="SECTION00511200000000000000">
Example Calls</A>
</H3>
<P>
The following are some example calls to the above functions. Note that
it is assumed that the connection to <TT>xrtic</TT> has been established
elsewhere:
<P>
<OL>
<LI>To check whether the connection to the embedded tasks has been established by <TT>xrtic</TT>, we check the value of the ``connect_flag'':<PRE>
int connect_flag;
rtic_get_flag_connect(&connect_flag);
printf(``The connection is '');
if (connect_flag)
{
printf(``Up\n'');
}
else
{
printf(``Down\n'');
}
</PRE>
<P>
</LI>
<LI>To get the value of a parameter:<PRE>
float ftmp;
int ID;
ID = 2;
rtic_get_scalar(ID,&ftmp);
printf(``The value of parameter %d is %f\n'',ID,ftmp);
</PRE>
Note that it is assumed that the ID submitted to <TT>rtic_get_scalar()</TT> is within range. The user is encouraged to use <TT>rtic_check_ID()</TT> to check all IDs.
<P>
</LI>
<LI>To set the value of a scalar parameter:<PRE>
rtic_set_scalar(2, 100.2);
</PRE>
Note: as of the time of this writing, there is no way to alter matrix values from a user's module.
<P>
</LI>
<LI>To read in the stream of data as generated by the embedded tasks (see <TT>RETURN_VAL()</TT> in the user's <TT>user_controller.c</TT> file) and then print it in the format
<BLOCKQUOTE>
[time][ratio][val0][val1]...[valN]:
</BLOCKQUOTE>
do the following:<PRE>
struct data_struct *data;
int index;
data = (struct data_struct *) malloc(sizeof(struct data_struct));
while(1)
{
rtic_get_data(data);
printf("[%.2e][%i]",
(double)(data->time/1.0e9),
data->factor);
for(index=0;index<RTIC_MAX_DATA_BUF;index++)
printf("[%.2e]", data->val[index]);
printf("\n");
}
</PRE>
</LI>
</OL>
<P>
<BR><HR>
<ADDRESS>
Michael Barabanov
2001-06-19
</ADDRESS>
</BODY>
</HTML>
|