【正文】
the highend, in the lowend microcontroller applications, the two have their own living space, at least in the short term there will be one to replace another kind of situation.計算機工程有以下幾部分組成:中央處理單元(CPU運行,控制)和隨機存取存儲器RAM(數(shù)據(jù)存儲),只讀存儲器(ROM),輸入/輸出設(shè)備I/O(串行和并行輸出端口等)。在供應(yīng)鏈管理中,這些都是一塊集成電路芯片的一部分,所以稱為單片機(單片機),和一些除了以上部分,還結(jié)合其他部位如模擬/數(shù)字轉(zhuǎn)換(A/D)和模擬/數(shù)字轉(zhuǎn)換(A/D)等。 MCU functionIn the actual work where the puter is not any need for a high performance puter, a puter can control the refrigerator temperature for core processor? The key is to see whether enough, whether there is a good cost performance ratio. If a refrigerator are needed to deal with core temperature control, the price is the price. MCU control, monly used in industrial production and life related procedures and controls (such as: electronic organ, refrigerators, air conditioners and other intelligence).在計算機不需要任何高性能計算機的實際工作中,計算機可以控制為核心處理器的冰箱的溫度?關(guān)鍵是看是否足夠,是否有良好的性能價格比。單片機控制,常用于工業(yè)生產(chǎn)和生活有關(guān)的程序和控制(如:電子琴,冰箱,空調(diào)和其他情報)。圖11 Atmega328PPU單片機2 Arduino的基本組成 Arduino定義Arduino,是一個開放源代碼的計算機控制器,基于開放源代碼軟件的硬件和軟件平臺,基于開放源代碼的簡單接口的I / O版本,并有一個類似的Java,C語言的開發(fā)環(huán)境,處理/接線。兩天后。電路板被命名為Arduino。保持開源理念的設(shè)計,因為著作權(quán)法律監(jiān)督是開源軟件,但它是很難使用的硬件,他們決定采用創(chuàng)作共用許可證。你不需要支付使用費,甚至不允許獲得Arduino團隊。它是作為商標注冊。 關(guān)鍵字 if for while break return 。 {} /* */ 運算符 + * % = amp。 ! = /= 數(shù)據(jù)類型 char 字符類型 int 整數(shù)類型 long 長整型 float 實數(shù)類型 string void 常 量 以上為基礎(chǔ)C語言的關(guān)鍵字和符號,大家可以了解,具體使用可以結(jié)合實驗的程序。 void setup() 初始化發(fā)量,管腳模式,調(diào)用庫函數(shù)等 pinMode(pin, mode) 數(shù)字IO口輸入輸出模式定義函數(shù),pin表示為0~13,mode表示為INPUT或OUTPUT。 digitalWrite(pin, value) 數(shù)字IO口辒出電平定義函數(shù),pin表示為0~13,value表示為HIGH或LOW。比如可以讀數(shù)字傳感器。比如,可以讀模擬傳感器(10位AD,0~5V表示為0~1023)。 analogWrite(pin, value)PWM 數(shù)字IO口PWM輸出函數(shù),Arduino數(shù)字IO口標注了PWM的IO口可使用該函數(shù)。比如,可用于電機PWM調(diào)速或音樂播放。 delay(ms) 延時函數(shù)(單位ms)。 delayMicroseconds(us) 延時函數(shù)(單位 us)。 min(x,y) 求最小值 abs(x) 計算絕對值 sqrt(x) 開根號3 本次設(shè)計所需的硬件與軟件實驗器件數(shù)量Arduino uno1塊EthernetW5100擴展板1塊土壤濕度傳感器1個DHT11溫濕度傳感器1個導(dǎo)線若干表31 Arduino UNOArduino Uno是Arduino接口USB系列的最新版本,如Arduino平臺參考標準模板。聯(lián)合國已經(jīng)發(fā)布了第三版,與前兩版相比具有以下新的特點:In the AREF two pin SDA and SCL increase, increase IOREF and support the I2C interface。這提高了復(fù)位電路的設(shè)計,USB接口芯片的atmega16u2代替atmega8u2。圖31 Arduino UNO Arduino uno基本概要l 處理器 ATmega328 l 工作電壓 5V l 輸入電壓(推薦) 712V l 輸入電壓(范圍) 620V l 數(shù)字IO腳 14 (其中6路作為PWM輸出) l 模擬輸入腳 6 l IO腳直流電流 40 mA l 50 mA l Flash Memory 32 KB (ATmega328, KB用于bo