<?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: Recording the data recieved from UART</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1375006#M47074</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Regarding your following code, I think you can define an array.&lt;/P&gt;
&lt;P&gt;//global variable&lt;/P&gt;
&lt;P&gt;#define N 100&lt;/P&gt;
&lt;P&gt;char array[N];&lt;/P&gt;
&lt;P&gt;uint32_t index=0;&lt;/P&gt;
&lt;P&gt;void UART_IntReceive(void)&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data[index]=UART_ReceiveByte(LPC_UART3);&lt;/P&gt;
&lt;P&gt;index++;&lt;/P&gt;
&lt;P&gt;if (index&amp;gt;==N) index=0;&lt;BR /&gt;//I do not suggest you call UART_SendByte() in the receiver ISR&lt;BR /&gt;//UART_SendByte(LPC_UART3,data);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Is it what you expected?&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
    <pubDate>Mon, 22 Nov 2021 12:07:03 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2021-11-22T12:07:03Z</dc:date>
    <item>
      <title>Recording the data recieved from UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374639#M47059</link>
      <description>&lt;P&gt;Hello everyone, in my project, I'm sending temperature via UART and want to recieve a 2 digit number and record it in a variable. I'm able to read data and echo it back, but as far as I understood I need to recieve a two bytes of data and I'm receiving only one byte everytime UART interrupt works. Plus I wanted to see the content of the variable, in which I save the data and it's only the left most digit of the number I'm sending and the ASCII equivalent of it. For example, If I send 15, my debugger shows me something like (49' 1) and as you may know 49 is the ASCII form of 1 and when I run my code I can recieve back my right most digit in ASCII for example, for 15 I get 53 which is the ASCII form of 5. I also try to send back the data together with the temperature by UART_Send function, and in this case I only can see the ASCII form of the right most digit. So, I'm now able to only recieve the right most digit of the numbers I send and they're in ASCII what can I do to save both digits in decimal in a variable?&lt;/P&gt;&lt;P&gt;In order that you better understand what I'm saying, I added the screenshot of my debugger, my serial port terminal, and my main.c file, so that you can see my code.&lt;/P&gt;&lt;P&gt;Your help will be greatly appreciated,&lt;/P&gt;&lt;P&gt;Sincerely,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 13:21:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374639#M47059</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-11-21T13:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Recording the data recieved from UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374640#M47060</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;Your replies always helped me. I always value your opinion.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 09:55:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374640#M47060</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-11-21T09:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Recording the data recieved from UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374920#M47071</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For usart module, it can transmit or receive only ONE byte, pls refer to the usart data registers:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiangjun_rong_0-1637571773371.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/162806iDBAE014CC1E7401C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xiangjun_rong_0-1637571773371.png" alt="xiangjun_rong_0-1637571773371.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the Usart will trigger interrupt after it has received/transmitted a Byte.&lt;/P&gt;
&lt;P&gt;I see that your data is half word(16 bits), I think you can transfer the half word(temperature variable) with two byte.&lt;/P&gt;
&lt;P&gt;uint16_t temperature;&lt;/P&gt;
&lt;P&gt;char byte_L, byte_H;&lt;/P&gt;
&lt;P&gt;void halfWord(uint16_t var)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;byte_L=(char)(var&amp;amp;0xFF);&lt;/P&gt;
&lt;P&gt;byte_H=(char)((var&amp;gt;&amp;gt;8)&amp;amp;0xFF);&lt;/P&gt;
&lt;P&gt;UART_SendByte(LPC_UART3,byte_L);&lt;/P&gt;
&lt;P&gt;UART_SendByte(LPC_UART3,byte_H);&lt;/P&gt;
&lt;P&gt;UART_SendByte(LPC_UART3,0xFF);&lt;/P&gt;
&lt;P&gt;UART_SendByte(LPC_UART3,0xFF);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;I suggest you delete the line&amp;nbsp; uint8_t len=sprintf((char*)buffStr,"Hello.Temp is %u\n %u\n",temp, data1);&lt;/P&gt;
&lt;P&gt;You can transfer data directly. The 0xFFFF is a separator or mark so that the receiver know which is high byte which is low byte.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 09:29:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374920#M47071</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-11-22T09:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Recording the data recieved from UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374934#M47072</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;Thank you very much for your time and your reply. However, I can send the temperature, which is 2 bytes fine. My problem is I cannot save the data I enter via serial port using uart_receivebytr in the interrupt! How can I save the data which is 2 bytes ( 2 digit number string)?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 09:46:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374934#M47072</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-11-22T09:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Recording the data recieved from UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374936#M47073</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/26034"&gt;@xiangjun_rong&lt;/a&gt;&amp;nbsp;Thank you very much for your time and your reply. However, I can send the temperature, which is 2 bytes fine. My problem is I cannot save the data I enter via serial port using uart_receivebyte in the interrupt! How can I save the data which is 2 bytes ( 2 digit number string)?&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 22 Nov 2021 09:49:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1374936#M47073</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-11-22T09:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: Recording the data recieved from UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1375006#M47074</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Regarding your following code, I think you can define an array.&lt;/P&gt;
&lt;P&gt;//global variable&lt;/P&gt;
&lt;P&gt;#define N 100&lt;/P&gt;
&lt;P&gt;char array[N];&lt;/P&gt;
&lt;P&gt;uint32_t index=0;&lt;/P&gt;
&lt;P&gt;void UART_IntReceive(void)&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data[index]=UART_ReceiveByte(LPC_UART3);&lt;/P&gt;
&lt;P&gt;index++;&lt;/P&gt;
&lt;P&gt;if (index&amp;gt;==N) index=0;&lt;BR /&gt;//I do not suggest you call UART_SendByte() in the receiver ISR&lt;BR /&gt;//UART_SendByte(LPC_UART3,data);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Is it what you expected?&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 12:07:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1375006#M47074</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-11-22T12:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Recording the data recieved from UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1375036#M47075</link>
      <description>&lt;P&gt;Yeah absolutely, it's what I expected and I think it makes sense. Thank you so much, I'll give it a try. &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 13:05:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1375036#M47075</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-11-22T13:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Recording the data recieved from UART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1381465#M47242</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;Thanks a lot, man. It worked &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Dec 2021 18:23:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recording-the-data-recieved-from-UART/m-p/1381465#M47242</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2021-12-05T18:23:22Z</dc:date>
    </item>
  </channel>
</rss>

