<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									ваттметр stm32f103 - STM32				            </title>
            <link>https://microtechnics.ru/community/stm32/vatt-meter-stm32f103/</link>
            <description>Обсуждение вопросов, посвященных программированию микроконтроллеров, разработке электроники и не только.</description>
            <language>ru-RU</language>
            <lastBuildDate>Mon, 15 Jun 2026 04:43:32 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>ваттметр stm32f103</title>
                        <link>https://microtechnics.ru/community/stm32/vatt-meter-stm32f103/#post-2709</link>
                        <pubDate>Fri, 02 Feb 2024 20:57:37 +0000</pubDate>
                        <description><![CDATA[Добрый день .Начал работу над ваттметром для фиксации количества энергии . как ваты  преобразовать в ватт*ч ??
Как я понимаю нужно настроить  таймер и для сложение замеров нужно складывать ...]]></description>
                        <content:encoded><![CDATA[<p>Добрый день .Начал работу над ваттметром для фиксации количества энергии . как ваты  преобразовать в ватт*ч ??</p>
<p>Как я понимаю нужно настроить  таймер и для сложение замеров нужно складывать и сохранять .Можете подсказать как реализовать эту затею .</p>
<p> </p>
<p> </p>
<div style="background-color: #ffffff;padding: 0px 0px 0px 2px">
<div style="color: #000000;background-color: #ffffff;font-size: 10pt">
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #7f0055;font-weight: bold">while</span><span style="color: #000000"> (1)</span></p>
<p style="margin: 0"><span style="color: #000000"> {</span></p>
<p style="margin: 0"><span style="color: #000000"> HAL_ADC_Start_DMA(&amp;hadc1, (</span><span style="color: #005032">uint32_t</span><span style="color: #000000">*)&amp;adc, 5); </span><span style="color: #3f7f5f">// </span><span style="color: #3f7f5f;text-decoration: underline">стартуем</span><span style="color: #3f7f5f"> АЦП</span></p>
<p style="margin: 0"> </p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #7f0055;font-weight: bold">float</span><span style="color: #000000"> A ;</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #7f0055;font-weight: bold">float</span><span style="color: #000000"> B ;</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #7f0055;font-weight: bold">float</span><span style="color: #000000"> C ;</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #7f0055;font-weight: bold">float</span><span style="color: #000000"> D ;</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #7f0055;font-weight: bold">float</span><span style="color: #000000"> E ;</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #7f0055;font-weight: bold">float</span><span style="color: #000000"> AB= 0;</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #7f0055;font-weight: bold">float</span><span style="color: #000000"> CD= 0;</span></p>
<p style="margin: 0"> </p>
<p style="margin: 0"><span style="color: #000000"> A =(adc*(3.3/4095)); <br /></span></p>
<p style="margin: 0"><span style="color: #000000"> B =(adc*(3.3/4095));    //напряжение<br /></span></p>
<p style="margin: 0"><span style="color: #000000"> C =(adc*(3.3/4095)); <br /></span></p>
<p style="margin: 0"><span style="color: #000000"> D =(adc*(3.3/4095));</span></p>
<p style="margin: 0"><span style="color: #000000"> E =(adc*(3.3/4095));</span></p>
<p style="margin: 0"> </p>
<p style="margin: 0"><span style="color: #000000"> AB=(A*B);  //ватты 1<br /></span></p>
<p style="margin: 0"><span style="color: #000000"> CD=C*D;    // ватты 2<br /></span></p>
<p style="margin: 0"> </p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #642880;font-weight: bold">snprintf</span><span style="color: #000000">(trans_str1, 63, </span><span style="color: #2a00ff">"%.2fV"</span><span style="color: #000000">, A);</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #642880;font-weight: bold">snprintf</span><span style="color: #000000">(trans_str2, 63, </span><span style="color: #2a00ff">"%.2fA"</span><span style="color: #000000">, B);</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #642880;font-weight: bold">snprintf</span><span style="color: #000000">(trans_str3, 63, </span><span style="color: #2a00ff">"%.2fV"</span><span style="color: #000000">, C);</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #642880;font-weight: bold">snprintf</span><span style="color: #000000">(trans_str4, 63, </span><span style="color: #2a00ff">"%.2fA"</span><span style="color: #000000">, D);</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #642880;font-weight: bold">snprintf</span><span style="color: #000000">(trans_str5, 63, </span><span style="color: #2a00ff">"%f"</span><span style="color: #000000"> , E);</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #642880;font-weight: bold">snprintf</span><span style="color: #000000">(trans_str6, 63, </span><span style="color: #2a00ff">"%.2fW"</span><span style="color: #000000">, AB);</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #642880;font-weight: bold">snprintf</span><span style="color: #000000">(trans_str7, 63, </span><span style="color: #2a00ff">"%.2fW"</span><span style="color: #000000">, CD);</span></p>
<p style="margin: 0"> </p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #3f7f5f">//ВРЕМЯ</span></p>
<p style="margin: 0"><span style="color: #000000"> HAL_RTC_GetTime(&amp;hrtc, &amp;sTime, RTC_FORMAT_BIN); </span><span style="color: #3f7f5f">// RTC_FORMAT_BIN , RTC_FORMAT_BCD</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #642880;font-weight: bold">snprintf</span><span style="color: #000000">(trans_strT, 63, </span><span style="color: #2a00ff">"Time %d:%d:%d"</span><span style="color: #000000">, sTime.</span><span style="color: #0000c0">Hours</span><span style="color: #000000">, sTime.</span><span style="color: #0000c0">Minutes</span><span style="color: #000000">, sTime.</span><span style="color: #0000c0">Seconds</span><span style="color: #000000">);</span></p>
<p style="margin: 0"> </p>
<p style="margin: 0"> </p>
<p style="margin: 0"> </p>
<p style="margin: 0"><span style="color: #3f7f5f">//</span><span style="color: #3f7f5f;text-decoration: underline">Отображене</span><span style="color: #3f7f5f"> </span><span style="color: #3f7f5f;text-decoration: underline">времени</span></p>
<p style="margin: 0"> </p>
<p style="margin: 0"><span style="color: #000000"> ILI9341_WriteString(2, 8, trans_strT ,Font_16x26, ILI9341_WHITE, ILI9341_BLACK);</span></p>
<p style="margin: 0"><span style="color: #3f7f5f">//1</span></p>
<p style="margin: 0"><span style="color: #000000"> ILI9341_WriteString(2, 51, trans_str1 ,Font_16x26, ILI9341_COLOR565(0,128,128), ILI9341_BLACK);</span></p>
<p style="margin: 0"><span style="color: #000000"> ILI9341_WriteString(120, 51,trans_str2,Font_16x26, ILI9341_YELLOW, ILI9341_BLACK);</span></p>
</div>
</div>]]></content:encoded>
						                            <category domain="https://microtechnics.ru/community/stm32/">STM32</category>                        <dc:creator>ixar88</dc:creator>
                        <guid isPermaLink="true">https://microtechnics.ru/community/stm32/vatt-meter-stm32f103/#post-2709</guid>
                    </item>
							        </channel>
        </rss>
		