?? 3839.htm
字號:
<!-- set statbox vars ---> <html><head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'><title>運(yùn)用LabView控制DS3900串口通信模塊 - Maxim</title><meta name="keywords" content="DS3900, LabView, I2C, 串口"><meta name="description" content="LabView is popular as a graphical programming platform for developing embedded applications. The DS3900 is a general purpose interface board used for communicating with devices equipped with the I2C interface using the PCs serial port. The DS3900 has"><link rel=stylesheet href="/newstyles.css" type="text/css"></head><body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0"><!-- ================================================================== --><!-- BEGIN: SITE HEADER --><!-- ================================================================== --><!-- BEGIN: LEFT WING --><table border=0 cellspacing=0 cellpadding=0 width=100% height=100%><tr valign="top"><td bgcolor=#F4F4F4><img width="1" height="3" src="http://www.maxim-ic.com.cn/maxkit/dots/clear_dot.gif"><br><table border=0 cellspacing=0 cellpadding=0 align="center" width=600><tr><td bgcolor=#C8C8C8><table border=0 cellspacing=1 cellpadding=0><tr><td bgcolor="white"><!-- END: LEFT WING --><!-- BEGIN: META CONTROL --><table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor=#7386A5><tr valign="top"> <!-- METASITE CONTROL --> <td align="left"> <nobr> </nobr> </td> <td> </td> <td align="right"> <!-- LANG_SWITCH: keep this include all on one line by itself --> <nobr> <a class="header_nav" href="http://www.maxim-ic.com/appnotes.cfm?an_pk=3839">ENGLISH</a><font color="#D0D0D0">•</font><a class="header_nav" href="http://www.maxim-ic.com.cn/appnotes.cfm?an_pk=3839">简体中文</a><font color="#D0D0D0">•</font><a class="header_nav" href="http://japan.maxim-ic.com/appnotes.cfm?an_pk=3839">日本語</a><font color="#D0D0D0">•</font><a class="header_nav" href="http://korea.maxim-ic.com/appnotes.cfm?an_pk=3839">한국어</a> </nobr> </td></tr><tr valign="top"> <td colspan=3> <img width="100%" height="1" src="http://www.maxim-ic.com.cn/maxkit/dots/white_dot.gif"><br> </td></tr></table><!-- END: META CONTROL --><!-- BEGIN: SITE CONTROL --><table class="nav_bg" border="0" cellpadding="0" cellspacing="0" width="100%"><tr valign="top" bgcolor="#FFFFFF"> <td valign="top"> <!-- OPENING SPACER --> <img width="1" height="12" src="http://www.maxim-ic.com.cn/maxkit/dots/clear_dot.gif"><br> <!-- SITE CONTROL GUTS --> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <!-- LOGO CELL --> <td> <a href="http://www.maxim-ic.com.cn/"><img border="0" width="276" height="27" src="http://www.maxim-ic.com.cn/maxkit/images/max_logo_header_25yrs.gif"></a></td> <!-- SPACER CELL --> <td><a name="top"></a> </td> <!-- SEARCH FORMS CELL --> <td align="right"> <table border="0" cellpadding="1" cellspacing="0"> <tr> <td> </td> <!-- SITE SEARCH FORM --> <form name="power_search" method="get" action="http://www.maxim-ic.com.cn/pst/run.mvp"> <input type="hidden" name="lang" value="cn"> <td><input class="page_header" type="text" name="query" size="22" maxlength="255" value=""></td> <td> </td> <td><input type="image" src="/maxkit/images/home/cn/search_site_btn.gif" value="submit" border="0" name="image" width="44" height="17"></td> </form> <td> </td> <!-- PART SEARCH FORM --> <form name="part_search" method="post" action="http://www.maxim-ic.com.cn/quick_view2.cfm?go=part_number_search"> <td><input class="page_header" type="text" size="8" name="part_number"></td> <td> </td> <td><input type="image" src="/maxkit/images/home/cn/search_part_btn.gif" value="submit" border="0" name="image" width="44" height="17"></td> </form> <td> </td> </tr> </table> </td> <td> <!-- LOGIN_STATUS --></td> </tr> </table> <!-- CLOSING SPACER --> <img width="1" height="8" src="http://www.maxim-ic.com.cn/maxkit/dots/clear_dot.gif"><br> </td></tr></table><!-- END: SITE CONTROL --><!-- BEGIN: MAIN NAVBAR --><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr valign="top"> <td class="nav_bg"> <table border="0" cellpadding="0" cellspacing="1" width="100%"> <tr align="center"> <td class="header_nav_cell" width="11%"><nobr><a class="header_nav" href="http://www.maxim-ic.com.cn/whatsnew/">最新内容</a></nobr></td> <td class="header_nav_cell" width="11%"><nobr><a class="header_nav" href="http://www.maxim-ic.com.cn/products.cfm">产品</a></nobr></td> <td class="header_nav_cell" width="11%"><nobr><a class="header_nav" href="http://www.maxim-ic.com.cn/solutions/">方案</a></nobr></td> <td class="header_nav_cell" width="11%"><nobr><a class="header_nav" href="http://www.maxim-ic.com.cn/design/">设计</a></nobr></td> <td class="header_nav_cell" width="11%"><nobr><a class="header_nav" href="http://www.maxim-ic.com.cn/appnotes10.cfm/filter/category">应用</a></nobr></td> <td class="header_nav_cell" width="11%"><nobr><a class="header_nav" href="https://support.maxim-ic.com/cn/">技术支持</a></nobr></td> <td class="header_nav_cell" width="11%"><nobr><a class="header_nav" href="http://www.maxim-ic.com.cn/sales/">销售联络</a></nobr></td> <td class="header_nav_cell" width="11%"><nobr><a class="header_nav" href="http://www.maxim-ic.com.cn/company/">公司简介</a></nobr></td> </tr> </table> </td></tr></table><!-- END: MAIN NAVBAR --><!-- BEGIN: TENT POLE --><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr class=nav_bg valign="top"> <td><img width="670" height="3" src="http://www.maxim-ic.com.cn/maxkit/dots/clear_dot.gif"></td></tr></table><!-- END: TENT POLE --><!-- ================================================================== --><!-- END: SITE HEADER --><!-- ================================================================== --><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr valign="top"><td class="nav_bg"><img src="http://www.maxim-ic.com.cn/images/clear.gif" width="32" height="300"></td><td><img src="http://www.maxim-ic.com.cn/images/clear.gif" width="16" height="1"></td><td width="99%"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td><img src="http://www.maxim-ic.com.cn/images/clear.gif" width="1" height="6"></td></tr> <tr><td><!-- BEGIN: INFO HEADER --><table border=0 cellpadding=2 cellspacing=0 width="100%"><tr valign="top" bgcolor=#f0f0f0><td class="breadcrumbs" rowspan=2><table border=0 cellpadding=1 cellspacing=0><tr><td class="breadcrumbs">
<a href="/">Maxim</a> >
<a href="/design">設(shè)計(jì)資料庫</a> >
<a href="/appnotes10.cfm">應(yīng)用筆記</a>
> <a href="/appnotes10.cfm/ac_pk/2">A/D和D/A轉(zhuǎn)換器/采樣電路</a> <a href="/appnotes10.cfm/ac_pk/9">數(shù)字電位器</a> <a href="/appnotes10.cfm/ac_pk/34">電壓基準(zhǔn)</a> <a href="/appnotes10.cfm/ac_pk/41">通用技術(shù)專題</a></td></tr><tr><td class="breadcrumbs"> 關(guān)鍵詞: <font color="#666666">DS3900, LabView, I2C, 串口</font></td></tr> <tr><td class="breadcrumbs"> <a href="#rp">相關(guān)型號</a> </td></tr></table></td><td class="breadcrumbs" align="right" nowrap> APP 3839: Nov 09, 2006 </td></tr><tr bgcolor=#f0f0f0><td class="breadcrumbs" align="right" valign=bottom nowrap> <a href="http://www.maxim-ic.com.cn/pdfserv/en/an/AN3839.pdf"> <img align=absMiddle border=0 src="http://www.maxim-ic.com.cn/images/acrobat-icon.gif" ALT="下載,PDF格式">下載,PDF格式</a> (154kB)<br> <script type="text/javascript"> var new_window; function bookmarkPage(url) { new_window=window.open(url,'','height=550,width=600,left=400,top=100,scrollbars=1,resizable=1'); if (window.focus) {new_window.focus()} }</script> <table border=0 cellpadding=0 cellspacing=0><tr><td><a href="javascript:bookmarkPage('/bookmark/index.cfm?link='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+' ');"><img src="http://www.maxim-ic.com.cn/bookmark/images/bookmark.gif" border="0" hspace=2 vspace=6></a> </td><td><a href="javascript:bookmarkPage('/bookmark/help.cfm');">[?]</a></td></tr></table></td></tr></table><!-- END: INFO HEADER --></td></tr><tr><td><img src="http://www.maxim-ic.com.cn/images/clear.gif" width="1" height="10"></td></tr><tr><td> <img src="#mediaserver#/images/clear.gif" width="1" height="10"><br clear=all><table cellpadding=0 cellspacing=0><tr><td style="color:#a5a5a5;font-weight:bold;">應(yīng)用筆記3839</td></tr><tr><td><h1>運(yùn)用LabView控制DS3900串口通信模塊</h1></td></tr></table><p><table border="0" cellpadding="0" cellspacing="0"><tr><td> <i>摘要:本篇應(yīng)用筆記討論了DS3900串口通信模塊和LabView的使用問題,LabView是適用于嵌入式應(yīng)用的圖形化界面開發(fā)平臺。本文可作為面向DS3900的LabView界面用戶指南。</i> <br><br clear=all> <h2>介紹</h2>
LabView作為嵌入式應(yīng)用的圖形化界面開發(fā)平臺得到了廣泛應(yīng)用。<a href=/ds3900>DS3900</a>串口通信模塊是一款通用接口板,借助該接口板,用戶可使用PC串口與具有I<sup>2</sup>C接口的器件通信。DS3900的指令集允許應(yīng)用軟件與I<sup>2</sup>C器件直接通信。<p>
本應(yīng)用筆記是面向DS3900的LabView界面的用戶指南。首先,用戶需要安裝LabView。為用戶提供了標(biāo)準(zhǔn)VI,以加載并運(yùn)行程序。可以<a href=ftp://ftp.dalsemi.com/pub/system_extension/AppNotes/AN3839/DS3900LV.zip>下載</a>與本應(yīng)用筆記相關(guān)的LabView代碼(ZIP,321K)。<p>
<h2>使用LabView軟件</h2>
加載VI后,用戶必須運(yùn)行該程序并按照以下步驟操作。(見<b>圖1</b>)<p>
<img src=http://www.maxim-ic.com.cn/images/appnotes/3839/3839Fig01.jpg alt="Figure 1. LabView screen from which the user configures a system for operation."><br>
<i>圖1. LabView界面,用戶通過該界面配置系統(tǒng),以準(zhǔn)備工作</i><p>
<ol>
<li>用戶首先要選擇DS3900所連接的串口。LabView自動搜索所有的可用串口資源,并在下拉列表中顯示這些串口。選擇DS3900所連接的串口。<p>
<b>注意:</b>與DS3900通信的缺省波特率為57600。本應(yīng)用已在該波特率下進(jìn)行了測試,可正常工作。建議用戶在使用本應(yīng)用時(shí)不要改變這個(gè)波特率。
<li>正確設(shè)置串口后,即可正常使用LED開/關(guān)功能。如果終端應(yīng)用將LED連接到DS3900的脈沖輸出端口(P3引腳),則按下LED開/關(guān)按鈕時(shí)LED會閃爍。
<li>下一步,通過點(diǎn)擊<b>FIND I2C ADDRESS</b>按鈕,找到連接到I<sup>2</sup>C總線上的所有器件地址。在<b>Set I2C Address</b>輸入框內(nèi)鍵入將要與VI通信的從器件地址。
<li>通過窗口頂端的標(biāo)簽選擇用戶要使用的功能。提供多種功能選項(xiàng):
<ol>
<li>1BYTE:讀或?qū)懸粋€(gè)寄存器,每次1個(gè)字節(jié)。
<li>2BYTE:讀或?qū)憙蓚€(gè)連續(xù)存儲器地址。我們假定以下情況:在每次讀或?qū)懖僮魍瓿珊螅O(shè)備的內(nèi)部地址計(jì)數(shù)器自動遞增。
<li>Manual (手動):用戶通過它可以控制I<sup>2</sup>C總線如何操作。下面的<b>手動控制</b>一節(jié)給出了一些例子。
</ol>
</ol><p>
<h2>單字節(jié)讀/寫操作</h2>
<img src=http://www.maxim-ic.com.cn/images/appnotes/3839/3839Fig02.jpg alt="Figure 2. When performing a single-byte operation, the user selects among four addresses for communicating with the I2C device."><br>
<i>圖2. 進(jìn)行單字節(jié)讀/寫操作時(shí),用戶可選擇四個(gè)地址以便和I<sup>2</sup>C器件進(jìn)行通信。</i><p>
用戶可以選擇四個(gè)不同地址以進(jìn)行通信(<b>圖2</b>)。任何<b>READ DATA</b>結(jié)果都會被復(fù)制到相應(yīng)的<b>WRITE DATA</b>輸入框內(nèi),以便于處理各數(shù)據(jù)位。<p>
<b>雙字節(jié)讀/寫操作</b><p>
<img src=http://www.maxim-ic.com.cn/images/appnotes/3839/3839Fig03.jpg alt="Figure 3. The 2BYTE tab lets the user read data from two registers."><br>
<i>圖3. 2BYTE標(biāo)簽允許用戶讀取兩個(gè)寄存器的數(shù)據(jù)。</i><p>
對于某些特定設(shè)備,一個(gè)寄存器可能包括存儲器中的兩個(gè)連續(xù)字節(jié)。如果設(shè)備的存儲器地址指針可自動遞增以指向下一個(gè)寄存器,則<b>2BYTE</b>標(biāo)簽(<b>圖3</b>)允許用戶讀取兩個(gè)連續(xù)寄存器。讀出的數(shù)據(jù)會被自動復(fù)制到<b>WRITE DATA TO</b>輸入框內(nèi)。<p>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -