<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>自动传送归档 - Kvaser</title>
	<atom:link href="https://www.kvaser.cn/support/developer-blog/tag/%e8%87%aa%e5%8a%a8%e4%bc%a0%e9%80%81/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.kvaser.cn/support/developer-blog/tag/自动传送/</link>
	<description>先进的CAN总线解决方案专家</description>
	<lastBuildDate>Thu, 25 Apr 2019 10:33:13 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.kvaser.cn/wp-content/uploads/2024/06/favicon-3.ico</url>
	<title>自动传送归档 - Kvaser</title>
	<link>https://www.kvaser.cn/support/developer-blog/tag/自动传送/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>使用对象缓冲</title>
		<link>https://www.kvaser.cn/developer-blog/using-object-buffers/</link>
		
		<dc:creator><![CDATA[Jerry Thorsén]]></dc:creator>
		<pubDate>Wed, 22 Apr 2015 18:01:11 +0000</pubDate>
				<guid isPermaLink="false">http://www.kvaser.cn/?post_type=developer_blog&#038;p=7397</guid>

					<description><![CDATA[<p>The post <a href="https://www.kvaser.cn/developer-blog/using-object-buffers/">使用对象缓冲</a> appeared first on <a href="https://www.kvaser.cn">Kvaser</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>我们的一些分析仪配备了用于自动发送或响应报文的硬件缓冲。它们可以在时序条件严格的情况下使用，并且可能无法在应用程序级别上实现。</p>
<p>通常，由Kvaser单元中的CAN驱动程序接收到的CAN报文必须通过USB或PCI端口传送到计算机。在应用程序处理之前，必须通过操作系统并由驱动程序接收。现在，它并不像传闻中的那么慢，但有时候还不够快。那此时就是Kvaser对象缓冲发挥作用的时候了，它可用来解决这些步骤造成的延迟。</p>
<p>我们有两种类型的对象缓冲：<span style="text-decoration: underline;">自动响应</span>和<span style="text-decoration: underline;">自动传送</span>。</p>
<ul>
<li><span style="text-decoration: underline;">自动响应</span>是在收到符合条件的报文后立即发送定义的报文。</li>
<li><span style="text-decoration: underline;">自动传送</span>是定期发送报文，时间精度高于通过驱动程序和操作系统运行的应用程序所能实现的。</li>
</ul>

		</div>
	</div>

	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<h1>使用对象缓冲</h1>
<h3>情况1：自动响应</h3>
<p>要使用对象缓冲，首先要分配一个调用<a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#gacfd23956af809dfc6db822c2f5ba25e7"><b>canObjBufAllocate()</b></a>的缓冲。</p>
<p>对于自动响应缓冲，你可以通过<a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#ga16a648123fbc05b8c4a2a46d7d7e1c2c"><b>canObjBufSetFilter()</b></a>函数定义要响应的报文，并使用<a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#ga9b0e3dffd54e5abdd6972dd468353022"><b>canObjBufWrite()</b></a>函数设置响应的内容。</p>
<p>要启用缓冲，请调用<a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#ga3e145ec233501345db191ae715a09cb4"><b>canObjBufEnable()</b></a>函数，并调用<a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#gaeb6e506db100de24d556ab65c2fcb593"><b>canObjBufDisable()</b></a>函数来禁用它。</p>
<p><a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#ga16a648123fbc05b8c4a2a46d7d7e1c2c"><b>canObjBufSetFilter()</b></a>中的过滤器是掩码和代码类型，这意味着你可以设置缓冲以响应一系列CAN标识。更多信息，<span style="text-decoration: underline;"><a href="http://www.kvaser.cn/canlib-webhelp/page_user_guide_misc_code_and_mask.html" target="_blank">请查看此帮助文档</a></span>。</p>
<h4>示例代码：</h4>
<p>此代码段设置一个响应CAN ID100的缓冲，其带有ID为200的报文。</p>

		</div>
	</div>
<pre class="code-toolbar1 code-wrapper line-numbers"><code class="language-csharp"> /* Set up an auto response buffer */


byte[] msg = { 1, 2, 3, 4, 5, 6 }; //define message
int autoBufIndex = (int)(canObjBufAllocate(handle, canOBJBUF_TYPE_AUTO_RESPONSE)); //Allocate buffer
int status;
status = canObjBufWrite(handle, autoBufIndex, 200, msg, 0, 0); //Write to buffer
status=  canObjBufSetFilter(handle, autoBufIndex, 100, 0xFFFF); //Only match message with id 100, match on all bits.        
status = canlibCLSNET.Canlib.canObjBufEnable(handle, autoBufIndex); //activate the buffer
            </code></pre>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			
		</div>
	</div>

	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<h3>情况2：自动传送</h3>
<p>再次，要使用对象缓冲，首先从调用<a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#gacfd23956af809dfc6db822c2f5ba25e7"><b>canObjBufAllocate()</b></a>函数分配一个缓冲。</p>
<p>对于自动传送缓冲，调用<a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#ga9285a2316c11bc17ec2a98ab64812ce5"><b>canObjBufSetPeriod()</b></a>函数来设置报文的频率，调用<a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#gaab0389f48769a91f540d2b97e8fd031b"><b>canObjBufSetMsgCount()</b></a>函数来设置从缓冲发送的报文数，并调用<a href="http://www.kvaser.cn/canlib-webhelp/group___object_buffers.html#ga9b0e3dffd54e5abdd6972dd468353022"><b>canObjBufWrite()</b></a>函数定义报文的内容。</p>
<h4>示例代码：</h4>
<p>该代码段设置一个自动发送缓冲，发送ID为300的报文，间隔为1ms。</p>

		</div>
	</div>
<pre class="code-toolbar1 code-wrapper line-numbers"><code class="language-csharp">/* Set up an auto transmit buffer */

byte[] msg = { 1, 2, 3, 4, 5, 6 }; //define message
int autoBufIndex = (int)(canObjBufAllocate(handle, canOBJBUF_TYPE_AUTO_TRANSMIT)); //Allocate buffer
int status;
status = canObjBufWrite(handle, autoBufIndex, 300, msg, 0, 0); //Write to buffer
status = canObjBufSetPeriod(handle, autoBufIndex, 1000); //Set period to 1000 microseconds
status = canlibCLSNET.Canlib.canObjBufEnable(handle, autoBufIndex); //activate the buffer
            </code></pre>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			
		</div>
	</div>

	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<h1>哪些分析仪有对象缓冲功能？</h1>
<p>我们的Professional专业系列产品里有硬件对象缓冲功能，通常有8个缓冲区可用。</p>
<p><span style="text-decoration: underline;"><a href="http://www.kvaser.cn/products-services/our-products/#?filter=Professional">搜索Professional专业系列产品 &gt;&gt;</a></span></p>

		</div>
	</div>

	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<h3>如果您有任何意见，请发送邮件至support@kvaser.com和我们取得联系。</h3>

		</div>
	</div>
</div></div></div></div>
</div><p>The post <a href="https://www.kvaser.cn/developer-blog/using-object-buffers/">使用对象缓冲</a> appeared first on <a href="https://www.kvaser.cn">Kvaser</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
