<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://www.pic24.ru/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="http://www.pic24.ru/feed.php">
        <title>PIC24 en:osa:ref:description</title>
        <description></description>
        <link>http://www.pic24.ru/</link>
        <image rdf:resource="http://www.pic24.ru/lib/images/favicon.ico" />
       <dc:date>2023-02-11T09:04:26+03:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://www.pic24.ru/doku.php/en/osa/ref/description/data_types?rev=1268220823"/>
                <rdf:li rdf:resource="http://www.pic24.ru/doku.php/en/osa/ref/description/events_and_priority?rev=1285334747"/>
                <rdf:li rdf:resource="http://www.pic24.ru/doku.php/en/osa/ref/description/intro?rev=1224344100"/>
                <rdf:li rdf:resource="http://www.pic24.ru/doku.php/en/osa/ref/description/predefined?rev=1285158211"/>
                <rdf:li rdf:resource="http://www.pic24.ru/doku.php/en/osa/ref/description/project?rev=1299681396"/>
                <rdf:li rdf:resource="http://www.pic24.ru/doku.php/en/osa/ref/description/scheduler?rev=1268220258"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="http://www.pic24.ru/lib/images/favicon.ico">
        <title>PIC24</title>
        <link>http://www.pic24.ru/</link>
        <url>http://www.pic24.ru/lib/images/favicon.ico</url>
    </image>
    <item rdf:about="http://www.pic24.ru/doku.php/en/osa/ref/description/data_types?rev=1268220823">
        <dc:format>text/html</dc:format>
        <dc:date>2010-03-10T14:33:43+03:00</dc:date>
        <title>OSA : Data types</title>
        <link>http://www.pic24.ru/doku.php/en/osa/ref/description/data_types?rev=1268220823</link>
        <description>


&lt;h1&gt;&lt;a name=&quot;osa_data_types&quot; id=&quot;osa_data_types&quot;&gt;OSA : Data types&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OSA : Data types&quot; [1-31] --&gt;
&lt;h2&gt;&lt;a name=&quot;system&quot; id=&quot;system&quot;&gt;System&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;System&quot; [32-50] --&gt;
&lt;h3&gt;&lt;a name=&quot;osa_uint8&quot; id=&quot;osa_uint8&quot;&gt;__osa_uint8&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Platform independed unsigned 8-bit integer. 
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;__osa_uint8&quot; [51-119] --&gt;
&lt;h3&gt;&lt;a name=&quot;osa_uint16&quot; id=&quot;osa_uint16&quot;&gt;__osa_uint16&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Platform independed unsigned 16-bit integer. 
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;__osa_uint16&quot; [120-190] --&gt;
&lt;h3&gt;&lt;a name=&quot;osa_uint32&quot; id=&quot;osa_uint32&quot;&gt;__osa_uint32&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Platform independed unsigned 32-bit integer. 
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;__osa_uint32&quot; [191-261] --&gt;
&lt;h3&gt;&lt;a name=&quot;osa_word&quot; id=&quot;osa_word&quot;&gt;__osa_word&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Platform depended unsigned integer. Has width of controller&amp;#039;s data bus.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;__osa_word&quot; [262-356] --&gt;
&lt;h2&gt;&lt;a name=&quot;common&quot; id=&quot;common&quot;&gt;Common&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Common&quot; [357-376] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_csem&quot; id=&quot;ost_csem&quot;&gt;OST_CSEM&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Counting semaphore&amp;#039;s type.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition&quot; id=&quot;definition&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;    &lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; __osa_uint8 OST_CSEM;&lt;/pre&gt;
&lt;p&gt;
This type is aviable only when &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_ENABLE_CSEM&lt;/a&gt;&lt;/span&gt; constant is defined in &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OSAcfg.h&lt;/a&gt;&lt;/span&gt;.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining&quot; id=&quot;redefining&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;

You can redefine this type by changing size of CSEM in file &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OSAcfg.h&lt;/a&gt;&lt;/span&gt;:

&lt;/p&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#define OS_CSEM_SIZE    4&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;

Allowed values of &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_CSEM_SIZE&lt;/a&gt;&lt;/span&gt;:
&lt;/p&gt;
&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
1		&lt;/td&gt;
		&lt;td&gt;
__osa_uint8 (0..2^8-1)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
2		&lt;/td&gt;
		&lt;td&gt;
__osa_uint16 (0..2^16-1)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
4		&lt;/td&gt;
		&lt;td&gt;
__osa_uint32 (0..2^32-1)		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_CSEM&quot; [377-1048] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_flag&quot; id=&quot;ost_flag&quot;&gt;OST_FLAG&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Bit fields.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition1&quot; id=&quot;definition1&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; __osa_uint8   OST_FLAG;
&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; __osa_uint16  OST_FLAG16;
&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; __osa_uint32  OST_FLAG32;&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining1&quot; id=&quot;redefining1&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;

Unavialable.
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_FLAG&quot; [1049-1267] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_msg&quot; id=&quot;ost_msg&quot;&gt;OST_MSG&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Pointer to message.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition2&quot; id=&quot;definition2&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; OST_MSG;&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining2&quot; id=&quot;redefining2&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;

You can redefine this type by defining &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_MSG_TYPE&lt;/a&gt;&lt;/span&gt; constant in &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OSAcfg.h&lt;/a&gt;&lt;/span&gt;. For example:
&lt;/p&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; stuct &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; Name;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; Age;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; MyType;
&amp;nbsp;
&lt;span class=&quot;co2&quot;&gt;#define OS_MSG_TYPE MyType *&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Allowed all types (for example &lt;strong&gt;const char * &lt;/strong&gt; - pointer to ROM).
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_MSG&quot; [1268-1752] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_msg_cb&quot; id=&quot;ost_msg_cb&quot;&gt;OST_MSG_CB&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Descriptor of pointer to message. Contains pointer to message and message&amp;#039; state flag (free/busy).
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition3&quot; id=&quot;definition3&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;      status;     &lt;span class=&quot;co1&quot;&gt;// Message's state flag (=0 - free, =1 - busy)&lt;/span&gt;
    OST_MSG   msg;        &lt;span class=&quot;co1&quot;&gt;// Pointer to message body&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_MSG_CB;&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining3&quot; id=&quot;redefining3&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;
