void display() //数码显示 { SCON=0; //初始化串行口方式 SBUF=dispcode[ge]; while(!TI); TI=0; led4=0; delay(2); led4=1; SBUF=dispcode[shi]; while(!TI); TI=0; led3=0; delay(2); led3=1;
上传时间: 2013-11-20
上传用户:wtrl
TLC2543是TI公司的12位串行模数转换器,使用开关电容逐次逼近技术完成A/D转换过程。由于是串行输入结构,能够节省51系列单片机I/O资源;且价格适中,分辨率较高,因此在仪器仪表中有较为广泛的应用。 TLC2543的特点 (1)12位分辩率A/D转换器; (2)在工作温度范围内10μs转换时间; (3)11个模拟输入通道; (4)3路内置自测试方式; (5)采样率为66kbps; (6)线性误差±1LSBmax; (7)有转换结束输出EOC; (8)具有单、双极性输出; (9)可编程的MSB或LSB前导; (10)可编程输出数据长度。 TLC2543的引脚排列及说明 TLC2543有两种封装形式:DB、DW或N封装以及FN封装,这两种封装的引脚排列如图1,引脚说明见表1 TLC2543电路图和程序欣赏 #include<reg52.h> #include<intrins.h> #define uchar unsigned char #define uint unsigned int sbit clock=P1^0; sbit d_in=P1^1; sbit d_out=P1^2; sbit _cs=P1^3; uchar a1,b1,c1,d1; float sum,sum1; double sum_final1; double sum_final; uchar duan[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; uchar wei[]={0xf7,0xfb,0xfd,0xfe}; void delay(unsigned char b) //50us { unsigned char a; for(;b>0;b--) for(a=22;a>0;a--); } void display(uchar a,uchar b,uchar c,uchar d) { P0=duan[a]|0x80; P2=wei[0]; delay(5); P2=0xff; P0=duan[b]; P2=wei[1]; delay(5); P2=0xff; P0=duan[c]; P2=wei[2]; delay(5); P2=0xff; P0=duan[d]; P2=wei[3]; delay(5); P2=0xff; } uint read(uchar port) { uchar i,al=0,ah=0; unsigned long ad; clock=0; _cs=0; port<<=4; for(i=0;i<4;i++) { d_in=port&0x80; clock=1; clock=0; port<<=1; } d_in=0; for(i=0;i<8;i++) { clock=1; clock=0; } _cs=1; delay(5); _cs=0; for(i=0;i<4;i++) { clock=1; ah<<=1; if(d_out)ah|=0x01; clock=0; } for(i=0;i<8;i++) { clock=1; al<<=1; if(d_out) al|=0x01; clock=0; } _cs=1; ad=(uint)ah; ad<<=8; ad|=al; return(ad); } void main() { uchar j; sum=0;sum1=0; sum_final=0; sum_final1=0; while(1) { for(j=0;j<128;j++) { sum1+=read(1); display(a1,b1,c1,d1); } sum=sum1/128; sum1=0; sum_final1=(sum/4095)*5; sum_final=sum_final1*1000; a1=(int)sum_final/1000; b1=(int)sum_final%1000/100; c1=(int)sum_final%1000%100/10; d1=(int)sum_final%10; display(a1,b1,c1,d1); } }
上传时间: 2013-11-19
上传用户:shen1230
#include<iom16v.h> #include<macros.h> #define uint unsigned int #define uchar unsigned char uint a,b,c,d=0; void delay(c) { for for(a=0;a<c;a++) for(b=0;b<12;b++); }; uchar tab[]={ 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,
上传时间: 2013-10-21
上传用户:13788529953
该文是小生在学习51单片机时搜集多份网上资料整理而成,要点处有重点标注,而且分类详细,望能给广大有相关疑问的同志以帮助....
上传时间: 2013-10-26
上传用户:yulg
对应程序: #include<reg52.h> #define uint unsigned int #define uchar unsigned char uchar code tab[]={ 0x81, 0x42, 0x24, 0x18, }; void delay(uint z) { uint i,j; for(i=z;i>0;i--) for(j=120;j>0;j--); } void init() { P0=0x00; }
上传时间: 2014-01-17
上传用户:ruan2570406
HIGH SPEED 8051 μC CORE - Pipe-lined Instruction Architecture; Executes 70% of Instructions in 1 or 2 System Clocks - Up to 25MIPS Throughput with 25MHz System Clock - 22 Vectored Interrupt Sources MEMORY - 4352 Bytes Internal Data RAM (256 + 4k) - 64k Bytes In-System Programmable FLASH Program Memory - External Parallel Data Memory Interface – up to 5Mbytes/sec DIGITAL PERIPHERALS - 64 Port I/O; All are 5V tolerant - Hardware SMBusTM (I2CTM Compatible), SPITM, and Two UART Serial Ports Available Concurrently - Programmable 16-bit Counter/Timer Array with 5 Capture/Compare Modules - 5 General Purpose 16-bit Counter/Timers - Dedicated Watch-Dog Timer; Bi-directional Reset CLOCK SOURCES - Internal Programmable Oscillator: 2-to-16MHz - External Oscillator: Crystal, RC, C, or Clock - Real-Time Clock Mode using Timer 3 or PCA SUPPLY VOLTAGE ........................ 2.7V to 3.6V - Typical Operating Current: 10mA @ 25MHz - Multiple Power Saving Sleep and Shutdown Modes 100-Pin TQFP (64-Pin Version Available) Temperature Range: –40°C to +85°C
标签: C8051F020
上传时间: 2013-10-12
上传用户:lalalal
目录: 1. Character Type Functions - 字符类型函数 2. Standard C Input/Output Functions - 标准输入输出函数 3. Standard Library Functions - 标准库和内存分配函数 4. Mathematical Functions - 数学函数 5. String Functions - 字符串函数 6. BCD Conversion Functions - BCD 转换函数 7. Memory Access Functions - 存储器访问函数 8. Delay Functions - 延时函数 9. LCD Functions - LCD函数 10. LCD Functions for displays with 4x40 characters - 4×40 字符型LCD函数 11. LCD Functions for displays connected in 8 bit memory mapped mode -以8 位外部存储 器模式接口的LCD显示函数 12. I2C Bus Functions - I2C 总线函数 13. National Semiconductor LM75 Temperature Sensor Functions - LM75 温度传感器函数 14. Dallas Semiconductor DS1621 Thermometer/Thermostat Functions - DS1621 温度计函 数 15. Philips PCF8563 Real Time Clock Functions - PCF8563 实时时钟函数 16. Philips PCF8583 Real Time Clock Functions - PCF8583 实时时钟函数 17. Dallas Semiconductor DS1302 Real Time Clock Functions - DS1302 实时时钟函数 18. Dallas Semiconductor DS1307 Real Time Clock Functions - DS1307 实时时钟函数 19. 1 Wire Protocol Functions - 单线通讯协议函数 20. Dallas Semiconductor DS1820/DS1822 Temperature Sensors Functions - DS1820/1822 温度传感器函数 21. SPI Functions - SPI 函数 22. Power Management Functions - 电源管理函数 23. Gray Code Conversion Functions - 格雷码转换函数
上传时间: 2013-10-22
上传用户:归海惜雪
飞机电网故障时,机载电气盒必须在延迟时间内切断电网,保护机载设备。采用AT89S52设计的电气盒测试仪能够测试电气盒保护功能,测量延迟时间。实际应用结果表明,该测试仪具有测量准确、可靠性高、成本低等优点。 Abstract: The helicopter-electrical-box must shut off the helicopter power,protect the equipments of the helicopter when the helicopter power is failed.The tester for the helicopter-electrical-box based on AT89S52is used for testing the protect-ing function and measuring the delay time.Application results show this tester has some advantages,such as accurate mea-surement,high dependability,economical cost etc.
上传时间: 2014-12-27
上传用户:786334970
介绍以P87LPC764型单片机为核心的延时型漏电继电器设计方案。该方案可供用户选择实现额定动作电流和5倍额定动作电流下不同的延时动作时间,并有重合闸设定选择功能。解决了以往传统分立元件带来的延时时间离散性大且不易实现的弊端。 Abstract: In this paper, the delay leakage relay based on P87LPC764 is introduced in detail. This system provides different relay times at rating current and 5× rating current for users and also offers superposition brake set selection function. So that it resolves many traditional problems.
上传时间: 2013-11-08
上传用户:zhaiye
第一章 序論……………………………………………………………6 1- 1 研究動機…………………………………………………………..7 1- 2 專題目標…………………………………………………………..8 1- 3 工作流程…………………………………………………………..9 1- 4 開發環境與設備…………………………………………………10 第二章 德州儀器OMAP 開發套件…………………………………10 2- 1 OMAP介紹………………………………………………………10 2-1.1 OMAP是什麼?…….………………………………….…10 2-1.2 DSP的優點……………………………………………....11 2- 2 OMAP Architecture介紹………………………………………...12 2-2-1 OMAP1510 硬體架構………………………………….…12 2-2.2 OMAP1510軟體架構……………………………………...12 2-2.3 DSP / BIOS Bridge簡述…………………………………...13 2- 3 TI Innovator套件 -- OMAP1510 ……………………………..14 2-2.1 General Purpose processor -- ARM925T………………...14 2-2.2 DSP processor -- TMS320C55x …………………………15 2-2.3 IDE Tool – CCS …………………………………………15 2-2.4 Peripheral ………………………………………………..16 第三章 在OMAP1510上建構Embedded Linux System…………….17 3- 1 嵌入式工具………………………………………………………17 3-1.1 嵌入式程式開發與一般程式開發之不同………….….17 3-1.2 Cross Compiling的GNU工具程式……………………18 3-1.3 建立ARM-Linux Cross-Compiling 工具程式………...19 3-1.4 Serial Communication Program………………………...20 3- 2 Porting kernel………………………………………………….…21 3-2.1 Setup CCS ………………………………………….…..21 3-2.2 編譯及上傳Loader…………………………………..…23 3-2.3 編譯及上傳Kernel…………………………………..…24 3- 3 建構Root File System………………………………………..…..26 3-3.1 Flash ROM……………………………………………...26 3-3.2 NFS mounting…………………………………………..27 3-3.3 支援NFS Mounting 的kernel…………………………..27 3-3.4 提供NFS Mounting Service……………………………29 3-3.5 DHCP Server……………………………………………31 3-3.6 Linux root 檔案系統……………………………….…..32 3- 4 啟動及測試Innovator音效裝置…………………………..…….33 3- 5 建構支援DSP processor的環境…………………………...……34 3-5.1 Solution -- DSP Gateway簡介……………………..…34 3-5.2 DSP Gateway運作架構…………………………..…..35 3- 6 架設DSP Gateway………………………………………….…36 3-6.1 重編kernel……………………………………………...36 3-6.2 DEVFS driver…………………………………….……..36 3-6.3 編譯DSP tool和API……………………………..…….37 3-6.4 測試……………………………………………….…….37 第四章 MP3 Player……………………………………………….…..38 4- 1 MP3 介紹………………………………………………….…….38 4- 2 MP3 壓縮原理……………………………………………….….39 4- 3 Linux MP3 player – splay………………………………….…….41 4.3-1 splay介紹…………………………………………….…..41 4.3-2 splay 編譯………………………………………….…….41 4.3-3 splay 的使用說明………………………………….……41 第五章 程式改寫………………………………………………...…...42 5-1 程式評估與改寫………………………………………………...…42 5-1.1 Inter-Processor Communication Scheme…………….....42 5-1.2 ARM part programming……………………………..…42 5-1.3 DSP part programming………………………………....42 5-2 程式碼………………………………………………………..……43 5-3 雙處理器程式開發注意事項…………………………………...…47 第六章 效能評估與討論……………………………………………48 6-1 速度……………………………………………………………...48 6-2 CPU負載………………………………………………………..49 6-3 討論……………………………………………………………...49 6-3.1分工處理的經濟效益………………………………...49 6-3.2音質v.s 浮點與定點運算………………………..…..49 6-3.3 DSP Gateway架構的限制………………………….…50 6-3.4減少IO溝通……………….………………………….50 6-3.5網路掛載File System的Delay…………………..……51 第七章 結論心得…
上传时间: 2013-10-14
上传用户:a471778