<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.viewtool.com/wiki/index.php?action=history&amp;feed=atom&amp;title=%E5%87%BD%E6%95%B0%EF%BC%9AUART_ReadBytes</id>
		<title>函数：UART ReadBytes - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.viewtool.com/wiki/index.php?action=history&amp;feed=atom&amp;title=%E5%87%BD%E6%95%B0%EF%BC%9AUART_ReadBytes"/>
		<link rel="alternate" type="text/html" href="http://www.viewtool.com/wiki/index.php?title=%E5%87%BD%E6%95%B0%EF%BC%9AUART_ReadBytes&amp;action=history"/>
		<updated>2026-06-30T07:57:59Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.viewtool.com/wiki/index.php?title=%E5%87%BD%E6%95%B0%EF%BC%9AUART_ReadBytes&amp;diff=273963&amp;oldid=prev</id>
		<title>Xuzuolan: Created page with &quot;从UART接收缓冲区返回已经接收到的数据。  ==== 原型 ==== int32_t WINAPI UART_ReadBytes(int32_t DevIndex,int32_t UARTIndex,uint8_t *pReadData,uint16_t *pLen);...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.viewtool.com/wiki/index.php?title=%E5%87%BD%E6%95%B0%EF%BC%9AUART_ReadBytes&amp;diff=273963&amp;oldid=prev"/>
				<updated>2021-05-12T06:41:38Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;从UART接收缓冲区返回已经接收到的数据。  ==== 原型 ==== int32_t WINAPI UART_ReadBytes(int32_t DevIndex,int32_t UARTIndex,uint8_t *pReadData,uint16_t *pLen);...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;从UART接收缓冲区返回已经接收到的数据。&lt;br /&gt;
&lt;br /&gt;
==== 原型 ====&lt;br /&gt;
int32_t WINAPI UART_ReadBytes(int32_t DevIndex,int32_t UARTIndex,uint8_t *pReadData,uint16_t *pLen);&lt;br /&gt;
==== 参数 ====&lt;br /&gt;
'''DevIndex''': 设备索引号，若当前只有一个设备与电脑连接则索引号为0，若有多个设备与电脑连接则根据实际需要打开的设备设置对应的索引号。 &amp;lt;br&amp;gt;&lt;br /&gt;
'''UARTIndex''': UART通道索引号，取值0或者1。 &amp;lt;br&amp;gt;&lt;br /&gt;
'''pReadData''': 数据接收缓冲区首地址。 &amp;lt;br&amp;gt;&lt;br /&gt;
'''pLen''': 实际接收到的数据字节数变量地址，该变量反应调用该函数后实际获取到了多少字节数据，若没读到数据则该变量为0。 &amp;lt;br&amp;gt;&lt;br /&gt;
==== 返回值 ====&lt;br /&gt;
程序执行状态，0代表执行相应功能成功，其他返回值含义请参考错误码定义表。&lt;br /&gt;
==== 示例 ====&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;quot;ControUART.h&amp;quot;&lt;br /&gt;
 int ret;&lt;br /&gt;
 uint16_t Len = 0;&lt;br /&gt;
 uint8_t ReadBuffer[64]={0};&lt;br /&gt;
 uint32_t AllDataNum = 0;&lt;br /&gt;
 while(1){&lt;br /&gt;
 ret = UART_ReadBytes(0,0,ReadBuffer,&amp;amp;Len);&lt;br /&gt;
 if(ret == ERR_READ_NO_DATA){&lt;br /&gt;
 Sleep(50);&lt;br /&gt;
 continue;&lt;br /&gt;
 }else if(ret == ERR_SUCCESS){&lt;br /&gt;
 if(Len &amp;gt; 0){&lt;br /&gt;
 AllDataNum += Len;&lt;br /&gt;
 for(int i=0;i&amp;lt;Len;i++){&lt;br /&gt;
 printf(&amp;quot;%02X &amp;quot;,ReadBuffer[i]);&lt;br /&gt;
 if(((i+1)%16)==0){&lt;br /&gt;
 printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
 printf(&amp;quot;AllDataNum = %d\n&amp;quot;,AllDataNum);&lt;br /&gt;
 Len = 0;&lt;br /&gt;
 }&lt;br /&gt;
 Sleep(50);&lt;br /&gt;
 }else{&lt;br /&gt;
 printf(&amp;quot;Read data error!\n&amp;quot;);&lt;br /&gt;
 return;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Xuzuolan</name></author>	</entry>

	</feed>