#include <reg51.h>#include<intrins.h> #define BUSY1 (DQ1==0) sbit DQ1 = P0^4; unsigned char idata TMP; unsigned char idata TMP_d; unsigned char f; void wr_ds18_1(char dat);unsigned char rd_ds18_1(); /***************延時程序,單位us,大于10us*************/void time_delay(unsigned char time){ time=time-10; time=time/6; while(time!=0)time--;} /*****************************************************//* reset ds18b20 *//*****************************************************/void ds_reset_1(void){ unsigned char idata count=0; DQ1=0; time_delay(240); time_delay(240); DQ1=1; return;}
上傳時間: 2013-10-29
上傳用戶:sssnaxie
基于USB接口的數據采集模塊的設計與實現Design and Implementation of USB-Based Data Acquisition Module路 永 伸(天津科技大學電子信息與自動化學院,天津300222)摘要文中給出基于USB接口的數據采集模塊的設計與實現。硬件設計采用以Adpc831與PDIUSBDI2為主的器件進行硬件設計,采用Windriver開發USB驅動,并用Visual C十十6.0對主機軟件中硬件接口操作部分進行動態鏈接庫封裝。關鍵詞USB 數據采集Adpc831 PDNSBDI2 Windriver動態鏈接庫Abstract T hed esigna ndim plementaitono fU SB-BasedD ataA cquisiitonM oduleis g iven.Th ec hips oluitonm ainlyw ithA dpc831a ndP DTUSBD12i sused for hardware design. The USB drive is developed場Wmdriver, and the operation on the hardware interface is packaged into Dynamic Link Libraries場Visual C++6.0. Keywords USB DataA cquisition Adttc831 PDfUSBD12 Windriver0 引言US B總 線 是新一代接口總線,最初推出的目的是為了統一取代PC機的各類外設接口,迄今經歷了1.0,1.1與2.0版本3個標準。在國內基于USB總線的相關設計與開發也得到了快速的發展,很多設計者從各自的應用領域,用不同方案設計出了相應的裝置[1,2]。數據采集是工業控制中一個普遍而重要的環節,因此開發基于USB接口的數據采集模塊具有很強的現實應用意義。雖然 US B總線標準已經發展到2.0版本,但由于工業控制現場干擾信號的情況比較復雜,高速數據傳輸的可靠性不容易被保證,并且很多場合對數據采集的實時性要求并不高,開發2.0標準產品的成本又較1.1標準產品高,所以筆者認為,在工業控制領域,目前開發基于USB總線1.1標準實現的數據采集模塊的實用意義大于相應2.0標準模塊。
上傳時間: 2013-10-23
上傳用戶:q3290766
摘 要 瞬態仿真領域的許多工作需要獲得可視化數據, 仿真電路不能將輸出參數繪制成圖形時研究工作將受到很大影響. 而權威電路仿真軟件PSpice 在這個方面不盡如人意. 本文提出了一種有效的解決辦法: 通過MATLAB 編程搭建一個PSpice 與MATLAB 的數據接口,使PSpice輸出數據文件可以導入到MATLAB中繪制圖形. 這令我們能夠很方便地獲得數據的規律以有效地分析仿真結果, 這項技術對于教學和工程實踐都有比較實際的幫助.關鍵詞: 瞬態仿真 仿真程序 PSpice MATLAB 可視化數據The Data Transfer from Pspice to MATLABWu hao Ning yuanzhong Liang yingAbstract Many works in the area of transient simulation has shown how a emulator such asPSpice can be interfaced to an control analysis package such as MATLAB to get viewdata. Thepaper describes how such interfaces can be made using the MATLAB programming. The platformas a typical platform will solve the problem that PSpice software sometimes can not draw the datato a picture. It can make us find the rule from numerous data very expediently, so we can analyzethe outcome of the simulation. And it also can be used in the field of education.Keywords Transient Simulation Emulator PSpice MATLAB Viewdata1 引言科學研究和工程應用常需要進行電路仿真 PSpice可進行直流 交流 瞬態等基本電路特性分析 也可進行蒙托卡諾 MC 統計分析 最壞情況 Wcase 分析 優化設計等復雜電路特性分析 它是國際上仿真電路的權威軟件 而MATLAB的主要特點有 高效方便的矩陣和數組運算 編程效率高 結構化面向對象 方便的繪圖功能 用戶使用方便 工具箱功能強大 兩者各有著重點 兩種軟件結合應用 對研究工作有很重要的意義香港理工大學Y. S. LEE 等人首先將PSpice和MATLAB結合 開發了電力電子電路優化用的CAD 程序MATSPICE[6] 將兩者相結合的關鍵在于 如何用MATLAB 獲取PSpice的仿真數據 對此參考文獻 6 里沒有詳細敘述 本文著重說明用MATLAB 讀取PSpice仿真數據的具體方法本論文利用MATLAB對PSpice仿真出的數據處理繪制出后者無法得到或是效果不好的仿真圖形 下面就兩者結合使用的例子 進行具體說明
上傳時間: 2013-10-20
上傳用戶:wuchunzhong
USB接口控制器參考設計,xilinx提供VHDL代碼 usb xilinx vhdl ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
上傳時間: 2013-10-12
上傳用戶:windgate
In today’s world of modular networking and telecommunications design, it is becomingincreasingly difficult to keep alignment with the many different and often changing interfaces,both inter-board and intra-board. Each manufacturer has their own spin on the way in whichdevices are connected. To satisfy the needs of our customers, we must be able to support alltheir interface requirements. For us to be able to make products for many customers, we mustadopt a modular approach to the design. This modularity is the one issue that drives the majorproblem of shifting our bits from one modular interface to another.
上傳時間: 2013-11-25
上傳用戶:suicone
Abstract: The number of uses for microelectromechanical systems (MEMS) is growing—they allow us todo jobs once considered impossible. This tutorial explains the applications for MEMS and the increasingneed to provide precision control and drivers for these devices. Design and manufacturing considerationsare also discussed.
上傳時間: 2013-11-12
上傳用戶:paladin
3變壓器在電力系統中的主要作用是什么? 答:變壓器在電力系統中的作用是變換電壓,以利于功率的傳輸。電壓經升壓變壓器升壓后,可以減少線路損耗,提高送電的經濟性,達到遠距離送電的目的。而降壓變壓器則能把高電壓變為用戶所需要的各級使用電壓,滿足用戶需要。 4套管裂紋有什么危害性? 答:套管出現裂紋會使絕緣強度降低,能造成絕緣的進一步損壞,直至全部擊穿。裂縫中的水結冰時也可能將套管脹裂。可見套管裂紋對變壓器的安全運行是很有威脅的。 5高壓斷路器有什么作用? 答:高壓斷路器不僅可以切斷和接通正常情況下高壓電路中的空載電流和負荷電流,還可以在系統發生故障時與保護裝置及自動裝置相配合,迅速世斷故障電源,防止事故擴大,保證系統的安全運行。
上傳時間: 2013-11-07
上傳用戶:wayne595
This book evolved over the past ten years from a set of lecture notes developed while teaching the undergraduate Algorithms course at Berkeley and U.C. San Diego. Our way of teaching this course evolved tremendously over these years in a number of directions, partly to address our students' background (undeveloped formal skills outside of programming), and partly to reect the maturing of the eld in general, as we have come to see it. The notes increasingly crystallized into a narrative, and we progressively structured the course to emphasize the ?story line? implicit in the progression of the material. As a result, the topics were carefully selected and clustered. No attempt was made to be encyclopedic, and this freed us to include topics traditionally de-emphasized or omitted from most Algorithms books.
標簽: Algorithms 算法
上傳時間: 2013-11-11
上傳用戶:JamesB
注:1.這篇文章斷斷續續寫了很久,畫圖技術也不精,難免錯漏,大家湊合看.有問題可以留言. 2.論壇排版把我的代碼縮進全弄沒了,大家將代碼粘貼到arduino編譯器,然后按ctrl+T重新格式化代碼格式即可看的舒服. 一、什么是PWM PWM 即Pulse Wavelength Modulation 脈寬調制波,通過調整輸出信號占空比,從而達到改 變輸出平均電壓的目的。相信Arduino 的PWM 大家都不陌生,在Arduino Duemilanove 2009 中,有6 個8 位精度PWM 引腳,分別是3, 5, 6, 9, 10, 11 腳。我們可以使用analogWrite()控 制PWM 腳輸出頻率大概在500Hz 的左右的PWM 調制波。分辨率8 位即2 的8 次方等于 256 級精度。但是有時候我們會覺得6 個PWM 引腳不夠用。比如我們做一個10 路燈調光, 就需要有10 個PWM 腳。Arduino Duemilanove 2009 有13 個數字輸出腳,如果它們都可以 PWM 的話,就能滿足條件了。于是本文介紹用軟件模擬PWM。 二、Arduino 軟件模擬PWM Arduino PWM 調壓原理:PWM 有好幾種方法。而Arduino 因為電源和實現難度限制,一般 使用周期恒定,占空比變化的單極性PWM。 通過調整一個周期里面輸出腳高/低電平的時間比(即是占空比)去獲得給一個用電器不同 的平均功率。 如圖所示,假設PWM 波形周期1ms(即1kHz),分辨率1000 級。那么需要一個信號時間 精度1ms/1000=1us 的信號源,即1MHz。所以說,PWM 的實現難點在于需要使用很高頻的 信號源,才能獲得快速與高精度。下面先由一個簡單的PWM 程序開始: const int PWMPin = 13; int bright = 0; void setup() { pinMode(PWMPin, OUTPUT); } void loop() { if((bright++) == 255) bright = 0; for(int i = 0; i < 255; i++) { if(i < bright) { digitalWrite(PWMPin, HIGH); delayMicroseconds(30); } else { digitalWrite(PWMPin, LOW); delayMicroseconds(30); } } } 這是一個軟件PWM 控制Arduino D13 引腳的例子。只需要一塊Arduino 即可測試此代碼。 程序解析:由for 循環可以看出,完成一個PWM 周期,共循環255 次。 假設bright=100 時候,在第0~100 次循環中,i 等于1 到99 均小于bright,于是輸出PWMPin 高電平; 然后第100 到255 次循環里面,i 等于100~255 大于bright,于是輸出PWMPin 低電平。無 論輸出高低電平都保持30us。 那么說,如果bright=100 的話,就有100 次循環是高電平,155 次循環是低電平。 如果忽略指令執行時間的話,這次的PWM 波形占空比為100/255,如果調整bright 的值, 就能改變接在D13 的LED 的亮度。 這里設置了每次for 循環之后,將bright 加一,并且當bright 加到255 時歸0。所以,我們 看到的最終效果就是LED 慢慢變亮,到頂之后然后突然暗回去重新變亮。 這是最基本的PWM 方法,也應該是大家想的比較多的想法。 然后介紹一個簡單一點的。思維風格完全不同。不過對于驅動一個LED 來說,效果與上面 的程序一樣。 const int PWMPin = 13; int bright = 0; void setup() { pinMode(PWMPin, OUTPUT); } void loop() { digitalWrite(PWMPin, HIGH); delayMicroseconds(bright*30); digitalWrite(PWMPin, LOW); delayMicroseconds((255 - bright)*30); if((bright++) == 255) bright = 0; } 可以看出,這段代碼少了一個For 循環。它先輸出一個高電平,然后維持(bright*30)us。然 后輸出一個低電平,維持時間((255-bright)*30)us。這樣兩次高低就能完成一個PWM 周期。 分辨率也是255。 三、多引腳PWM Arduino 本身已有PWM 引腳并且運行起來不占CPU 時間,所以軟件模擬一個引腳的PWM 完全沒有實用意義。我們軟件模擬的價值在于:他能將任意的數字IO 口變成PWM 引腳。 當一片Arduino 要同時控制多個PWM,并且沒有其他重任務的時候,就要用軟件PWM 了。 多引腳PWM 有一種下面的方式: int brights[14] = {0}; //定義14個引腳的初始亮度,可以隨意設置 int StartPWMPin = 0, EndPWMPin = 13; //設置D0~D13為PWM 引腳 int PWMResolution = 255; //設置PWM 占空比分辨率 void setup() { //定義所有IO 端輸出 for(int i = StartPWMPin; i <= EndPWMPin; i++) { pinMode(i, OUTPUT); //隨便定義個初始亮度,便于觀察 brights[ i ] = random(0, 255); } } void loop() { //這for 循環是為14盞燈做漸亮的。每次Arduino loop()循環, //brights 自增一次。直到brights=255時候,將brights 置零重新計數。 for(int i = StartPWMPin; i <= EndPWMPin; i++) { if((brights[i]++) == PWMResolution) brights[i] = 0; } for(int i = 0; i <= PWMResolution; i++) //i 是計數一個PWM 周期 { for(int j = StartPWMPin; j <= EndPWMPin; j++) //每個PWM 周期均遍歷所有引腳 { if(i < brights[j])\ 所以我們要更改PWM 周期的話,我們將精度(代碼里面的變量:PWMResolution)降低就行,比如一般調整LED 亮度的話,我們用64 級精度就行。這樣速度就是2x32x64=4ms。就不會閃了。
上傳時間: 2013-10-08
上傳用戶:dingdingcandy
This document was developed under the Standard Hardware and Reliability Program (SHARP) TechnologyIndependent Representation of Electronic Products (TIREP) project. It is intended for use by VHSIC HardwareDescription Language (VHDL) design engineers and is offered as guidance for the development of VHDL modelswhich are compliant with the VHDL Data Item Description (DID DI-EGDS-80811) and which can be providedto manufacturing engineering personnel for the development of production data and the subsequent productionof hardware. Most VHDL modeling performed to date has been concentrated at either the component level orat the conceptual system level. The assembly and sub-assembly levels have been largely disregarded. Under theSHARP TIREP project, an attempt has been made to help close this gap. The TIREP models are based upon lowcomplexity Standard Electronic Modules (SEM) of the format A configuration. Although these modules are quitesimple, it is felt that the lessons learned offer guidance which can readily be applied to a wide range of assemblytypes and complexities.
上傳時間: 2013-11-20
上傳用戶:pzw421125