晶振:12M TEMPER_L EQU 36H TEMPER_H EQU 35H TEMPER_NUM EQU 60H FLAG1 bit 00H DQ bit P3.3AAA:MOV SP,#70H LCALL GET_TEMPER LCALL TEMPER_COV LJMP AAA NOP ;------------------讀出轉(zhuǎn)換后的溫度值 GET_TEMPER: SETB DQ ; 定時入口 BCD:LCALL INIT_1820 JB FLAG1,S22 LJMP BCD ; 若DS18B20不存在則返回S22:LCALL DELAY1 MOV A,#0CCH ; 跳過ROM匹配------0CC LCALL WRITE_1820 MOV A,#44H ; 發(fā)出溫度轉(zhuǎn)換命令 LCALL WRITE_1820 NOP LCALL DELAY LCALL DELAY CBA:LCALL INIT_1820 JB FLAG1,ABC LJMP CBA ABC:LCALL DELAY1 MOV A,#0CCH ; 跳過ROM匹配 LCALL WRITE_1820 MOV A,#0BEH ; 發(fā)出讀溫度命令 LCALL WRITE_1820 LCALL READ_18200 ;READ_1820 RET ;------------------讀DS18B20的程序,從DS18B20中讀出一個字節(jié)的數(shù)據(jù) READ_1820: MOV R2,#8 RE1: CLR C
上傳時間: 2013-10-09
上傳用戶:heart_2007
16 16點陣顯示漢字原理及顯示程序 #include "config.h" #define DOTLED_LINE_PORT PORTB #define DOTLED_LINE_DDR DDRB #define DOTLED_LINE_PIN PINB #define DOTLED_LINE_SCKT PB1 #define DOTLED_LINE_SCKH PB5 #define DOTLED_LINE_SDA PB3 #define DOTLED_ROW_PORT PORTC #define DOTLED_ROW_DDR DDRC #define DOTLED_ROW_PIN PINC #define DOTLED_ROW_A0 PC0 #define DOTLED_ROW_A1 PC1 #define DOTLED_ROW_A2 PC2 #define DOTLED_ROW_A3 PC3 #define DOTLED_ROW_E PC4 uint8 font[] = { /*-- 調(diào)入了一幅圖像:這是您新建的圖像 --*/ /*-- 寬度x高度=16x16 --*/ 0x00,0x00,0x00,0x00,0x08,0x38,0x18,0x44,0x08,0x44,0x08,0x04,0x08,0x08,0x08,0x10, 0x08,0x20,0x08,0x40,0x08,0x40,0x08,0x40,0x3E,0x7C,0x00,0x00,0x00,0x00,0x00,0x00 }; static void TransmitByte(uint8 byte); static void SelectRow(uint8 row); static void FlipLatchLine(void); static void TransmitByte(uint8 byte) { uint8 i; for(i = 0 ; i < 8 ; i ++) { if(byte & (1 << i)) { DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SDA); } else { DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SDA); } //__delay_cycles(100); DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SCKH); //__delay_cycles(100); DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SCKH); //__delay_cycles(100); } } static void SelectRow(uint8 row) { //row -= 1; row |= DOTLED_ROW_PIN & 0xe0; DOTLED_ROW_PORT = row; } static void FlipLatchLine(void) { DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SCKT); DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SCKT); } void InitDotLedPort(void) { DOTLED_LINE_PORT &= ~(_BV(DOTLED_LINE_SCKT) | _BV(DOTLED_LINE_SCKH)); DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SDA); DOTLED_LINE_DDR |= _BV(DOTLED_LINE_SCKT) | _BV(DOTLED_LINE_SCKH) | _BV(DOTLED_LINE_SDA); DOTLED_ROW_PORT |= 0x1f; DOTLED_ROW_PORT &= 0xf0; DOTLED_ROW_DDR |= 0x1f; } void EnableRow(boolean IsEnable) { if(IsEnable) { DOTLED_ROW_PORT &= ~_BV(DOTLED_ROW_E); } else { DOTLED_ROW_PORT |= _BV(DOTLED_ROW_E); } } void PrintDotLed(uint8 * buffer) { uint8 i , tmp; for(i = 0 ; i < 16 ; i ++) { tmp = *buffer ++; TransmitByte(~tmp); tmp = *buffer ++; TransmitByte(~tmp); SelectRow(i); FlipLatchLine(); } } void main(void) { InitDotLedPort(); EnableRow(TRUE); while(1) { PrintDotLed(font); __delay_cycles(5000); } } //---------------------------------------------------- config.h文件 #ifndef _CONFIG_H #define _CONFIG_H //#define GCCAVR #define CPU_CYCLES 7372800L #ifndef GCCAVR #define _BV(bit) (1 << (bit)) #endif #define MSB 0x80 #define LSB 0x01 #define FALSE 0 #define TRUE 1 typedef unsigned char uint8; typedef unsigned int uint16; typedef unsigned long uint32; typedef unsigned char boolean; #include <ioavr.h> #include <inavr.h> #include "dotled.h" #endif //-----
上傳時間: 2013-11-18
上傳用戶:mnacyf
USB2.0 攝像頭微處理器支持高速USB2.0 接口,內(nèi)嵌強勁的圖像后處理單元,JPEG 高速編譯碼器,支持高達(dá)200 萬像素的CMOS 傳感器接口和CCD 傳感器接口,處理器設(shè)計的產(chǎn)品可以實現(xiàn)獨特的運動監(jiān)測功能與臉部追蹤功能,這不僅大大加強了顯示效果,提高了畫面的品質(zhì),更拓展了PC 攝像頭的應(yīng)用領(lǐng)域,如增強的實時視頻聊天功能和門禁監(jiān)測系統(tǒng)。關(guān)鍵詞:USB2.0,微控制器,硬件設(shè)計1.引言USB2.0 攝像頭微處理器支持高速USB2.0 接口,內(nèi)嵌強勁的圖像后處理單元,JPEG 高速編譯碼器,支持高達(dá)200 萬像素的CMOS 傳感器接口和CCD 傳感器接口,處理器設(shè)計的產(chǎn)品可以實現(xiàn)獨特的運動監(jiān)測功能與臉部追蹤功能,這不僅大大加強了顯示效果,提高了畫面的品質(zhì),更拓展了PC 攝像頭的應(yīng)用領(lǐng)域,如增強的實時視頻聊天功能和門禁監(jiān)測系統(tǒng)。主要功能:USB2.0 高速傳輸并兼容USB1.1;高速圖像后處理單元;JPEG 高速編譯碼器;VGA 下30 幀/秒高速傳輸;CMOS/CCD 接口;內(nèi)置8 比特微控制器。不儀具備以上的先進(jìn)特性,還擁有以下多種可擴(kuò)展性:多個GPIO 接口為增加連拍、LED 指示燈、快捷鍵等功能提供了無限可能;USB2.0 兼容USB1.1,為攝像頭的廣泛的使用增加了保障;支持多種操作系統(tǒng),如64-bit Window,Windows XP,Linux,Mac,VxWorks,WinCE等等。以下就是對USB2.0 攝像頭微處理器的硬件設(shè)計方法及外圍電路分布的介紹。2.系統(tǒng)硬件設(shè)計2.1 振蕩器USB2.0 攝像頭微處理器的鐘頻是12MHz,外部時鐘頻率穩(wěn)定性必須小于±50ppm。圖1 是振蕩器電路的設(shè)計參考圖。
標(biāo)簽: USB 攝像頭 微處理器 硬件設(shè)計
上傳時間: 2014-01-16
上傳用戶:dumplin9
PLC TM卡開發(fā)系統(tǒng)匯編程序(ATM8051) ;***************** 定義管腳*************************SCL bit P1.0SDA bit P1.1GC bit P1.2BZ bit P3.6LEDI bit P1.4LEDII bit P1.5OK bit 20H.1OUT1 bit P1.3OUT2 bit P1.0OUT3 bit P1.1RXD bit P3.0TXD bit P3.1PCV bit P3.2WPC bit P3.3RPC bit P3.5LEDR bit P3.4LEDL bit P3.6TM bit P3.7;********************定義寄存器***********************ROMDTA EQU 30H;NUMBY EQU 61H;SLA EQU 60H;MTD EQU 2FH;MRD EQU 40H;TEMP EQU 50H;;ORG 00H;;INDEX:MOV P1, #00H;MOV P2, #0FFHMOV MTD ,#00HCALL REEMOV R0,40HCJNE R0,#01,NO;MOV P2,#1CHLJMP VIMEN MOV P2,#79HACALL TOUCHRESET ;JNC NO ;CALL READTM ;CJNE A,#01H,NO;NOPMOV MTD, #00HCALL WEENOPMOV P2,#4AHSETB BZCALL TIMECLR BZMOV PCON, #0FFHVIME:CALL TIME1CALL TOUCHRESETJNC VIMECALL READTMCJNE A, #01H,VIME;NOPNOPNOPIII: MOV MTD,#00HCALL REECALL BBJNB OK,NO1LJMP ZHUNO1:MOV MTD,#10H
上傳時間: 2014-03-24
上傳用戶:448949
用單片機(jī)配置FPGA—PLD設(shè)計技巧 Configuration/Program Method for Altera Device Configure the FLEX Device You can use any Micro-Controller to configure the FLEX device–the main idea is clocking in ONE bitof configuration data per CLOCK–start from the bit 0The total Configuration time–e.g. 10K10 need 15K byte configuration file•calculation equation–10K10* 1.5= 15Kbyte–configuration time for the file itself•15*1024*8*clock = 122,880Clock•assume the CLOCK is 4MHz•122,880*1/4Mhz=30.72msec
標(biāo)簽: FPGA PLD 用單片機(jī) 設(shè)計技巧
上傳時間: 2013-10-09
上傳用戶:a67818601
1 /**————————————————————2 〖說明〗I2C總線驅(qū)動程序(用兩個普通IO模擬I2C總線)3 包括100Khz(T=10us)的標(biāo)準(zhǔn)模式(慢速模式)選擇,4 和400Khz(T=2.5us)的快速模式選擇,5 默認(rèn)11.0592Mhz的晶振。6 〖文件〗PCF8563T.C ﹫2001/11/2 77 〖作者〗龍嘯九天 c51@yeah.net http://www.c51bbs.co /8 〖修改〗修改建議請到論壇公布 http://www.c51bbs.co m9 〖版本〗V1.00A Build 080310 —————————————————————*/1112 #ifndef SDA13 #define SDA P0_014 #define SCL P0_115 #endif1617 extern uchar SystemError;1819 #define uchar unsigned char20 #define uint unsigned int21 #define Byte unsigned char22 #define Word unsigned int23 #define bool bit24 #define true 125 #define false 02627 #define SomeNOP(); _nop_();_nop_();_nop_();_nop_();2829 /**--------------------------------------------------------------------------------30 調(diào)用方式:void I2CStart(void) ﹫2001/07/0 431 函數(shù)說明:私有函數(shù),I2C專用32 ---------------------------------------------------------------------------------*/33 void I2CStart(void)34 {35 EA=0;36 SDA=1; SCL=1; SomeNOP();//INI37 SDA=0; SomeNOP(); //START38 SCL=0;39 }4041 /**--------------------------------------------------------------------------------42 調(diào)用方式:void I2CStop(void) ﹫2001/07/0 443 函數(shù)說明:私有函數(shù),I2C專用44 ---------------------------------------------------------------------------------*/45 void I2CStop(void)46 {47 SCL=0; SDA=0; SomeNOP(); //INI48 SCL=1; SomeNOP(); SDA=1; //STOP49 EA=1;50 }5152 /**--------------------------------------------------------------------------------53 調(diào)用方式:bit I2CAck(void) ﹫2001/07/0 454 函數(shù)說明:私有函數(shù),I2C專用,等待從器件接收方的應(yīng)答55 ---------------------------------------------------------------------------------*/56 bool WaitAck(void)57 {58 uchar errtime=255;//因故障接收方無ACK,超時值為255。59 SDA=1;SomeNOP();60 SCL=1;SomeNOP();61 while(SDA) {errtime--; if (!errtime) {I2CStop();SystemError=0x11;return false;}}62 SCL=0;63 return true;
上傳時間: 2014-04-11
上傳用戶:xg262122
The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8Kbytes of Flash programmable and erasable read only memory (PEROM). The deviceis manufactured using Atmel’s high-density nonvolatile memory technology and iscompatible with the industry-standard 80C51 and 80C52 instruction set and pinout.The on-chip Flash allows the program memory to be reprogrammed in-system or by aconventional nonvolatile memory programmer. By combining a versatile 8-bit CPUwith Flash on a monolithic chip, the Atmel AT89C52 is a powerful microcomputerwhich provides a highly-flexible and cost-effective solution to many embedded controlapplications.
上傳時間: 2013-11-10
上傳用戶:1427796291
自動檢測80C51 串行通訊中的波特率本文介紹一種在80C51 串行通訊應(yīng)用中自動檢測波特率的方法。按照經(jīng)驗,程序起動后所接收到的第1 個字符用于測量波特率。這種方法可以不用設(shè)定難于記憶的開關(guān),還可以免去在有關(guān)應(yīng)用中使用多種不同波特率的煩惱。人們可以設(shè)想:一種可靠地實現(xiàn)自動波特檢測的方法是可能的,它無須嚴(yán)格限制可被確認(rèn)的字符。問題是:在各種的條件下,如何可以在大量允許出現(xiàn)的字符中找出波特率的定時間隔。顯然,最快捷的方法是檢測一個單獨位時間(single bit time),以確定接收波特率應(yīng)該是多少。可是,在RS-232 模式下,許多ASCII 字符并不能測量出一個單獨位時間。對于大多數(shù)字符來說,只要波特率存在合理波動(這里的波特率是指標(biāo)準(zhǔn)波特率),從起始位到最后一位“可見”位的數(shù)據(jù)傳輸周期就會在一定范圍內(nèi)發(fā)生變化。此外,許多系統(tǒng)采用8 位數(shù)據(jù)、無奇偶校驗的格式傳輸ASCII 字符。在這種格式里,普通ASCII 字節(jié)不會有MSB 設(shè)定
標(biāo)簽: 80C51 自動檢測 單片機(jī) 串行通訊
上傳時間: 2013-10-15
上傳用戶:shirleyYim
介紹ISE13.1 iMPACT 下載bit文件 和mcs文件的詳細(xì)步驟
上傳時間: 2013-10-22
上傳用戶:88mao
Express Mode uses an 8-bit wide bus path for fast configuration of Xilinx FPGAs. Thisapplication note provides information on how to perform Express configuration specifically forthe Spartan™-XL family. The Express mode signals and their associated timing are defined.The steps of Express configuration are described in detail, followed by detailed instructions thatshow how to implement the configuration circui
標(biāo)簽: Spartan-XL Express XAPP FPGA
上傳時間: 2014-12-28
上傳用戶:hewenzhi
蟲蟲下載站版權(quán)所有 京ICP備2021023401號-1