You can redefine only pointer to message type &lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_msg&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;OST_MSG&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; by defining it manuale in &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OSAcfg.h&lt;/a&gt;&lt;/span&gt;.
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_MSG_CB&quot; [1753-2290] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_dtimer&quot; id=&quot;ost_dtimer&quot;&gt;OST_DTIMER&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Dinamic timer.

&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition4&quot; id=&quot;definition4&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    OST_DTIMER_FLAGS Flags;
    &lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;           Next;
    _OST_DTIMER      Timer;     &lt;span class=&quot;co1&quot;&gt;// Timer's counter&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_DTIMER;&lt;/pre&gt;
&lt;p&gt;
State flags are used to tell timer routine (&lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_timer&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_timer&quot;&gt;OS_Timer&lt;/a&gt;&lt;/span&gt;) how to work with this timer (is it run or stopped, is it active, is there next timer in list):
&lt;/p&gt;
&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;Flags&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Timer&amp;#039;s state flags (see &lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_dtimer_flags&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;OST_DTIMER_FLAGS&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;Next&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Pointer to next timer in list of active timers		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;Timer&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Counter. Size of counter is set by &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration#data_types&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_DTIMER_SIZE&lt;/a&gt;&lt;/span&gt; constant (default = 2)		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining4&quot; id=&quot;redefining4&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;
You can redefine only counter&amp;#039;s size constant &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration#data_types&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_DTIMER_SIZE&lt;/a&gt;&lt;/span&gt; in &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OSAcfg.h&lt;/a&gt;&lt;/span&gt;:

&lt;/p&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#define OS_DTIMER_SIZE       4&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Allowed values of &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration#data_types&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_DTIMER_SIZE&lt;/a&gt;&lt;/span&gt;:
&lt;/p&gt;
&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
1		&lt;/td&gt;
		&lt;td&gt;
__osa_uint8 (0..2^8-1)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
2		&lt;/td&gt;
		&lt;td&gt;
__osa_uint16 (0..2^16-1)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
4		&lt;/td&gt;
		&lt;td&gt;
__osa_uint32 (0..2^32-1)		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_DTIMER&quot; [2291-3495] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_qtimer&quot; id=&quot;ost_qtimer&quot;&gt;OST_QTIMER&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Timer in queue of timers.

&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition5&quot; id=&quot;definition5&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    OST_QTIMER_FLAGS Flags;
    &lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;           Next;
    _OST_QTIMER      Timer;     &lt;span class=&quot;co1&quot;&gt;// Timer's counter&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_QTIMER;&lt;/pre&gt;
&lt;p&gt;
State flags are used to tell timer routine (&lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_timer&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_timer&quot;&gt;OS_Timer&lt;/a&gt;&lt;/span&gt;) how to work with this timer (is it run or stopped, is it active, is there next timer in list):
&lt;/p&gt;
&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;Flags&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Timer&amp;#039;s state flags (see &lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_qtimer_flags&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;OST_QTIMER_FLAGS&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;Next&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Pointer to next timer in list of active timers		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;Timer&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Counter. Size of counter is set by &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration#data_types&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_QTIMER_SIZE&lt;/a&gt;&lt;/span&gt; constant (default = 2)		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining5&quot; id=&quot;redefining5&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;
You can redefine only counter&amp;#039;s size constant &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration#data_types&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_QTIMER_SIZE&lt;/a&gt;&lt;/span&gt; in &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OSAcfg.h&lt;/a&gt;&lt;/span&gt;:

&lt;/p&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#define OS_QTIMER_SIZE       4&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Allowed values of &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration#data_types&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_QTIMER_SIZE&lt;/a&gt;&lt;/span&gt;:
&lt;/p&gt;
&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
1		&lt;/td&gt;
		&lt;td&gt;
__osa_uint8 (0..2^8-1)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
2		&lt;/td&gt;
		&lt;td&gt;
__osa_uint16 (0..2^16-1)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
4		&lt;/td&gt;
		&lt;td&gt;
__osa_uint32 (0..2^32-1)		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_QTIMER&quot; [3496-4711] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_queue&quot; id=&quot;ost_queue&quot;&gt;OST_QUEUE&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Queue of poiner to messages.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition6&quot; id=&quot;definition6&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    OST_QUEUE_CONTROL Q;
    OST_MSG &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;pMsg;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_QUEUE;&lt;/pre&gt;
&lt;p&gt;
&lt;span class=&quot;important&quot;&gt;Q&lt;/span&gt; - &lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_queue_control&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;queue control block&lt;/a&gt;&lt;/span&gt;.
&lt;span class=&quot;important&quot;&gt;pMsg&lt;/span&gt; - pointer to buffer where pointers to message will be stored to.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining6&quot; id=&quot;redefining6&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;

You can redefine only type of &lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_msg&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;OST_MSG&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;.
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_QUEUE&quot; [4712-5159] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_squeue&quot; id=&quot;ost_squeue&quot;&gt;OST_SQUEUE&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Queue of simple messages.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition7&quot; id=&quot;definition7&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    OST_QUEUE_CONTROL Q;
    OST_SMSG &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;pSMsg;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_SQUEUE;&lt;/pre&gt;
&lt;p&gt;
&lt;span class=&quot;important&quot;&gt;Q&lt;/span&gt; - &lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_queue_control&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;queue control block&lt;/a&gt;&lt;/span&gt;.
&lt;span class=&quot;important&quot;&gt;pSMsg&lt;/span&gt; - pointer to buffer where message pointers will be stored to.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining7&quot; id=&quot;redefining7&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;

