<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MQX Software SolutionsのトピックAdc read</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Adc-read/m-p/275170#M8508</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, i'm trying to read a data from the ADC on a TWRMCF51MM256 but i have a problem with the function &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1377521961547536" jivemacro_uid="_1377521961547536"&gt;
&lt;P&gt;adc_ch4 = fopen("adc:four", (const char*)&amp;amp;adc_channel_param4);//inizializzo il canale quattro dell'adc&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that return a null, and where the parameter are&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13775220030985542" jivemacro_uid="_13775220030985542"&gt;
&lt;P&gt;ADC_INIT_CHANNEL_STRUCT adc_channel_param4 = {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ADC_SOURCE_AD4, /* physical ADC channel */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ADC_CHANNEL_MEASURE_ONCE | ADC_CHANNEL_START_NOW, /* one sequence is sampled after fopen */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* number of samples in one run sequence */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 0,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* time offset from trigger point in us */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 600000,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* period in us (= 0.6 sec) */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 0x10000,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* scale range of result (not used now) */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* circular buffer size (sample count) */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; MY_TRIGGER,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* logical trigger ID that starts this ADC channel */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; };&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what i want to do is to read the data every second with this function &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13775220525726082" jivemacro_uid="_13775220525726082"&gt;
&lt;P&gt;for(;;){&lt;/P&gt;
&lt;P&gt;&amp;nbsp; printf("Triggering channel #4...");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ioctl(adc_file, ADC_IOCTL_RUN_CHANNEL, NULL);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if(read(adc_ch4, &amp;amp;data, sizeof(data)))&lt;/P&gt;
&lt;P&gt;&amp;nbsp; printf("ADC ch 4: %4d ", data.result);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; _time_delay(1000);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when is called the function ioctl the sistem stop to work, where is the error?&lt;/P&gt;&lt;P&gt;Sorry but I am at the beginning with this operating system&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Aug 2013 13:03:51 GMT</pubDate>
    <dc:creator>danielecortella</dc:creator>
    <dc:date>2013-08-26T13:03:51Z</dc:date>
    <item>
      <title>Adc read</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Adc-read/m-p/275170#M8508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, i'm trying to read a data from the ADC on a TWRMCF51MM256 but i have a problem with the function &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1377521961547536" jivemacro_uid="_1377521961547536"&gt;
&lt;P&gt;adc_ch4 = fopen("adc:four", (const char*)&amp;amp;adc_channel_param4);//inizializzo il canale quattro dell'adc&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that return a null, and where the parameter are&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13775220030985542" jivemacro_uid="_13775220030985542"&gt;
&lt;P&gt;ADC_INIT_CHANNEL_STRUCT adc_channel_param4 = {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ADC_SOURCE_AD4, /* physical ADC channel */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ADC_CHANNEL_MEASURE_ONCE | ADC_CHANNEL_START_NOW, /* one sequence is sampled after fopen */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* number of samples in one run sequence */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 0,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* time offset from trigger point in us */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 600000,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* period in us (= 0.6 sec) */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 0x10000,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* scale range of result (not used now) */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* circular buffer size (sample count) */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; MY_TRIGGER,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* logical trigger ID that starts this ADC channel */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; };&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what i want to do is to read the data every second with this function &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13775220525726082" jivemacro_uid="_13775220525726082"&gt;
&lt;P&gt;for(;;){&lt;/P&gt;
&lt;P&gt;&amp;nbsp; printf("Triggering channel #4...");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ioctl(adc_file, ADC_IOCTL_RUN_CHANNEL, NULL);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if(read(adc_ch4, &amp;amp;data, sizeof(data)))&lt;/P&gt;
&lt;P&gt;&amp;nbsp; printf("ADC ch 4: %4d ", data.result);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; _time_delay(1000);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when is called the function ioctl the sistem stop to work, where is the error?&lt;/P&gt;&lt;P&gt;Sorry but I am at the beginning with this operating system&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Aug 2013 13:03:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Adc-read/m-p/275170#M8508</guid>
      <dc:creator>danielecortella</dc:creator>
      <dc:date>2013-08-26T13:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adc read</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Adc-read/m-p/275171#M8509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you help me? Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 20:49:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Adc-read/m-p/275171#M8509</guid>
      <dc:creator>danielecortella</dc:creator>
      <dc:date>2013-08-28T20:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: Adc read</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Adc-read/m-p/275172#M8510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Daniele Cortellazzi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any progress? Have you figured out why fopen returns null? What version of MQX do you use?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;0xc0170&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 05:44:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Adc-read/m-p/275172#M8510</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2013-08-30T05:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Adc read</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Adc-read/m-p/275173#M8511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, in this days i'm working on other project. Seeing on the reference manual of mqx (i'm using mqx 3.8) i see that the struct is defined so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13778457737118784" jivemacro_uid="_13778457737118784"&gt;
&lt;P&gt;const ADC_INIT_CHANNEL_STRUCT adc_channel_param1 = {&lt;/P&gt;
&lt;P&gt;ADC_SOURCE_AN1, /* physical ADC channel */&lt;/P&gt;
&lt;P&gt;ADC_CHANNEL_MEASURE_ONCE | ADC_CHANNEL_START_NOW,&lt;/P&gt;
&lt;P&gt;/* one sequence is sampled after fopen */&lt;/P&gt;
&lt;P&gt;10, /* number of samples in one run sequence */&lt;/P&gt;
&lt;P&gt;100000, /* time offset from trigger point in us */&lt;/P&gt;
&lt;P&gt;500000, /* period in us (=500ms) */&lt;/P&gt;
&lt;P&gt;0, /* reserved - not used */&lt;/P&gt;
&lt;P&gt;10, /* circular buffer size (sample count) */&lt;/P&gt;
&lt;P&gt;ADC_TRIGGER_2, /* logical trigger ID that starts this ADC channel */&lt;/P&gt;
&lt;P&gt;&amp;amp;evn /* pointer to event */&lt;/P&gt;
&lt;P&gt;0x01 /* event mask to be set */&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in my struct there isn't the &amp;amp;evn, is an error? i hope to test this this afternoon. Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 06:59:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Adc-read/m-p/275173#M8511</guid>
      <dc:creator>danielecortella</dc:creator>
      <dc:date>2013-08-30T06:59:08Z</dc:date>
    </item>
  </channel>
</rss>

