#include<reg51.h> //包含單片機寄存器的頭文件 /******************************************************* 函數功能:主函數 (C 語言規定必須有也只能有1 個主函數) ********************************************************/ void main(void) { while(1) //無限循環 { P1=0xff; // P1=1111 1111B,熄滅LED P0=P1; // 將 P1 口狀態送入P0 口 P2=P1; // 將 P1 口狀態送入P2 口 P3=P1; // 將 P1 口狀態送入P3 口
上傳時間: 2013-10-26
上傳用戶:離殤
單片機c語言學習和單片機制作資料: 函數的使用和熟悉 實例3:用單片機控制第一個燈亮 實例4:用單片機控制一個燈閃爍:認識單片機的工作頻率 實例5:將 P1口狀態分別送入P0、P2、P3口:認識I/O口的引腳功能 實例6:使用P3口流水點亮8位LED 實例7:通過對P3口地址的操作流水點亮8位LED 實例8:用不同數據類型控制燈閃爍時間 實例9:用P0口、P1 口分別顯示加法和減法運算結果 實例10:用P0、P1口顯示乘法運算結果 實例11:用P1、P0口顯示除法運算結果 實例12:用自增運算控制P0口8位LED流水花樣 實例13:用P0口顯示邏輯"與"運算結果 實例14:用P0口顯示條件運算結果 實例15:用P0口顯示按位"異或"運算結果 實例16:用P0顯示左移運算結果 實例17:"萬能邏輯電路"實驗 實例18:用右移運算流水點亮P1口8位LED 實例19:用if語句控制P0口8位LED的流水方向 實例20:用swtich語句的控制P0口8位LED的點亮狀態 實例21:用for語句控制蜂鳴器鳴笛次數 實例22:用while語句控制LED 實例23:用do-while語句控制P0口8位LED流水點亮 實例24:用字符型數組控制P0口8位LED流水點亮 實例25: 用P0口顯示字符串常量 實例26:用P0 口顯示指針運算結果 實例27:用指針數組控制P0口8位LED流水點亮 實例28:用數組的指針控制P0 口8 位LED流水點亮 實例29:用P0 、P1口顯示整型函數返回值 實例30:用有參函數控制P0口8位LED流水速度 實例31:用數組作函數參數控制流水花樣 實例32:用指針作函數參數控制P0口8位LED流水點亮 實例33:用函數型指針控制P1口燈花樣 實例34:用指針數組作為函數的參數顯示多個字符串
上傳時間: 2013-10-21
上傳用戶:llandlu
只用電腦上的并口(打印機接口)不需任何外圍元件燒錄M8芯片的方法!! 只需要連接4根數據和1根地線一共5條線,無需任何電阻電容。 前提您的電腦上要有并口(打印機接口)。 并口與M8的鏈接,我這里用說明和圖片示意兩種方式給大家描述 。 先鏈接并口25針里面的12腳和2腳。 25腳是地,接在M8的8腳或者22腳。如果是在線下載可以連接PCB上任意一點接地點。 10腳是MISO,接在M8的18腳(GandF的設計中大部分也在三線按鍵的接口里) 9腳是RES,接在M8的第1腳 7腳是MOSI, 接在M8的17腳(GandF的設計中大部分也在三線按鍵的接口里) 6腳是SCK,接在M8的19腳(GandF的設計中大部分也在三線按鍵的接口里)
上傳時間: 2013-10-29
上傳用戶:gai928943
本內容介紹了IO模擬串口通訊的實現方法及實例分析
上傳時間: 2013-11-11
上傳用戶:jiwy
現有基于MAX7219芯片的數碼管驅動電路只適用于小尺寸LED,為擴展其使用范圍,在介紹動態顯示芯片MAX7219功能的基礎上,提出了一個基于該芯片的8位高亮度8英寸數碼管驅動電路。電路保留了MAX7219芯片的功能強大、編程簡單等優點,通過74LS273鎖存器和ULN2803達林頓驅動器,實現了對任意大尺寸數碼管提供較高電壓和電流驅動的靜態顯示,并亮度可調。 Abstract: The existing display-driving circuit based on MAX7219 was only applicable to small-size LED. To expand its use, based on the function introduction of dynamic display chip MAX7219, a display-driving circuit for high-brightness 8-bit LED with the size of 8-inch was proposed. The advantages of MAX7219 were retained, such as powerful function and simple programming. Static display with adjustable brightness for large-size LED with higher voltage and current was achieved with the help of 74LS273 and ULN2803.
上傳時間: 2013-10-23
上傳用戶:31633073
為解決當前計算機串行通訊接口只有USB,難以滿足舊型號設備或某些單片機要求RS232通訊的問題,設計出兩款RS232/USB電路。采用CH341A與MAX223集成電路芯片構建標準9線RS232/USB通用接口轉換器,無需編程。采用CH341A與PIC16F877A構建單片機與計算機之間的USB通訊電路,軟件遵循RS232通訊協議,硬件進行電平轉換。實際使用表明,這兩款產品與計算機端Windows 操作系統下的串口應用程序完全兼容,且通訊過程中無握手失敗現象。 Abstract: To solve the problem that current computer serial communication only with USB interface can not satisfy with the old type equipments or MCU to communicate with RS232, two kinds of RS232/USB circuit were designed.CH341A and MAX223 integrated circuit chips were used to create a standard 9-line RS232/USB universal interface convertor without programme. CH341A and PIC16F877A chips were adopted to build the USB communication circuit between computers and MCU. The software follows RS232 communication protocol, and the hardware converts electrical levels. Actual practices indicate that the two manufactures are compatible with serial application program of Windows operation system completely,and get avoid of handshake lost.
上傳時間: 2013-11-03
上傳用戶:siying
P0端口由鎖存器、輸入緩沖器、切換開關、一個與非門、一個與門及場效應管驅動電路構成。再看圖的右邊,標號 為P0.X引腳的圖標,也就是說P0.X引腳可以是P0.0到P0.7的任何一位,即在P0口有8個與上圖相同的電路組成。
上傳時間: 2014-01-13
上傳用戶:fandeshun
提出了一種可根據環境光強、紅外和溫度變化而實現自動開關、調節亮度的LED照明系統的設計方案。采用單片機C8051F020為系統控制核心,設計了由硅光電池和集成運放組成的光強傳感器,選用熱釋電模塊作為紅外無線感應器,采用DS18B20為溫度傳感器,還利用液晶實現了工作信息顯示。實驗結果表明,系統在光強大于2 170 lx或溫度高于82.5 ℃時能自動關斷,當光強小于1 040 lx或溫度低于49.3 ℃時能自動開啟;當光強在1 000~2 000 lx變化時,LED亮度能自動調節,以維持環境照度基本穩定。
上傳時間: 2013-10-10
上傳用戶:xaijhqx
單片機作為一種微型計算機,其內部具有一定的存儲單元(8031除外),但由于其內部存儲單元及端口有限,很多情況下難以滿足實際需求。為此介紹一種新的擴展方法,將數據線與地址線合并使用,通過軟件控制的方法實現數據線與地址線功能的分時轉換,數據線不僅用于傳送數據信號,還可作為地址線、控制線,用于傳送地址信號和控制信號,從而實現單片機與存儲器件的有效連接。以單片機片外256KB數據存儲空間的擴展為例,通過該擴展方法,僅用10個I/O端口便可實現,與傳統的擴展方法相比,可節約8個I/O端口。 Abstract: As a micro-computer,the SCM internal memory has a certain units(except8031),but because of its internal storage units and the ports are limited,in many cases it can not meet the actual demand.So we introduced a new extension method,the data line and address lines combined through software-controlled approach to realize the time-conversion functions of data lines and address lines,so the data lines not only transmited data signals,but also served as address lines and control lines to transmit address signals and control signals,in order to achieve an effective connection of microcontroller and memory chips.Take microcontroller chip with256KB of data storage space expansion as example,through this extension method,with only10I/O ports it was achieved,compared with the traditional extension methods,this method saves8I/O ports.
上傳時間: 2014-12-26
上傳用戶:adada
詳細介紹工控軟件組態王與單片機多機串口通訊的設計原理。分析組態王提供的直接與單片機串口通信方法的優點,給出系統基于RS-485總線傳輸的接口電路原理圖。根據組態王提供的通訊協議和單片機多機串口通訊的原理,給出程序設計流程與思路。 Abstract: In this paper,the design principle of communication between multi-SCM and KingView by serial ports is described in detail.We analysis the advantage of method supplied by KingView,by which KingView can communicate with serial ports of SCM directly,and provide the system’s interface circuit based on the RS-485transmission line.We provide flow diagram of programming and thinking on the basis of communication protocol supplied by KingView and principle of communication among multi-SCM through serial ports.
上傳時間: 2013-12-19
上傳用戶:tecman