You can redefine only type of &lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_smsg&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;OST_SMSG&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;.
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_SQUEUE&quot; [5160-5610] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_smsg&quot; id=&quot;ost_smsg&quot;&gt;OST_SMSG&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Simple byte message. Used to reduce RAM usage when there is no need to use pointers to messages.

&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition8&quot; id=&quot;definition8&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; __osa_uint8   OST_SMSG;&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining8&quot; id=&quot;redefining8&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;
You can redefine this type by defining &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_SMSG_TYPE&lt;/a&gt;&lt;/span&gt; constant in &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OSAcfg.h&lt;/a&gt;&lt;/span&gt;. For example:

&lt;/p&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#define OS_SMSG_TYPE unsigned long&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Allowed any counting type. You should bear in mind that simple message type havn&amp;#039;t separate flag indicating busy state. This state is indicated by mesasge&amp;#039;s body: if simple message is zero, then it is free, else it is busy. Thus you may exchange only non zero simple messages between tasks.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_SMSG&quot; [5611-6336] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_task_pointer&quot; id=&quot;ost_task_pointer&quot;&gt;OST_TASK_POINTER&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Variables of this type are used to control tasks from any place in program. Task descriptors are not accessible directly, so these variables are used to access to task descriptors via pointers.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition9&quot; id=&quot;definition9&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; OS_TASKS_BANK OST_TCB &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;  OST_TASK_POINTER;&lt;/pre&gt;
&lt;p&gt;
Note that prefix &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_TASKS_BANK&lt;/a&gt;&lt;/span&gt; used.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;redefining9&quot; id=&quot;redefining9&quot;&gt;Redefining&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;
Not allowed
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_TASK_POINTER&quot; [6337-6777] --&gt;
&lt;h2&gt;&lt;a name=&quot;internal_for_information&quot; id=&quot;internal_for_information&quot;&gt;Internal (for information)&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Internal (for information)&quot; [6778-6817] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_dtimer_flags&quot; id=&quot;ost_dtimer_flags&quot;&gt;OST_DTIMER_FLAGS&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Contains state flags for dynamic timers (&lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_dtimer&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;OST_DTIMER&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;).

&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition10&quot; id=&quot;definition10&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;   bTimeout&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;   bActive&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;   bIsRun&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;   bNextEnable&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_DTIMER_FLAGS;&lt;/pre&gt;&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bTimeout&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
indicates whether the timer overflow		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bActive&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
shows is timer active (=1) or not (=0). When timer is active (created by &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_dtimer_create&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_dtimer_create&quot;&gt;OS_Dtimer_Create&lt;/a&gt;&lt;/span&gt;) it will be processed every &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_timer&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_timer&quot;&gt;OS_Timer&lt;/a&gt;&lt;/span&gt; call.		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bIsRun&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
indicates whether the timer is counting (=1) or stopped (=0). If =1 then timer increases by 1 every call of &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_timer&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_timer&quot;&gt;OS_Timer&lt;/a&gt;&lt;/span&gt;.		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bNextEnable&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
indicates is there next timer in list of dynamic timers. If =1 then field Next points to next dynamic timer in list. If =0 then this timer is last in list.		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_DTIMER_FLAGS&quot; [6818-7797] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_qtimer_flags&quot; id=&quot;ost_qtimer_flags&quot;&gt;OST_QTIMER_FLAGS&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Contains state flags for timer in queue of timers (&lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_qtimer&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;OST_QTIMER&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;).

&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition11&quot; id=&quot;definition11&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;   bTimeout&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;   bActive&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;   bIsRun&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
    &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;   bNextEnable&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_QTIMER_FLAGS;&lt;/pre&gt;&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bTimeout&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
indicates whether the timer overflow		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bActive&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
shows is timer active (=1) or not (=0).		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bIsRun&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
not used		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bNextEnable&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
indicates is there next timer in queue of  timers. If =1 then field Next points to next timer in queue. If =0 then this timer is last in queue.		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_QTIMER_FLAGS&quot; [7798-8446] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_queue_control&quot; id=&quot;ost_queue_control&quot;&gt;OST_QUEUE_CONTROL&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Queue of messages control block.

