<?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>LPC MicrocontrollersのトピックRe: LPC1768 UART recieve problem</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1344200#M46528</link>
    <description>&lt;P&gt;Thank you very much. I'll try it and will let you know if it works for me.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Sep 2021 16:34:45 GMT</pubDate>
    <dc:creator>Alex_2221</dc:creator>
    <dc:date>2021-09-22T16:34:45Z</dc:date>
    <item>
      <title>LPC1768 UART recieve problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1343428#M46502</link>
      <description>&lt;P&gt;Hello everyone, I'm trying to read two temperatures using LM35 and send them to a phone or computer using HC05 in order to control them. I want to send setpoints to the MCU. I tried to send different numbers ( 2 digit numbers) to the MCU and echo them, however I managed to recieve only the first digit of the numbers I was trying to send. I thought maybe I have problems in sending back the numbers&amp;nbsp; and I tried to use the recieved temperature in my code as a setpoint, but it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Here is my code. I also added the C file.&lt;/P&gt;&lt;P&gt;Thanks in advance, Alex&lt;/P&gt;&lt;P&gt;Code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include "lpc17xx_gpio.h"&lt;BR /&gt;#include "lpc17xx_pinsel.h"&lt;BR /&gt;#include "lpc17XX_uart.h"&lt;BR /&gt;#include "lpc17XX_adc.h"&lt;/P&gt;&lt;P&gt;#include "Hardware.h"&lt;BR /&gt;#include "Delay_RIT.h"&lt;/P&gt;&lt;P&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;uint8_t buffstr [20];&lt;BR /&gt;uint8_t Temprec [1];&lt;BR /&gt;uint8_t temprec;&lt;/P&gt;&lt;P&gt;GPIO_SetDir(2,(1&amp;lt;&amp;lt;2),1);&lt;BR /&gt;&lt;BR /&gt;HW_Init();&lt;BR /&gt;&lt;BR /&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;uint16_t temp1 = HW_ADC_Read1();&lt;BR /&gt;uint16_t temp2 = HW_ADC_Read2();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;uint8_t len= sprintf( (char*)buffstr," %u\n %u\n ",temp1,temp2);&lt;BR /&gt;UART_Send(LPC_UART3,buffstr,len,NONE_BLOCKING);&lt;BR /&gt;&lt;BR /&gt;UART_Receive(LPC_UART3,Temprec,1,NONE_BLOCKING);&lt;BR /&gt;&lt;BR /&gt;temprec= Temprec[0];&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Delay_RIT_ms(1000);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;if(temp1&amp;gt;=(temprec+1))&lt;BR /&gt;GPIO_ClearValue(2,(1&amp;lt;&amp;lt;2)) ;&lt;/P&gt;&lt;P&gt;else if ( temp1&amp;lt;=temprec)&lt;/P&gt;&lt;P&gt;GPIO_SetValue(2,(1&amp;lt;&amp;lt;2));&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 18:09:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1343428#M46502</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-09-21T18:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 UART recieve problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1343457#M46503</link>
      <description>&lt;P&gt;I use this code for checking if the MCU can echo the number, but whenever I use UART_RECIEV (&amp;nbsp; blocking) I can correctly echo back the number, but it only works once and I can't recieve anything else from the MCU like the temperatures of the two sensors and if I use&amp;nbsp;&amp;nbsp;UART_RECIEV (&amp;nbsp; none-blocking) I can only echo back the first digit of the number, but can recieve the temperature and change the number that I am sending as a setpoint:&lt;/P&gt;&lt;P&gt;UART_Receive(LPC_UART3,Temprec,2,NONE_BLOCKING);&lt;/P&gt;&lt;P&gt;UART_Send(LPC_UART3,Temprec,2,BLOCKING);&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 19:33:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1343457#M46503</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-09-21T19:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 UART recieve problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1343458#M46504</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/26034"&gt;@xiangjun_rong&lt;/a&gt;&amp;nbsp; What do you think about this?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 19:35:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1343458#M46504</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-09-21T19:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 UART recieve problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1343622#M46510</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;How about using the code:&lt;/P&gt;
&lt;P&gt;uint8_t counter;&lt;/P&gt;
&lt;P&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;uint16_t temp1 = HW_ADC_Read1();&lt;BR /&gt;uint16_t temp2 = HW_ADC_Read2();&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;uint8_t len= sprintf( (char*)buffstr," %u\n %u\n ",temp1,temp2);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter=len-1;&lt;/P&gt;
&lt;P&gt;while(1)&lt;/P&gt;
&lt;P&gt;{&lt;BR /&gt;UART_Send(LPC_UART3,buffstr[counter],1,BLOCKING);&lt;/P&gt;
&lt;P&gt;UART_Receive(LPC_UART3,Temprec,1,BLOCKING);&lt;/P&gt;
&lt;P&gt;if(counter==0) break;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter--;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;temprec= Temprec[0];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Delay_RIT_ms(1000);&lt;/P&gt;
&lt;P&gt;if(temp1&amp;gt;=(temprec+1))&lt;BR /&gt;GPIO_ClearValue(2,(1&amp;lt;&amp;lt;2)) ;&lt;/P&gt;
&lt;P&gt;else if ( temp1&amp;lt;=temprec)&lt;/P&gt;
&lt;P&gt;GPIO_SetValue(2,(1&amp;lt;&amp;lt;2));&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;pls have a try&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 03:16:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1343622#M46510</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-09-22T03:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 UART recieve problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1344200#M46528</link>
      <description>&lt;P&gt;Thank you very much. I'll try it and will let you know if it works for me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 16:34:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1344200#M46528</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-09-22T16:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 UART recieve problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1345251#M46546</link>
      <description>&lt;P&gt;I tested your code. I was able to receive the number that I send via HC05 successfully, but I don't recieve the temperatures of the sensors on my phone continously anymore.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 18:54:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-UART-recieve-problem/m-p/1345251#M46546</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-09-23T18:54:14Z</dc:date>
    </item>
  </channel>
</rss>

