<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=46&amp;t=19927&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2018-01-07T16:38:12+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=46&amp;t=19927&amp;mode</id>
<entry>
<author><name><![CDATA[coolwilk]]></name></author>
<updated>2018-01-07T16:38:12+01:00</updated>
<published>2018-01-07T16:38:12+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=19927&amp;p=201636#p201636</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=19927&amp;p=201636#p201636"/>
<title type="html"><![CDATA[Re: [STM32F411E] Połączenie z modułem DHT11]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=19927&amp;p=201636#p201636"><![CDATA[
W ogóle dziwna sprawa, teraz moduł wyświetla mi wartość wilgotności, nie mam niestety jak sprawdzić czy jest poprawna, ale temperatura nic a nic (cały czas jest wartość 0 przy Temp i TempDec)<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=18721">coolwilk</a> — 7 sty 2018, o 16:38</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[coolwilk]]></name></author>
<updated>2018-01-06T22:12:51+01:00</updated>
<published>2018-01-06T22:12:51+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=19927&amp;p=201614#p201614</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=19927&amp;p=201614#p201614"/>
<title type="html"><![CDATA[[STM32F411E] Połączenie z modułem DHT11]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=19927&amp;p=201614#p201614"><![CDATA[
Witam, próbuje ustawić komunikację między STM a modułem DHT11. <br />Posiłkowałem się tym przykładem, który dostosowałem do potrzeb mojej płytki:<br /><a href="http://www.muhittinkaplan.com/?p=287"  class="postlink">http://www.muhittinkaplan.com/?p=287</a><br />Tak kod wygląda u mnie: <br />[syntax=c]* File Name          : main.c<br />  * Description        : Main program body<br />  ******************************************************************************<br />  ** This notice applies to any and all portions of this file<br />  * that are not between comment pairs USER CODE BEGIN and<br />  * USER CODE END. Other portions of this file, whether <br />  * inserted by the user or by software development tools<br />  * are owned by their respective copyright owners.<br />  *<br />  * COPYRIGHT(c) 2018 STMicroelectronics<br />  *<br />  * Redistribution and use in source and binary forms, with or without modification,<br />  * are permitted provided that the following conditions are met:<br />  *   1. Redistributions of source code must retain the above copyright notice,<br />  *      this list of conditions and the following disclaimer.<br />  *   2. Redistributions in binary form must reproduce the above copyright notice,<br />  *      this list of conditions and the following disclaimer in the documentation<br />  *      and/or other materials provided with the distribution.<br />  *   3. Neither the name of STMicroelectronics nor the names of its contributors<br />  *      may be used to endorse or promote products derived from this software<br />  *      without specific prior written permission.<br />  *<br />  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;<br />  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br />  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE<br />  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE<br />  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL<br />  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR<br />  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER<br />  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,<br />  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE<br />  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br />  *<br />  ******************************************************************************<br />  */<br /><br />/* Includes ------------------------------------------------------------------*/<br />#include &quot;main.h&quot;<br />#include &quot;stm32f4xx_hal.h&quot;<br /><br />/* USER CODE BEGIN Includes */<br />#include &quot;dwt_stm32_delay.h&quot;<br />/* USER CODE END Includes */<br /><br />/* Private variables ---------------------------------------------------------*/<br /><br />/* USER CODE BEGIN PV */<br />/* Private variables ---------------------------------------------------------*/<br />uint16_t Rh,RhDec,Temp,TempDec,ChkSum;<br />/* USER CODE END PV */<br /><br />/* Private function prototypes -----------------------------------------------*/<br />void SystemClock_Config(void);<br />static void MX_GPIO_Init(void);<br /><br />/* USER CODE BEGIN PFP */<br />/* Private function prototypes -----------------------------------------------*/<br /><br />GPIO_InitTypeDef GPIO_InitStruct;<br /><br /><br />void TermometrPinOut(void)<br />{<br />__HAL_RCC_GPIOE_CLK_ENABLE();<br /><br />GPIO_InitStruct.Pin = DHT11_Pin;<br />GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;<br />GPIO_InitStruct.Pull = GPIO_NOPULL;<br />GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;<br />HAL_GPIO_Init(DHT11_GPIO_Port, &amp;GPIO_InitStruct);<br />}<br /><br />void TermometrPinIn(void)<br />{<br />__HAL_RCC_GPIOE_CLK_ENABLE();<br /><br />GPIO_InitStruct.Pin = DHT11_Pin;<br />GPIO_InitStruct.Mode = GPIO_MODE_INPUT;<br />GPIO_InitStruct.Pull = GPIO_NOPULL;<br />HAL_GPIO_Init(DHT11_GPIO_Port, &amp;GPIO_InitStruct);<br />}<br /><br />void DHT11Read (uint16_t *Rh, uint16_t *RhDec, uint16_t *Temp, uint16_t *TempDec, uint16_t *ChkSum)<br />{<br />uint16_t temp;<br />uint8_t i,j;<br />uint16_t Wartosc&#91;5&#93;={0x00, 0x00, 0x00, 0x00, 0x00};<br /><br />TermometrPinOut();<br />HAL_GPIO_WritePin(DHT11_GPIO_Port,DHT11_Pin,GPIO_PIN_RESET);<br />DWT_Delay_us(18000);<br />HAL_GPIO_WritePin(DHT11_GPIO_Port,DHT11_Pin,GPIO_PIN_SET);<br />DWT_Delay_us(40);<br />TermometrPinIn();<br /><br />while(!HAL_GPIO_ReadPin(DHT11_GPIO_Port, DHT11_Pin));<br /><br />while(HAL_GPIO_ReadPin(DHT11_GPIO_Port, DHT11_Pin));<br /><br />for (j = 0; j&lt;5; j++){<br />for (i = 0; i&lt;5; i++){<br />while(!HAL_GPIO_ReadPin(DHT11_GPIO_Port, DHT11_Pin));<br />DWT-&gt;CYCCNT = 0;<br />while(HAL_GPIO_ReadPin(DHT11_GPIO_Port, DHT11_Pin));<br />temp=(DWT -&gt; CYCCNT)/100;<br /><br />if (temp&lt;30){<br />Wartosc&#91;j&#93;=Wartosc&#91;j&#93;&lt;&lt;1;<br />}<br />else {<br />Wartosc&#91;j&#93;=Wartosc&#91;j&#93;&lt;&lt;1;<br />Wartosc&#91;j&#93;=Wartosc&#91;j&#93;+1;<br />}<br /><br />}<br />}<br />*Rh = Wartosc&#91;0&#93;;<br />*RhDec = Wartosc&#91;1&#93;;<br />*Temp=Wartosc&#91;2&#93;;<br />*TempDec=Wartosc&#91;3&#93;;<br />*ChkSum=Wartosc&#91;4&#93;;<br /><br />}<br /><br />/* USER CODE END PFP */<br /><br />/* USER CODE BEGIN 0 */<br /><br />/* USER CODE END 0 */<br /><br />int main(void)<br />{<br /><br />  /* USER CODE BEGIN 1 */<br /><br />  /* USER CODE END 1 */<br /><br />  /* MCU Configuration----------------------------------------------------------*/<br /><br />  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */<br />  HAL_Init();<br /><br />  /* USER CODE BEGIN Init */<br /><br />  /* USER CODE END Init */<br /><br />  /* Configure the system clock */<br />  SystemClock_Config();<br /><br />  /* USER CODE BEGIN SysInit */<br /><br />  /* USER CODE END SysInit */<br /><br />  /* Initialize all configured peripherals */<br />  MX_GPIO_Init();<br /><br />  /* USER CODE BEGIN 2 */<br />  DWT_Delay_Init();<br />  /* USER CODE END 2 */<br /><br />  /* Infinite loop */<br />  /* USER CODE BEGIN WHILE */<br />  while (1)<br />  {<br /> DHT11Read(&amp;Rh,&amp;RhDec,&amp;Temp,&amp;TempDec,&amp;ChkSum);<br /> HAL_Delay(1000);<br /><br />  /* USER CODE END WHILE */<br /><br />  /* USER CODE BEGIN 3 */<br /><br />  }<br />  /* USER CODE END 3 */<br /><br />}[/syntax]<br />No i nie wiem co jest, wyrzuca mi wyniki, które są błędne, w ogole się nie zmieniają. Nie wiem za bardzo co poprawić. Ma ktoś może jakiś pomysł?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=18721">coolwilk</a> — 6 sty 2018, o 22:12</p><hr />
]]></content>
</entry>
</feed>