MCSÉ-51 Programmer's Guide and Instruction Set The information presented in this chapter is collected from the MCSÉ-51 Architectural Overview and the HardwareDescription of the 8051, 8052 and 80C51 chapters of this book. The material has been selected and rearranged toform a quick and convenient reference for the programmers of the MCS-51. This guide pertains specifically to the8051, 8052 and 80C51.
上傳時間: 2013-11-13
上傳用戶:hj_18
基于AT89C2051的紅外遙控學習器源程序6 源程序 ORG 0000H AJMP MAIN ORG 0003H AJMP KEYPRESS ORG 000BH AJMP TIMEOUT ORG 001BH AJMP TIMEOUT SENDDUAN BIT P3.0 JIEDUAN BIT P3.1 INTRPO BIT P3.2 JIEXUAN BIT P3.3 SENDLIGHT BIT P3.4 JIELIGHT BIT P3.5 CS BIT P3.7 DATADUAN BIT P1.6 CLK BIT P1.7 JIANWEI EQU R5 JIANMA EQU R6 SHANGJIAN EQU 07H;R7 OPENKEY EQU 81H CLOSEKEY EQU 00H CHUT0 EQU 11H CHUT1 EQU 11H BUFBEGIN EQU 18H OPENT1 EQU 88H CLOSET1 EQU 00H OPENT0 EQU 82H CLOSET0 EQU 00H DATABEG1 EQU 0AAH DATABEG2 EQU 33H ORG 0030HMAIN: MOV IE,#80H MOV IP,#00H MOV P3,#0FFH CLR CS SETB P1.0 SETB P1.1 SETB P1.2 CLR P1.3 CLR P1.4 CLR P1.5 CLR P1.6 CLR P1.7 MOV R3,#80H MOV R0,00HCYCLE1: MOV @R0,#00H INC R0 DJNZ R3,CYCLE1 MOV PSW,#00H MOV SP,#07H MOV TMOD,#11H MOV TCON,#00H START: MOV SP,#07H SETB SENDDUAN CLR F0 SETB EXOWAITKEY: MOV C,F0 JNC WAITKEY CJNC JIANMA,#1BH,SEND LCALL LEARNP LJMP STARTSEND: LCALL SENDP LJMP START SENDP: SETB SENDDUAN CLR F0 MOV TMOD,#CHUT1
上傳時間: 2013-10-15
上傳用戶:lyy1234
//芯片資料請到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
T2作為波特率控制UART_RXD 是硬中斷0或1口,如果能進入中斷,說明該線有一個起始位產生,進入中斷后調用下面的接收程序。退出硬中斷之前還需要將硬中斷標志重新復位。UART_TXD 是任何其它IO即可。UART_SEND: PUSH IE PUSH DPH PUSH DPL PUSH PSW PUSH 00H PUSH ACC CLR EA SETB UART_TXD ;START BIT MOV R0,A CLR TR2 ;TR2置1,計數器2啟動,時間計數啟動。 MOV A,RCAP2L;計數器2重新裝載值 MOV TL2,A ;置計數器2初值 ;T2需要重新裝載 MOV A,DPH MOV A,RCAP2H MOV TH2,A MOV A,R0 SETB TR2 ;TR2置1,計數器 JNB TF2,$ CLR TF2 JNB TF2,$ CLR TF2
上傳時間: 2014-01-12
上傳用戶:二十八號
#include <at24c01a.h>/*************************************************向24C01A寫入一個字節輸入:E2ROM地址,字節數據******************************************************/void write24c01a(uchar uadd_1,uchar udata_1){sendbyte=0xa0;start();send(sendbyte);if (!ack())continue;send(uadd_1);if (!ack())continue;send(udata_1)if (!ack())continue;stop();}/**********************************發送開始*****************************************/void start(void){a_scl=1;a_sda=1;a_sda=0;a_scl=0;a_scl=1;}/********************************************發送停止*******************************************/void stop(void){a_scl=0;a_sda=0;a_scl=1;a_sda=1;} /*********************************************發送反饋************************************************/bit ack(void){int a_acka_scl=0;a_scl=0;a_scl=0;a_scl=1;a_ack=a_sda;a_scl=0;return(a_ack)}/**************************************發送無反饋********************************************/bit noack(void){int a_ack;a_scl=1;a_scl=1;a_scl=0;}/*******************************************發送****************************************************/void send(uchar undata){uchar i;sendbyte=undatafor(i=8;i>0;i--){a_sda=sendbyte7;a_scl=0;a_scl=1;sendbyte=sendbyte<<1}}/********************************************接受****************************************************/ void receive(void){int i;uchar data;for(i=8;i>0;i--){ a_scl=1;receivebyte7=a_sda;a_scl=0;receivebyte=receivebyte>>1}receivedata=receivebyte;}/********************************************向 24c01a讀一個字節;輸入:EEROM地址;輸出:EEROM數據;********************************************/void read24c01a(uchar counter){receivebyte=0xa1;start();send(receivebyte);if (!ack())continue;send(counter);if (!ack())continue;receive()noack();stop();}
上傳時間: 2013-12-23
上傳用戶:wxhwjf
紅外遙控接收;=================================================;; zsMCU51實驗板配套學習例程;; 中山單片機學習網 智佳科技;; 作者:逸風 QQ:105558851;; http://www.zsmcu.com; E-mail:info@zsmcu.com;=================================================ORG 0000HLJMP START;轉入主程序ORG 0010HSTART:MAIN:JNB P2.2,IRLJMP MAIN;以下為進入P3.2腳外部中斷子程序,也就是解碼程序IR:MOV R6,#9SB:ACALL DELAY882 ;調用882微秒延時子程序JB P2.2,EXIT ;延時882微秒后判斷P3.2腳是否出現高電平如果有就退出解碼程序DJNZ R6, SB ;重復10次,目的是檢測在8820微秒內如果出現高電平就退出解碼程序;以上完成對遙控信號的9000微秒的初始低電平信號的識別。JNB P2.2, $ ;等待高電平避開9毫秒低電平引導脈沖ACALL DELAY2400JNB P2.2,IR_Rp ;ACALL DELAY2400 ;延時4.74毫秒避開4.5毫秒的結果碼MOV R1,#1AH ;設定1AH為起始RAM區MOV R2,#4PP:MOV R3,#8JJJJ:JNB P2.2,$ ;等待地址碼第一位的高電平信號LCALL DELAY882 ;高電平開始后用882微秒的時間尺去判斷信號此時的高低電平狀態MOV C,P2.2 ;將P3.2引腳此時的電平狀態0或1存入C中 JNC UUU ;如果為0就跳轉到UUULCALL DELAY1000UUU:MOV A,@R1 ;將R1中地址的給ARRC A ;將C中的值0或1移入A中的最低位MOV @R1,A ;將A中的數暫時存放在R1中DJNZ R3,JJJJ ;接收地址碼的高8位INC R1 ;對R1中的值加1,換下一個RAMDJNZ R2,PP ;接收完16位地址碼和8位數據碼和8位數據,存放在1AH/1BH/1CH/1DH的RAM中MOV P1,1DH ;將按鍵的鍵值通過P1口的8個LED顯示出來!CLR P2.3 ;蜂鳴器鳴響-嘀嘀嘀-的聲音,表示解碼成功LCALL DELAY2400LCALL DELAY2400LCALL DELAY2400SETB P2.3;蜂鳴器停止LJMP MAINIR_Rp:LJMP MAINEXIT:LJMP MAIN ;退出解碼子程序;=============================882DELAY882: ;1.085x ((202x4)+5)=882MOV R7,#202DELAY882_A:NOPNOPDJNZ R7,DELAY882_ARET;=============================1000DELAY1000: ;1.085x ((229x4)+5)=999.285MOV R7,#229DELAY1000_A:NOPNOPDJNZ R7,DELAY1000_ARET;=============================2400
上傳時間: 2013-11-01
上傳用戶:2525775
系統start-up 定時器• 為了讓振蕩器能夠穩定起振所需要的延時時間。• 其時間為1024 個振蕩器振蕩周期。制程和溫度漂移• 因RC 振蕩器的頻率與內建振蕩電容值有關,而此電容值與制程參數有關,所以不同的MCU 會表現出不一致性。在固定電壓和溫度下,振蕩頻率漂移范圍約±25%。• 對于同一顆MCU(與制程漂移無關),其振蕩頻率會對工作電壓和工作溫度產生漂移。其對工作電壓和工作溫度所產生的漂移,可參考HOLTEK 網站上提供的相關資料。EMI/EMS(EMC)注意事項• ROSC 位置應盡量接近OSC1 引腳,其至OSC1 的連線應最短。• CS 可以提高振蕩器的抗干擾能力,其與MCU OSC1 和GND 的連線應最短。• RPU 在確定系統頻率之后,量產時建議不要接,因為其fSYS/4 頻率輸出會干擾到OSC1
上傳時間: 2014-01-20
上傳用戶:yyyyyyyyyy
用單片機配置FPGA—PLD設計技巧 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
上傳時間: 2013-10-09
上傳用戶:a67818601
1 /**————————————————————2 〖說明〗I2C總線驅動程序(用兩個普通IO模擬I2C總線)3 包括100Khz(T=10us)的標準模式(慢速模式)選擇,4 和400Khz(T=2.5us)的快速模式選擇,5 默認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 調用方式:void I2CStart(void) ﹫2001/07/0 431 函數說明:私有函數,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 調用方式:void I2CStop(void) ﹫2001/07/0 443 函數說明:私有函數,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 調用方式:bit I2CAck(void) ﹫2001/07/0 454 函數說明:私有函數,I2C專用,等待從器件接收方的應答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 Xilinx Zynq-7000 Extensible Processing Platform (EPP) redefines the possibilities for embedded systems, giving system and software architects and developers a flexible platform to launch their new solutions and traditional ASIC and ASSP users an alternative that aligns with today’s programmable imperative. The new class of product elegantly combines an industrystandard ARMprocessor-based system with Xilinx 28nm programmable logic—in a single device. The processor boots first, prior to configuration of the programmable logic. This, along with a streamlined workflow, saves time and effort and lets software developers and hardware designers start development simultaneously.
上傳時間: 2013-11-01
上傳用戶:dingdingcandy