//芯片資料請到www.elecfans.com查找 //DS1820 C51 子程序//這里以11.0592M晶體為例,不同的晶體速度可能需要調整延時的時間//sbit DQ =P2^1;//根據實際情況定義端口 typedef unsigned char byte;typedef unsigned int word; //延時void delay(word useconds){ for(;useconds>0;useconds--);} //復位byte ow_reset(void){ byte presence; DQ = 0; //pull DQ line low delay(29); // leave it low for 480us DQ = 1; // allow line to return high delay(3); // wait for presence presence = DQ; // get presence signal delay(25); // wait for end of timeslot return(presence); // presence signal returned} // 0=presence, 1 = no part //從 1-wire 總線上讀取一個字節byte read_byte(void){ byte i; byte value = 0; for (i=8;i>0;i--) { value>>=1; DQ = 0; // pull DQ low to start timeslot DQ = 1; // then return high delay(1); //for (i=0; i<3; i++); if(DQ)value|=0x80; delay(6); // wait for rest of timeslot } return(value);} //向 1-WIRE 總線上寫一個字節void write_byte(char val){ byte i; for (i=8; i>0; i--) // writes byte, one bit at a time { DQ = 0; // pull DQ low to start timeslot DQ = val&0x01; delay(5); // hold value for remainder of timeslot DQ = 1; val=val/2; } delay(5);} //讀取溫度char Read_Temperature(void){ union{ byte c[2]; int x; }temp; ow_reset(); write_byte(0xCC); // Skip ROM write_byte(0xBE); // Read Scratch Pad temp.c[1]=read_byte(); temp.c[0]=read_byte(); ow_reset(); write_byte(0xCC); //Skip ROM write_byte(0x44); // Start Conversion return temp.x/2;}
上傳時間: 2013-11-03
上傳用戶:hongmo
1、程序的基本格式先介紹二條偽指令:EQU ——標號賦值偽指令ORG ——地址定義偽指令PIC16C5X在RESET后指令計算器PC被置為全“1”,所以PIC16C5X幾種型號芯片的復位地址為:PIC16C54/55:1FFHPIC16C56:3FFHPIC16C57/58:7FFH一般來說,PIC的源程序并沒有要求統一的格式,大家可以根據自己的風格來編寫。但這里我們推薦一種清晰明了的格式TITLE This is ⋯⋯ ;程序標題;--------------------------------------;名稱定義和變量定義;--------------------------------------F0 EQU 0RTCC EQU 1PC EQU 2STATUS EQU 3FSR EQU 4RA EQU 5RB EQU 6RC EQU 7┋PIC16C54 EQU 1FFH ;芯片復位地址PIC16C56 EQU 3FFHPIC16C57 EQU 7FFH;-----------------------------------------ORG PIC16C54 GOTO MAIN ;在復位地址處轉入主程序ORG 0 ;在0000H開始存放程序;-----------------------------------------;子程序區;-----------------------------------------DELAY MOVLW 255┋RETLW 0;------------------------------------------;主程序區;------------------------------------------MAINMOVLW B‘00000000’TRIS RB ;RB已由偽指令定義為6,即B口┋LOOPBSF RB,7 CALL DELAYBCF RB,7 CALL DELAY┋GOTO LOOP;-------------------------------------------END ;程序結束注:MAIN標號一定要處在0頁面內。2、程序設計基礎
上傳時間: 2013-11-14
上傳用戶:cjf0304
§4-1 程序設計語言計算機程序設計語言是指計算機能夠理解和執行的語言。 程序設計語言的種類很多,歸納起來有三種: 機器語言、匯編語言和高級語言。 編程時采用哪種語言由程序設計語言的特點和適用場合決定。 機器語言、匯編語言和高級語言比較一覽表§4-2 匯編語言源程序格式匯編語言源程序格式如下:1、匯編語言源程序由一條一條匯編語句組成。2、每條匯編語句獨占一行,以CR—LF結束。3、典型的匯編語句由四部分組成: 標號:操作碼 操作數;注釋§4-3 偽指令一、偽指令與指令的區別: 偽指令由匯編程序識別,用來對匯編過程進行某種控制,或者對符號、標號賦值。在匯編過程中, 偽指令不產生可執行的目標代碼;而指令由CPU執行,在匯編過程中,產生可執行的目標代碼,完成對數據的運算與處理。二、常用的偽指令:ORG END EQU DATA DB DW DS §4-4 匯編語言程序設計基礎一、匯編語言程序設計的一般步驟 分析課題 確定算法 畫流程圖 編寫程序 上機調試二、程序結構 按程序的走向可以將程序分成4種結構: 簡單程序 分支程序 循環程序 子程序
上傳時間: 2013-10-15
上傳用戶:daoxiang126
4位八段數碼管的十進制加計數仿真實驗,程序采用匯編語言編寫。此程序在仿真軟件上與EDN-51實驗板上均通過。仿真圖中的數碼管位驅動采用74HC04,如按EDN-51板上用想同的PNP三極管驅動在仿真軟件上則無法正常顯示。程序共分5塊,STAR0為數據初始化,STAR2為計數子程序,STAR3為4位數碼管動態顯示子程序,STAR4為按鍵掃描子程序,STS00是延時子程序。由于EDN-51實驗板上沒裝BCD譯碼器,所以編寫程序比較煩瑣。 程序如下: ORG 0000H LJMP STAR0 ;轉程序 SRAR0ORG 0200H ;程序地址 0200HSTAR0: CLR 00 ;位 00 清 0 MOV P1,#0FFH ;#0FFH-->P1 MOV P2,#0FH ;#0FH-->P2 MOV P0,#0FFH ;#0FFH-->P0 MOV 30H,#00H ;#00H-->30H MOV 31H,#00H ;#00H-->30H MOV 32H,#00H ;#00H-->30H MOV 33H,#00H ;#00H-->30H LJMP STAR3 ;轉程序 SRAR3STAR2: MOV A,#0AH ;#0AH-->A INC 30H ;30H+1 CJNE A,30H,STJE ;30H 與 A 比較,不等轉移 STJE MOV 30H,#00H ;#00H-->30H INC 31H ;31H+1 CJNE A,31H,STJE ;31H 與 A 比較,不等轉移 STJE MOV 31H,#00H ;#00H-->31H INC 32H ;32H+1 CJNE A,32H,STJE ;32H 與 A 比較,不等轉移 STJE MOV 32H,#00H ;#00H-->32H INC 33H ;33H+1 CJNE A,33H,STJE ;33H 與 A 比較,不等轉移 STJE MOV 33H,#00H ;#00H-->33H MOV 32H,#00H ;#00H-->32H MOV 31H,#00H ;#00H-->31H MOV 30H,#00H ;#00H-->30HSTJE: RET ;子程序調用返回STAR3: MOV R0,#30H ;#30H-->R0 MOV R6,#0F7H ;#0F7H-->R6SMG0: MOV P1,#0FFH ;#0FFH-->P1 MOV A,R6 ;R6-->A MOV P1,A ;A-->P1 RR A ;A向右移一位 MOV R6,A ;A-->R6 MOV A,@R0 ;@R0-->A ADD A,#04H ;#04H-->A MOVC A,@A+PC ;A+PC--> MOV P0,A ;A-->P0 AJMP SMG1 ;轉程序 SMG1SDATA: DB 0C0H,0F9H,0A4H,0B0H,99H DB 92H,82H,0F8H,80H,90H SMG1: LCALL STAR4 ;轉子程序 SRAR4 LCALL STS00 ;轉子程序 STS00 INC R0 ;R0+1 CJNE R6,#07FH,SMG0 ;#07FH 與 R6 比較,不等轉移 SMG0 AJMP STAR3 ;轉程序 SRAR3STAR4: JNB P2.0,ST1 ;P2.0=0 轉 ST1 CLR 00 ;位 00 清 0 SJMP ST3 ;轉ST3ST1: JNB 00,ST2 ;位 00=0 轉 ST2 SJMP ST3 ;轉 ST3ST2: LCALL STAR2 ;調子程序 STAR2 SETB 00 ;位 00 置 1ST3: RET ;子程序調用返回ORG 0100H ;地址 0100HSTS00: MOV 60H,#003H ;#003H-->60H (211)DE001: MOV 61H,#0FFH ;#0FFH-->61H (255)DE002: DJNZ 61H,DE002 ;61H 減 1 不等于 0 轉 DE002 DJNZ 60H,DE001 ;60H 減 1 不等于 0 轉 DE001 RET ;子程序調用返回 END ;結束 上次的程序共有293句,經小組成員建議,本人經幾天的研究寫了下面的這個程序,現在的程序用了63句,精簡了230句。功能沒有減。如誰有更簡練的程序,請發上來,大家一起學習。 4位八段數碼管的十進制加計數仿真實驗(含電路圖和仿真文件)
上傳時間: 2013-10-11
上傳用戶:sssl
The PL2303 USB to Serial adapter is your smart and convenient accessory forconnecting RS-232 serial devices to your USB-equipped Windows host computer. Itprovides a bridge connection with a standard DB 9-pin male serial port connector inone end and a standard Type-A USB plug connector on the other end. You simplyattach the serial device onto the serial port of the cable and plug the USB connectorinto your PC USB port. It allows a simple and easy way of adding serial connectionsto your PC without having to go thru inserting a serial card and traditional portconfiguration.This USB to Serial adapter is ideal for connecting modems, cellular phones, PDAs,digital cameras, card readers and other serial devices to your computer. It providesserial connections up to 1Mbps of data transfer rate. And since USB does not requireany IRQ resource, more devices can be attached to the system without the previoushassles of device and resource conflicts.Finally, the PL-2303 USB to Serial adapter is a fully USB Specification compliantdevice and therefore supports advanced power management such as suspend andresume operations as well as remote wakeup. The PL-2303 USB Serial cable adapteris designed to work on all Windows operating systems.
上傳時間: 2013-11-01
上傳用戶:ghostparker
51匯編程序實例:舉一例說明:流水燈加數碼管 LOOP: ; 標號CLR P2.6 ;選中p2.6 數碼管左邊的8字使能SETB P2.7 ;p2.7不使能。 右邊的數碼管消隱MOV P0,#28H ;把28h送p0口;數碼管顯示 0LCALL DELAY ;延時MOV P0,#0FFH ;0ffh 送p0口,數碼管清除CLR P1.0 ;點亮p1.0發光管MOV P0,#7EH ;把7eh送p0口;數碼管顯示 1LCALL DELAYMOV P0,#0FFHCLR P1.1 ;點亮p1.0發光管CLR P1.0 ;點亮p1.0發光管MOV P0,#0A2H ;數碼管顯示 2LCALL DELAYMOV P0,#0FFHCLR P1.2CLR P1.1CLR P1.0MOV P0,#62H ;數碼管顯示 3LCALL DELAYMOV P0,#0FFHCLR P1.3CLR P1.2CLR P1.1CLR P1.0MOV P0,#74H ;數碼管顯示 4LCALL DELAYMOV P0,#0FFHCLR P1.4CLR P1.3CLR P1.2CLR P1.1CLR P1.0MOV P0,#61H ;數碼管顯示 5;LCALL DELAYMOV P0,#0FFHCLR P1.5CLR P1.4CLR P1.3CLR P1.2CLR P1.1CLR P1.0MOV P0,#21H ; 數碼管顯示 6LCALL DELAYMOV P0,#0FFHCLR P1.6CLR P1.5CLR P1.4CLR P1.3CLR P1.2CLR P1.1CLR P1.0MOV P0,#7AH ; 數碼管顯示 7LCALL DELAYMOV P0,#0FFHCLR P1.7CLR P1.6CLR P1.5CLR P1.4CLR P1.3CLR P1.2CLR P1.1CLR P1.0MOV P0,#20H ; 數碼管顯示 8LCALL DELAYMOV P0,#0FFHLCALL DELAYMOV P0,#0FFHMOV P1,#0FFH;程序到此結果為左邊的數碼管顯示0,1,2,3,4,5,6,7,8;p1.0------------p1.7指示燈依次點亮SETB P2.6 ; 左邊的8消隱CLR P2.7 ;選中p2.7 數碼管右邊的8字使能 ,;MOV P0,#28HLCALL DELAYMOV P0,#0FFHMOV P1,#0FFHCLR P1.0MOV P0,#7EHLCALL DELAYMOV P0,#0FFHMOV P1,#0FFHCLR P1.1MOV P0,#0A2HLCALL DELAYMOV P0,#0FFHMOV P1,#0FFHCLR P1.2MOV P0,#62HLCALL DELAYMOV P0,#0FFHMOV P1,#0FFHCLR P1.3MOV P0,#74HLCALL DELAYMOV P0,#0FFHMOV P1,#0FFHCLR P1.4MOV P0,#61HLCALL DELAYMOV P0,#0FFHMOV P1,#0FFHCLR P1.5MOV P0,#21HLCALL DELAYMOV P0,#0FFHMOV P1,#0FFHCLR P1.6MOV P0,#7AHLCALL DELAYMOV P0,#0FFHMOV P1,#0FFHCLR P1.7MOV P0,#20HLCALL DELAYMOV P0,#0FFHMOV P1,#0FFHMOV P0,#0FFHMOV P1,#0FFH;這一段和上一段基本相同, 不同的是右邊的數碼管依次顯示012345678,左邊的不亮;;同時p1口的燈流動顯示:AJMP LOOP; 注意: 程序運行到此跳轉到開始標號,重復執行:DELAY: ;延時子程序;參考前面的教程:CLR P3.3 ;注意小喇叭在3.3口, 這里可以使小喇叭發出嗒,嗒聲MOV R7,#255NOPNOPD1:MOV R6,#255setb p3.3D2: DJNZ R6,D2clr p3.3DJNZ R7,D1SETB P3.3RETENDLOOP: ; 標號CLR P2.6 ;選中p2.6 數碼管左邊的8字使能SETB P2.7 ;p2.7不使能。 右邊的數碼管消隱MOV P0,#28H ;把28h送p0口;數碼管顯示 0 ;28為1010000LCALL DELAY ; 延時程序MOV P0,#0FFH ;0ffh 送p0口,數碼管清除;P0口為11111111CLR P1.0 ;點亮p1.0發光管; P1。0為電平,P0口為11111110MOV P0,#7EH ;把7eh送p0口;數碼管顯示 1; P1。0為低電平,P0口為11111110LCALL DELAY ; 延時程序MOV P0,#0FFHMOV P0,#0FFH ;0ffh 送p0口,數碼管清除;P0口為11111111 清一次顯示這條是清顯示的
上傳時間: 2013-10-31
上傳用戶:gundamwzc
cm119電路圖
上傳時間: 2013-11-01
上傳用戶:skhlm
This application note describes how to retrieve user-defined data from Xilinx configurationPROMs (XC18V00 and Platform Flash devices) after the same PROM has configured theFPGA. The method to add user-defined data to the configuration PROM file is also discussed.The reference design described in this application note can be used in any of the followingXilinx FPGA architectures: Spartan™-II, Spartan-IIE, Spartan-3, Virtex™, Virtex-E, Virtex-II,and Virtex-II Pro.
上傳時間: 2013-11-11
上傳用戶:zhouli
This application note provides a detailed description of the Spartan™-3 configurationarchitecture. It explains the composition of the bitstream file and how this bitstream isinterpreted by the configuration logic to program the part. Additionally, a methodology ispresented that will guide the user through the readback process. This information can be usedfor partial reconfiguration or partial readback.
上傳時間: 2013-11-05
上傳用戶:透明的心情
Xilinx is disclosing this user guide, manual, release note, and/or specification (the "Documentation") to you solely for use in the developmentof designs to operate with Xilinx hardware devices. You may not reproduce, distribute, republish, download, display, post, or transmit theDocumentation in any form or by any means including, but not limited to, electronic, mechanical, photocopying, recording, or otherwise,without the prior written consent of Xilinx. Xilinx expressly disclaims any liability arising out of your use of the Documentation. Xilinx reservesthe right, at its sole discretion, to change the Documentation without notice at any time. Xilinx assumes no obligation to correct any errorscontained in the Documentation, or to advise you of any corrections or updates. Xilinx expressly disclaims any liability in connection withtechnical support or assistance that may be provided to you in connection with the Information.
上傳時間: 2014-01-13
上傳用戶:竺羽翎2222