&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition12&quot; id=&quot;definition12&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    __osa_word      cSize;
    __osa_word      cBegin;
    __osa_word      cFilled;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_QUEUE_CONTROL;&lt;/pre&gt;&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;cSize&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Size of buffer (in messages)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;cBegin&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Position of first message in queue		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;cFilled&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Number of messages in queue (=0 - queue is empty, =cSize - queue is full)		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_QUEUE_CONTROL&quot; [8447-8894] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_tcb&quot; id=&quot;ost_tcb&quot;&gt;OST_TCB&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Task control block.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition13&quot; id=&quot;definition13&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    OST_TASK_STATE State;
    OST_CODE_POINTER pTaskPointer;
    &lt;span class=&quot;co2&quot;&gt;#ifdef __OSA18__&lt;/span&gt;
        &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt;  cTempFSR1;
    &lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#ifdef __OSA30__&lt;/span&gt;
        &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;    W8_Temp;
        &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;    W9_Temp;
        &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;    W10_Temp;
        &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;    W11_Temp;
        &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;    W12_Temp;
        &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;    W13_Temp;
        &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;    W14_Temp;
        &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;    W15_Temp;
    &lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#ifdef OS_ENABLE_TIMER&lt;/span&gt;
        _OST_TTIMER Timer;
    &lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_TCB;&lt;/pre&gt;&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;State&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Taks state flags (see. &lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_task_state&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;OST_TASK_STATE&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;pTaskPointer&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Pointer to task return point.		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;cTempFSR1&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Only for MCC18: saved FSR1 value.		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;Wx_Temp&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Only MCC30: Saved W8..W15 registers		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;Timer&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Task timer counter. Type &lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_ttimer&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;_OST_TTIMER&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;, size &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration#data_types&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_TTIMER_SIZE&lt;/a&gt;&lt;/span&gt;. Added in &lt;span class=&quot;important&quot;&gt;&lt;span class=&quot;curid&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types#ost_tcb&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;OST_TCB&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; only when constant &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_ENABLE_TIMER&lt;/a&gt;&lt;/span&gt; defined.		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_TCB&quot; [8895-10133] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_task_state&quot; id=&quot;ost_task_state&quot;&gt;OST_TASK_STATE&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition14&quot; id=&quot;definition14&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    __osa_word    cPriority&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;;
    __osa_word    bReady&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
    __osa_word    bDelay&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
    __osa_word    bCanContinue&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
    __osa_word    bEnable&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; OST_TASK_STATE;&lt;/pre&gt;&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;cPriority&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Task priority (0..7)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bReady&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Ready flag. Tells to scheduler that task is ready to run.		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bDelay&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
Task is delayed or waiting event with timeout. (See &lt;em&gt;bCanContinue&lt;/em&gt;)		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bCanContinue&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
When bDelay==1: =1 - task waits event with timeout; =0 - task delayed by &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_delay&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_delay&quot;&gt;OS_Delay&lt;/a&gt;&lt;/span&gt;		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;em&gt;bEnable&lt;/em&gt;		&lt;/td&gt;
		&lt;td&gt;
=1 - descriptor is used by some task, =0 - descriptor is free.		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OST_TASK_STATE&quot; [10134-10835] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_dtimer1&quot; id=&quot;ost_dtimer1&quot;&gt;_OST_DTIMER&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Type of dynamic timer&amp;#039;s counter.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition15&quot; id=&quot;definition15&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#if   OS_DTIMER_SIZE == 1&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_DTIMER __osa_uint8&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#elif OS_DTIMER_SIZE == 2&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_DTIMER __osa_uint16&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#elif OS_DTIMER_SIZE == 4&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_DTIMER __osa_uint32&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
If constant &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_DTIMER_SIZE&lt;/a&gt;&lt;/span&gt; not defined, then set to default value &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_TIMER_SIZE.&lt;/a&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;_OST_DTIMER&quot; [10836-11301] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_stimer&quot; id=&quot;ost_stimer&quot;&gt;_OST_STIMER&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Type of static timer&amp;#039;s counter.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition16&quot; id=&quot;definition16&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#if   OS_STIMER_SIZE == 1&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_STIMER __osa_uint8&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#elif OS_STIMER_SIZE == 2&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_STIMER __osa_uint16&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#elif OS_STIMER_SIZE == 4&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_STIMER __osa_uint32&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
If constant &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_STIMER_SIZE&lt;/a&gt;&lt;/span&gt; not defined, then set to default value &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_TIMER_SIZE.&lt;/a&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;_OST_STIMER&quot; [11302-11764] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_ttimer&quot; id=&quot;ost_ttimer&quot;&gt;_OST_TTIMER&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Type of task timer&amp;#039;s counter.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition17&quot; id=&quot;definition17&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#if   OS_TTIMER_SIZE == 1&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_TTIMER __osa_uint8&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#elif OS_TTIMER_SIZE == 2&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_TTIMER __osa_uint16&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#elif OS_TTIMER_SIZE == 4&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_TTIMER __osa_uint32&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
If constant &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_TTIMER_SIZE&lt;/a&gt;&lt;/span&gt; not defined, then set to default value &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_TIMER_SIZE.&lt;/a&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;_OST_TTIMER&quot; [11765-12225] --&gt;
&lt;h3&gt;&lt;a name=&quot;ost_qtimer1&quot; id=&quot;ost_qtimer1&quot;&gt;_OST_QTIMER&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Type of queue timer&amp;#039;s counter.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;definition18&quot; id=&quot;definition18&quot;&gt;Definition&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#if   OS_QTIMER_SIZE == 1&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_QTIMER __osa_uint8&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#elif OS_QTIMER_SIZE == 2&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_QTIMER __osa_uint16&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#elif OS_QTIMER_SIZE == 4&lt;/span&gt;
    &lt;span class=&quot;co2&quot;&gt;#define _OST_QTIMER __osa_uint32&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
If constant &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_QTIMER_SIZE&lt;/a&gt;&lt;/span&gt; not defined, then set to default value &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_TIMER_SIZE.&lt;/a&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;_OST_QTIMER&quot; [12226-] --&gt;</description>
    </item>
    <item rdf:about="http://www.pic24.ru/doku.php/en/osa/ref/description/events_and_priority?rev=1285334747">
        <dc:format>text/html</dc:format>
        <dc:date>2010-09-24T17:25:47+03:00</dc:date>
        <title>OSA : Events and priority</title>
        <link>http://www.pic24.ru/doku.php/en/osa/ref/description/events_and_priority?rev=1285334747</link>
        <description>


&lt;h1&gt;&lt;a name=&quot;osa_events_and_priority&quot; id=&quot;osa_events_and_priority&quot;&gt;OSA : Events and priority&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OSA : Events and priority&quot; [1-43] --&gt;
&lt;h2&gt;&lt;a name=&quot;task_states&quot; id=&quot;task_states&quot;&gt;Task states&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

To synchronize tasks, the system uses events. For example, we have two active tasks (created by service &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_task_create&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_task_create&quot;&gt;OS_Task_Create&lt;/a&gt;&lt;/span&gt;): one of them measures temperature, and the other displays the measured value on a screen. The second task cannot display data if there is no measured value. While the first task makes measurements, the second task waits. After the temperature is measured (in other words, the event has taken place), the second task becomes ready to run. And then the second task can be executed.
&lt;/p&gt;

&lt;p&gt;
Thus all tasks can have one of five states:
&lt;/p&gt;
&lt;table class = &quot;fpl&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;strong&gt;not active&lt;/strong&gt;		&lt;/td&gt;
		&lt;td&gt;
task was not created or was deleted		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;strong&gt;waiting&lt;/strong&gt;		&lt;/td&gt;
		&lt;td&gt;
task is waiting for some event		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;strong&gt;ready&lt;/strong&gt;		&lt;/td&gt;
		&lt;td&gt;
the expected event occurred but the task did not get control yet		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;strong&gt;running&lt;/strong&gt;		&lt;/td&gt;
		&lt;td&gt;
task is executing		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
&lt;strong&gt;paused&lt;/strong&gt;		&lt;/td&gt;
		&lt;td&gt;
task is paused. It is still active but can&amp;#039;t get control.		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;
In order for a task to get control, two conditions must be met:
&lt;/p&gt;
&lt;ol&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; the event expected by the task occurs (task becomes &lt;strong&gt;ready&lt;/strong&gt;);&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; the task&amp;#039;s priority must be higher than the priorities of other ready tasks.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Task states&quot; [44-1189] --&gt;
&lt;h2&gt;&lt;a name=&quot;events&quot; id=&quot;events&quot;&gt;Events&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Events in OSA:
&lt;/p&gt;
&lt;ol&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; semaphore (&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/services/binary_semaphores&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:services:binary_semaphores&quot;&gt;binary&lt;/a&gt; or &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/services/counting_semaphores&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:services:counting_semaphores&quot;&gt;counting&lt;/a&gt;);&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/services/messages&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:services:messages&quot;&gt;message&lt;/a&gt; (pointer to a message body or a simple byte message);&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/services/flags&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:services:flags&quot;&gt;flags combination&lt;/a&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/services/timers&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:services:timers&quot;&gt;timeout&lt;/a&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; any boolean expression.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;

Each of the first four types is described in its own section. The fifth type is optional and allows a task to wait for some non-system event, e.g.:

&lt;/p&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;OS_Wait&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;TMR1IF&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;                   &lt;span class=&quot;co1&quot;&gt;// Wait for TMR1 overflow&lt;/span&gt;
or
OS_Wait_TO&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;ReadADC&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu19&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;128&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;      &lt;span class=&quot;co1&quot;&gt;// Wait for input voltage to be greater than Vdd/2&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;

These two services are described in the section &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/services/system_services&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:services:system_services&quot;&gt;system services&lt;/a&gt;.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Events&quot; [1190-1995] --&gt;
&lt;h2&gt;&lt;a name=&quot;priority&quot; id=&quot;priority&quot;&gt;Priority&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

All task have a priority from 0 (highest) to 7 (lowest). 
&lt;/p&gt;

&lt;p&gt;
There are three priority modes (levels):
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;disabled priorities&lt;/strong&gt; - all assigned priorities are ignored. This is the fastest and compact mode. But it does not allow to assign higher priority for more important tasks.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;normal priorities&lt;/strong&gt; - each task have it&amp;#039;s own priority. If there are several &lt;strong&gt;ready&lt;/strong&gt; tasks, then the task with the highest priority will get control. If several &lt;strong&gt;ready&lt;/strong&gt; tasks have the same priority, then they will be run in round-robin mode. This mode has two disadvantages:&lt;/div&gt;
&lt;ol&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; when there is an always ready task with high priority, no low priority tasks will get control;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; when two or more tasks have the same priority and they wait for the same event, only one of them allways will get the control;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;extended priorities&lt;/strong&gt; &lt;span style='color:red; '&gt;NEW&lt;/span&gt; - all tasks get control according to their priority. For example, if there are two always ready tasks with priorities 3 and 4, then one of them will get 55-60% of control (with priority 4) and other - 40-45%. The advantage of this mode is that all tasks guarantly will get the control. But in this mode system requires 2  addition bytes of RAM per each task.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

Read &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/speed&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:speed&quot;&gt;SPeed characteristics&lt;/a&gt; to learn more about speed of scheduler in different modes.
&lt;/p&gt;

&lt;p&gt;
The priority mode is defined once on the compilation stage by setting constant &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_PRIORITY_LEVEL&lt;/a&gt;&lt;/span&gt; in &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;osacfg.h&lt;/a&gt;&lt;/span&gt;:
&lt;/p&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#define OS_PRIORITY_LEVEL    OS_PRIORITY_DISABLE    // For disable priorities&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#define OS_PRIORITY_LEVEL    OS_PRIORITY_NORMAL     // For normal priorities&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#define OS_PRIORITY_LEVEL    OS_PRIORITY_EXTENDED   // For extended priorities&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
By default &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OS_PRIORITY_NORMAL&lt;/a&gt;&lt;/span&gt; is set.
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Priority&quot; [1996-3920] --&gt;
&lt;h2&gt;&lt;a name=&quot;priority_competition&quot; id=&quot;priority_competition&quot;&gt;Priority competition&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

There are times whan several tasks are waiting for the same event. For example they can wait for some internal resource (UART, ADC, SPI) or some external resource (EEPROM, LCD etc). How will the system behave in this case? After the event occurs, all tasks that waited for this event will become &lt;strong&gt;ready&lt;/strong&gt;. The kernel will find the task with the highest priority and run it. If, after this task executes, the event is cleared (for example, all tasks waited for a semaphore, and the executed task reset it) all tasks become &lt;strong&gt;waiting&lt;/strong&gt; again.
&lt;/p&gt;

&lt;p&gt;
When working under extended priority mode, the tasks who was ready but did not get the control (because of more priority task has reset the event) will rise it&amp;#039;s priority. This will give to it more chance to get the control next time event occured.
&lt;/p&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Priority competition&quot; [3921-] --&gt;</description>
    </item>
    <item rdf:about="http://www.pic24.ru/doku.php/en/osa/ref/description/intro?rev=1224344100">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-18T19:35:00+03:00</dc:date>
        <title>OSA : Description</title>
        <link>http://www.pic24.ru/doku.php/en/osa/ref/description/intro?rev=1224344100</link>
        <description>


&lt;h3&gt;&lt;a name=&quot;osa_description&quot; id=&quot;osa_description&quot;&gt;OSA : Description&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/project&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:project&quot;&gt;Project&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/scheduler&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:scheduler&quot;&gt;Scheduler&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/events_and_priority&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:events_and_priority&quot;&gt;Events and priority&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/description/data_types&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:description:data_types&quot;&gt;Data types&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
</description>
    </item>
    <item rdf:about="http://www.pic24.ru/doku.php/en/osa/ref/description/predefined?rev=1285158211">
        <dc:format>text/html</dc:format>
        <dc:date>2010-09-22T16:23:31+03:00</dc:date>
        <title>OSA : Predefined constants</title>
        <link>http://www.pic24.ru/doku.php/en/osa/ref/description/predefined?rev=1285158211</link>
        <description>


&lt;h2&gt;&lt;a name=&quot;osa_predefined_constants&quot; id=&quot;osa_predefined_constants&quot;&gt;OSA : Predefined constants&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;table class=&quot;inline&quot;&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;th class=&quot;col0 centeralign&quot;&gt;  Constant name  &lt;/th&gt;&lt;th class=&quot;col1 centeralign&quot;&gt;  Notes  &lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot; colspan=&quot;2&quot;&gt;  &lt;br/&gt;
  &lt;strong&gt;System&lt;/strong&gt;&lt;br/&gt;
 &lt;br/&gt;
   &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_VERISON__&lt;/span&gt;       &lt;/td&gt;&lt;td class=&quot;col1 leftalign&quot;&gt; Current OSA version in format: YYMMDD&lt;br/&gt;
 YY, MM and DD are year month and date of release&lt;br/&gt;
   &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row3&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot; colspan=&quot;2&quot;&gt;  &lt;br/&gt;
  &lt;strong&gt;Chip type&lt;/strong&gt; &lt;br/&gt;
 &lt;br/&gt;
    &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row4&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC12__&lt;/span&gt;         &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  PIC10 or 12-bit PIC12                &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row5&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC16__&lt;/span&gt;         &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  PIC16 or 14-bit PIC12                &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row6&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC16E__&lt;/span&gt;        &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  PIC12F1xxx or PIC16F1xxx             &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row7&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC18__&lt;/span&gt;         &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                                       &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row8&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_DSPIC__&lt;/span&gt;         &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  dsPIC30 or dsPIC33                   &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row9&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC24__&lt;/span&gt;         &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  PIC24F, PIC24FK or PIC24H            &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row10&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC24F__&lt;/span&gt;        &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                                       &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row11&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC24FK__&lt;/span&gt;       &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                                       &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row12&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC24H__&lt;/span&gt;        &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                                       &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row13&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_DSPIC30__&lt;/span&gt;       &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                                       &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row14&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_DSPIC33__&lt;/span&gt;       &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                                       &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row15&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_AVR__&lt;/span&gt;           &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  8-bit AVR                            &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row16&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_STM8__&lt;/span&gt;          &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                                       &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row17&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot; colspan=&quot;2&quot;&gt;  &lt;br/&gt;
  &lt;strong&gt;Compiler type&lt;/strong&gt;&lt;br/&gt;
 &lt;br/&gt;
    &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row18&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_CCS__      &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  CCS PICC                             &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row19&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_HTPICC__   &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  HiTech PICC STD                      &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row20&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_HTPICC_PRO__ &lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  HiTech PICC PRO                      &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row21&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_MPLABC__     &lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  MPLABC18 or MPLABC30                 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row22&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_MIKROC__     &lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  MikroC PRO (ver 3.0 and greater)     &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row23&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_WINAVR__     &lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  WinVAR                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row24&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_IAR__        &lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  IAR                                  &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row25&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_COSMIC__     &lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  Cosmic                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row26&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot; colspan=&quot;2&quot;&gt;  &lt;br/&gt;
  &lt;strong&gt;Chip and compiler&lt;/strong&gt;&lt;br/&gt;
 &lt;br/&gt;
   &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row27&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC12_HTPICC__     &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row28&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC16_CCS__        &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row29&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC16_HTPICC__     &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row30&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC16_MIKROC__     &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row31&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC16E_HTPICC_PRO__&lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row32&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC18_HTPICC__     &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row33&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC18_MPLABC__     &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row34&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC18_MPLABC_EXT__ &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row35&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC18_CCS__        &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row36&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC18_MIKROC__     &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row37&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_PIC24_MPLABC__     &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  Same as __OS_DSPIC_MPLABC__  &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row38&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_DSPIC_MPLABC__     &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  Same as __OS_PIC24_MPLABC__  &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row39&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_AVR_WINAVR__       &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row40&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_AVR_IAR__          &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row41&quot;&gt;
		&lt;td class=&quot;col0 leftalign&quot;&gt; &lt;span class=&quot;important&quot;&gt;__OSA_STM8_COSMIC__      &lt;/span&gt;     &lt;/td&gt;&lt;td class=&quot;col1 rightalign&quot;&gt;                               &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;
</description>
    </item>
    <item rdf:about="http://www.pic24.ru/doku.php/en/osa/ref/description/project?rev=1299681396">
        <dc:format>text/html</dc:format>
        <dc:date>2011-03-09T17:36:36+03:00</dc:date>
        <title>OSA : Project</title>
        <link>http://www.pic24.ru/doku.php/en/osa/ref/description/project?rev=1299681396</link>
        <description>


&lt;h2&gt;&lt;a name=&quot;osa_project&quot; id=&quot;osa_project&quot;&gt;OSA : Project&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;OSA : Project&quot; [1-28] --&gt;
&lt;h2&gt;&lt;a name=&quot;creating_a_project&quot; id=&quot;creating_a_project&quot;&gt;Creating a project&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

To use OSA in your application you need to do the following:

&lt;/p&gt;
&lt;ol&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Create a project using IDE. In addition to all your project files add the file osa.c to your project (it contains all system variables and function prototypes);&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; In your project folder create the file &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OSAcfg.h.&lt;/a&gt;&lt;/span&gt; This file is used to specify OSA compilation parameters (like number of tasks, timer type etc). In the simplest case this file can be empty. You can use the program &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/download/intro#tools&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:download:intro&quot;&gt;OSAcfg_Tool&lt;/a&gt; to create/modify this file;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Insert the line &amp;quot;include &amp;lt;osa.h&amp;gt;&amp;quot; into all files that will use OSA services;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Add two &amp;quot;Include search paths&amp;quot; to project options:&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; the path to &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/configuration&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:configuration&quot;&gt;OSAcfg.h&lt;/a&gt;&lt;/span&gt; for your current project&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; the path to osa.h;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; At the beginning of function main() insert a call to the &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_init&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_init&quot;&gt;OS_Init&lt;/a&gt;&lt;/span&gt;() service;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; At the end of function main() insert a call to the &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_run&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_run&quot;&gt;OS_Run&lt;/a&gt;&lt;/span&gt;() service;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Creating a project&quot; [29-1109] --&gt;
&lt;h2&gt;&lt;a name=&quot;notes_for_different_ides_and_platforms&quot; id=&quot;notes_for_different_ides_and_platforms&quot;&gt;Notes for different IDEs and platforms&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Notes for different IDEs and platforms&quot; [1110-1162] --&gt;
&lt;h3&gt;&lt;a name=&quot;mplab&quot; id=&quot;mplab&quot;&gt;MPLAB&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; To add the osa.c file click right button in Workspace window, and select the &amp;quot;Add file…&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Include-paths are set through project options: menu &amp;quot;Project/Build options/Project…&amp;quot;, tab &amp;quot;Directories&amp;quot;.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;MPLAB&quot; [1163-1387] --&gt;
&lt;h3&gt;&lt;a name=&quot;mplab_and_ht-picc&quot; id=&quot;mplab_and_ht-picc&quot;&gt;MPLAB and HT-PICC&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Old versions of mplab plug-ins for HTPICC did not support the relative paths in Include Directories list, only absolute.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;for PRO-version&lt;/strong&gt;: To provide the compiler with the correct information on call tree, all task functions shpuld be declared in main with the service &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_task_define&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_task_define&quot;&gt;OS_Task_Define&lt;/a&gt;&lt;/span&gt;()&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; main &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    OS_Init&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    ...
    &lt;span class=&quot;me1&quot;&gt;OS_Task_Define&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_Buttons&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Define&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_LEDs&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Define&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_LCD&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    ...
    &lt;span class=&quot;me1&quot;&gt;OS_Task_Create&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_Buttons&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Create&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_LEDs&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Create&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_LCD&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;MPLAB and HT-PICC&quot; [1388-2028] --&gt;
&lt;h3&gt;&lt;a name=&quot;mplab_and_mplab_c18&quot; id=&quot;mplab_and_mplab_c18&quot;&gt;MPLAB and Mplab C18&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Set the library path: menu &amp;quot;Project/Build options/Progect…&amp;quot;, tab &amp;quot;Directories&amp;quot;, combo &amp;quot;Library Search Path&amp;quot;. Enter the path for library files (e.g. c:\mcc18\lib).&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; In the project options window select the tab &amp;quot;MPLAB C18&amp;quot;, category &amp;quot;Optimization&amp;quot; and check off the &amp;quot;Procedural absraction&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Don&amp;#039;t forget to add the linker script file: right mouse button on &amp;quot;Linker Script&amp;quot; folder in &amp;quot;Workspace&amp;quot; window and select the .lkr file for your controller (see &amp;quot;MCC18\lkr&amp;quot;)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;MPLAB and Mplab C18&quot; [2029-2536] --&gt;
&lt;h3&gt;&lt;a name=&quot;mplab_and_mplab_c30&quot; id=&quot;mplab_and_mplab_c30&quot;&gt;MPLAB and Mplab C30&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; In the project options window select the tab &amp;quot;MPLAB C30&amp;quot;, category &amp;quot;Optimization&amp;quot; and check off the &amp;quot;Procedural absraction&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;MPLAB and Mplab C30&quot; [2537-2697] --&gt;
&lt;h3&gt;&lt;a name=&quot;ccs&quot; id=&quot;ccs&quot;&gt;CCS&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;don&amp;#039;t&lt;/strong&gt; add the osa.c file into the project&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; To provide the compiler with the correct information on call tree, all task functions shpuld be declared in main with the service &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_task_define&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_task_define&quot;&gt;OS_Task_Define&lt;/a&gt;&lt;/span&gt;()&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; main &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    OS_Init&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    ...
    &lt;span class=&quot;me1&quot;&gt;OS_Task_Define&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_Buttons&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Define&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_LEDs&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Define&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_LCD&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    ...
    &lt;span class=&quot;me1&quot;&gt;OS_Task_Create&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_Buttons&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Create&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_LEDs&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Create&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Task_LCD&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;CCS&quot; [2698-3228] --&gt;
&lt;h3&gt;&lt;a name=&quot;mikroc_pro_ide&quot; id=&quot;mikroc_pro_ide&quot;&gt;mikroC PRO IDE&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; To add the osa.c file select menu &amp;quot;Project/Add File To Project…&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Include-path arre set througth menu &amp;quot;Project/Edit Search Paths…&amp;quot;. In dialog box there are two path lists: Source Files and Header Files. We need the &amp;quot;Header files&amp;quot;. Press &amp;quot;green plus&amp;quot; icon to add include-paths.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; The linker must be informed about functions that will be used as tasks:&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#pragma funcall main Task_Buttons       // Tell linker that function will be&lt;/span&gt;
                                        &lt;span class=&quot;co1&quot;&gt;// called indirectly&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; Task_Buttons &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    ...
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;mikroC PRO IDE&quot; [3229-3817] --&gt;
&lt;h3&gt;&lt;a name=&quot;avr_studio_and_winavr&quot; id=&quot;avr_studio_and_winavr&quot;&gt;AVR Studio and WinAVR&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; to add the osa.c file into project do right-click in Workspace window (AVR GCC) on &amp;quot;Source Files&amp;quot; folder and select &amp;quot;Add Existing Source File(s)…&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; include-path are set througth menu &amp;quot;Project/Configuration options&amp;quot;, tab &amp;quot;Include Directories&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;AVR Studio and WinAVR&quot; [3818-4102] --&gt;
&lt;h3&gt;&lt;a name=&quot;iar&quot; id=&quot;iar&quot;&gt;IAR&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; To add the osa.c file select menu &amp;quot;Project/Add files…&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; include-path are set througth menu &amp;quot;Project/Options&amp;quot;, category &amp;quot;C/C++ compiler&amp;quot;, tab &amp;quot;preprocessor&amp;quot;, field &amp;quot;Additional include directories&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Than in tab &amp;quot;Optimization&amp;quot; check off &amp;quot;Cross call&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;IAR&quot; [4103-4377] --&gt;
&lt;h3&gt;&lt;a name=&quot;iar_and_stm8&quot; id=&quot;iar_and_stm8&quot;&gt;IAR and STM8&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; In addition to all requirements described before, add the file &amp;quot;osa\port\stm8\osa_stm_iar.s&amp;quot; into the project&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;IAR and STM8&quot; [4378-4516] --&gt;
&lt;h3&gt;&lt;a name=&quot;stvd_and_stm8&quot; id=&quot;stvd_and_stm8&quot;&gt;STVD and STM8&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; to add the osa.c file into project do right-click in Workspace window on the &amp;quot;Source&amp;quot; folder and select &amp;quot;Add Files To Folder…&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; include-path are set througth menu &amp;quot;Project/Options&amp;quot;, category &amp;quot;C compiler&amp;quot;, tab &amp;quot;preprocessor&amp;quot;, field &amp;quot;Additional include directories&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;STVD and STM8&quot; [4517-4815] --&gt;
&lt;h3&gt;&lt;a name=&quot;raisonance_and_stm8&quot; id=&quot;raisonance_and_stm8&quot;&gt;Raisonance and STM8&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; to add the osa.c file select menu &amp;quot;Project/Add Item…&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; include-path are set througth menu &amp;quot;Project/Properties&amp;quot;, folder &amp;quot;Application Optios&amp;quot;, sub-folder &amp;quot;Directories&amp;quot;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;plugin_uparrow&quot;&gt;
  &lt;a href=&quot;#&quot; title=&quot;Наверх&quot;&gt;
    &lt;img src=&quot;http://www.pic24.ru/lib/plugins/uparrow/images/blue_arrow.png&quot; alt=&quot;Наверх&quot;/&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Raisonance and STM8&quot; [4816-] --&gt;</description>
    </item>
    <item rdf:about="http://www.pic24.ru/doku.php/en/osa/ref/description/scheduler?rev=1268220258">
        <dc:format>text/html</dc:format>
        <dc:date>2010-03-10T14:24:18+03:00</dc:date>
        <title>OSA : Scheduler</title>
        <link>http://www.pic24.ru/doku.php/en/osa/ref/description/scheduler?rev=1268220258</link>
        <description>


&lt;h1&gt;&lt;a name=&quot;osa_scheduler&quot; id=&quot;osa_scheduler&quot;&gt;OSA : Scheduler&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;

Service &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_run&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_run&quot;&gt;OS_Run&lt;/a&gt;&lt;/span&gt;() - is a macro, that contains infinite loop with scheduler working. This service should be called at the end of main() function. It gives full control to OSA kernel. The scheduler lists all active tasks and looks for ready task with highest priority. When task is found scheduler execute it.
&lt;/p&gt;

&lt;p&gt;
Since &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_run&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_run&quot;&gt;OS_Run&lt;/a&gt;&lt;/span&gt;() is a macro that contains global labels, it can be called in program only once.
&lt;/p&gt;

&lt;p&gt;
Thus you program can be looks like:

&lt;/p&gt;
&lt;pre class=&quot;cpp code cpp&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; main &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    OS_Init&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Create&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;...&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    OS_Task_Create&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;...&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
    &lt;span class=&quot;co1&quot;&gt;// Create all tasks you need&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// ...&lt;/span&gt;
&amp;nbsp;
    OS_Run&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
The sheduler lists all active (created by service &lt;span class=&quot;important&quot;&gt;&lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/allservices/os_task_create&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:allservices:os_task_create&quot;&gt;OS_Task_Create&lt;/a&gt;&lt;/span&gt;) tasks and finds all ready to execute. Then shedulers compares priorities of all ready tasks and give control to most priority of them. There is one exception: when one of task is in critical section only this task can get control, other tasks are skipped by scheduler in this case.
&lt;/p&gt;

&lt;p&gt;
If while listing all tasks scheduler founds ready task with priority = 0 (highest) then scheduler stops search and give control to this task. This increases speed of scheduler&amp;#039;s work (see &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/introduction/intro#inconveniences&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:introduction:intro&quot;&gt;Inconveniences&lt;/a&gt; and &lt;a href=&quot;http://www.pic24.ru/doku.php/en/osa/ref/appendix/speed&quot; class=&quot;wikilink1&quot; title=&quot;en:osa:ref:appendix:speed&quot;&gt;Speed characteristics&lt;/a&gt;)
&lt;/p&gt;

&lt;/div&gt;
</description>
    </item>
</rdf:RDF>
