2012TI杯陕西赛题H题,2012TI杯陕西赛题B题--频率补偿电路.
上传时间: 2013-10-07
上传用户:ysystc670
自己在学校的时候做的一些单片机仿真实例和一些资料,希望对大家有些帮助
上传时间: 2013-11-08
上传用户:oojj
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
PSHLY-B回路电阻测试仪介绍
上传时间: 2013-11-05
上传用户:木子叶1
针对目前使用的RS232接口数字化B超键盘存在PC主机启动时不能设置BIOS,提出一种PS2键盘的设计方法。基于W78E052D单片机,采用8通道串行A/D转换器设计了8个TGC电位器信息采集电路,电位器位置信息以键盘扫描码序列形式发送,正交编码器信号通过XC9536XL转换为单片机可接收的中断信号,软件接收到中断信息后等效处理成按键。结果表明,在满足开机可设置BIOS同时,又可实现超声特有功能,不需要专门设计驱动程序,接口简单,成本低。 Abstract: Aiming at the problem of the digital ultrasonic diagnostic imaging system keyboard with RS232 interface currently used couldn?蒺t set the BIOS when the PC boot, this paper proposed a design method of PS2 keyboards. Based on W78E052D microcontroller,designed eight TGC potentiometers information acquisition circuit with 8-channel serial A/D converter, potentiometer position information sent out with keyboard scan code sequentially.The control circuit based on XC9536 CPLD is used for converting the mechanical actions of the encoders into the signals that can be identified by the MCU, software received interrupt information and equivalently treatmented as key. The results show that the BIOS can be set to meet the boot, ultrasound specific functionality can be achieved at the same time, it does not require specially designed driver,the interface is simple and low cost.
上传时间: 2013-10-10
上传用户:asdfasdfd
I/O 型单片机使用手册 目录 间接寻址寄存器 – IAR, IAR0, IAR1 .............................................35间接寻址指针 – MP, MP0, MP1 ......................................................35存储区指针 – BP .........................................................................36累加器 – ACC...................................................................................37程序计数器低字节寄存器 – PCL....................................................37表格寄存器 – TBLP,TBHP,TBLH....................................................37看门狗定时寄存器 – WDTS............................................................38状态寄存器 – STATUS.....................................................................38中断控制寄存器 – INTC,INTC0,INTC1 .........................................39定时/计数寄存器...............................................................................39输入/输出端口和控制寄存器...........................................................40UART 寄存器 .USR,UCR1,UCR2,TXR/RXR,BRG.......................40输入/输出端口..........................................................................................41上拉电阻............................................................................................41PA 口的唤醒......................................................................................41输入/输出端口控制寄存器...............................................................41引脚共享功能....................................................................................42编程注意事项....................................................................................45定时/计数器..............................................................................................46配置定时/计数器输入时钟源...........................................................47定时/计数寄存器 – TMR, TMR0,TMR0L/TMR0H,TMR1L/TMR1H,TMR2.....................................................................49定时/计数控制寄存器 – TMRC,TMR0C,TMR1C,TMR2C............50定时器模式........................................................................................53事件计数器模式................................................................................53脉冲宽度测量模式............................................................................54可编程分频器(PFD)和蜂鸣器的应用..............................................55预分频器(Prescaler)...........................................................................56输入/输出接口...................................................................................56编程注意事项....................................................................................57定时/计数器应用范例.......................................................................57中断............................................................................................................59中断寄存器........................................................................................59中断优先权........................................................................................62外部中断............................................................................................63定时/计数器中断...............................................................................64UART 中断........................................................................................64编程注意事项....................................................................................65复位和初始化............................................................................................66复位....................................................................................................66目录iii异步串行口——UART............................................................................74UART 特性..........................................................................................74UART 外部引脚..................................................................................74数据发送.............................................................................................75UART 状态控制寄存器......................................................................75波特率发生器.....................................................................................79UART 设置与控制..............................................................................81UART 发送器......................................................................................83UART 接收器......................................................................................84接收错误处理.....................................................................................85接收中断图解.....................................................................................86地址检测模式.....................................................................................86暂停模式下的UART 功能.................................................................87UART 应用范例.................................................................................87振荡器........................................................................................................89系统时钟配置....................................................................................89系统晶体/陶瓷振荡器.......................................................................89系统电阻电容振荡器........................................................................90内部系统电阻电容振荡器................................................................90RTC 振荡器........................................................................................91看门狗定时振荡器............................................................................91暂停和唤醒................................................................................................92暂停.....................................................................................................92进入暂停.............................................................................................92静态电流.............................................................................................92唤醒....................................................................................................92看门狗定时器............................................................................................94掩膜选项....................................................................................................96应用电路....................................................................................................97第二部份 程序语言.....................................................................99第二章 指令集介绍.................................................................................101指令集......................................................................................................101指令周期..........................................................................................101数据的传送......................................................................................101算术运算..........................................................................................102逻辑和移位运算..............................................................................102分支和控制的转换..........................................................................102位运算..............................................................................................102查表运算..........................................................................................103其它运算..........................................................................................103指令设定一览表......................................................................................104惯例..................................................................................................104I/O 型单片机使用手册iv第三章 指令定义.....................................................................................107第四章 汇编语言和编译器.....................................................................121常用符号..................................................................................................121语句语法..................................................................................................122名称..................................................................................................122操作项..............................................................................................122操作数项..........................................................................................122注解..................................................................................................122编译伪指令..............................................................................................123条件编译伪指令..............................................................................123文件控制伪指令..............................................................................124程序伪指令......................................................................................126数据定义伪指令..............................................................................130宏指令..............................................................................................132汇编语言指令..........................................................................................136名称..................................................................................................136助记符..............................................................................................136操作数、运算子和表达式..............................................................136其它..........................................................................................................139前置引用..........................................................................................139局部标号..........................................................................................139汇编语言保留字..............................................................................140编译器选项..............................................................................................141编译列表文件格式..................................................................................141源程序列表......................................................................................141编译总结..........................................................................................142其它..................................................................................................142第三部份 开发工具................................................................... 145第五章 单片机开发工具.........................................................................147HT-IDE 集成开发环境............................................................................147盛群单片机仿真器(HT-ICE) ..................................................................149HT-ICE 接口卡.................................................................................149OTP 烧写器.....................................................................................149OTP 适配卡.....................................................................................149系统配置..................................................................................................150HT-ICE 接口卡设置........................................................................151安装..........................................................................................................153系统要求..........................................................................................153硬件安装..........................................................................................153软件安装..........................................................................................154目录v第六章 快速开始.....................................................................................159步骤一:建立一个新项目..............................................................159步骤二:将源程序文件加到项目中..............................................159步骤三:编译项目..........................................................................159步骤四:烧写OTP 单片机.............................................................160步骤五:传送程序与掩膜选项单至Holtek ..................................160附录............................................................................................... 161附录A 特性曲线图...................................................................................163附录B 封装信息.......................................................................................173
上传时间: 2013-10-18
上传用户:blacklee
微型计算机课程设计论文—通用微机发声程序的汇编设计 本文讲述了在微型计算机中利用可编程时间间隔定时器的通用发声程序设计,重点讲述了程序的发声原理,节拍的产生,按节拍改变的动画程序原理,并以设计一个简单的乐曲评分程序为引子,分析程序设计的细节。关键字:微机 8253 通用发声程序 动画技术 直接写屏 1. 可编程时间间隔定时器8253在通用个人计算机中,有一个可编程时间间隔定时器8253,它能够根据程序提供的计数值和工作方式,产生各种形状和各种频率的计数/定时脉冲,提供给系统各个部件使用。本设计是利用计算机控制发声的原理,编写演奏乐曲的程序。 在8253/54定时器内部有3个独立工作的计数器:计数器0,计数器1和计数器2,每个计数器都分配有一个断口地址,分别为40H,41H和42H.8253/54内部还有一个公用的控制寄存器,端地址为43H.端口地址输入到8253/54的CS,AL,A0端,分别对3个计数器和控制器寻址. 对8353/54编程时,先要设定控制字,以选择计数器,确定工作方式和计数值的格式.每计数器由三个引脚与外部联系,见教材第320页图9-1.CLK为时钟输入端,GATE为门控信号输入端,OUT为计数/定时信号输入端.每个计数器中包含一个16位计数寄存器,这个计数器时以倒计数的方式计数的,也就是说,从计数初值逐次减1,直到减为0为止. 8253/54的三个计数器是分别编程的,在对任一个计数器编程时,必须首先讲控制字节写入控制寄存器.控制字的作用是告诉8253/54选择哪个计数器工作,要求输出什么样的脉冲波形.另外,对8253/54的初始化工作还包括,向选定的计数器输入一个计数初值,因为这个计数值可以是8为的,也可以是16为的,而8253/5的数据总线是8位的,所以要用两条输出指令来写入初值.下面给出8253/54初始化程序段的一个例子,将计数器2设定为方式3,(关于计数器的工作方式参阅教材第325—330页)计数初值为65536. MOV AL,10110110B ;选择计数器2,按方式3工作,计数值是二进制格式 OUT 43H,AL ; j将控制字送入控制寄存器 MOV AL,0 ;计数初值为0 OUT 42H,AL ;将计数初值的低字节送入计数器2 OUT 42H,AL ;将计数初值的高字节送入计数器2 在IBM PC中8253/54的三个时钟端CLK0,CLK1和CLK2的输入频率都是1.1931817MHZ. PC机上的大多数I/O都是由主板上的8255(或8255A)可编程序外围接口芯片(PPI)管理的.关于8255A的结构和工作原理及应用举例参阅教材第340—373页.教材第364页的”PC/XT机中的扬声器接口电路”一节介绍了扬声器的驱动原理,并给出了通用发声程序.本设计正是基于这个原理,通过编程,控制加到扬声器上的信号的频率,奏出乐曲的.2.发声程序的设计下面是能产生频率为f的通用发声程序:MOV AL, 10110110B ;8253控制字:通道2,先写低字节,后写高字节 ;方式3,二进制计数OUT 43H, AL ;写入控制字MOV DX, 0012H ;被除数高位MOV AX, 35DEH ;被除数低位 DIV ID ;求计数初值n,结果在AX中OUT 42H, AL ;送出低8位MOV AL, AHOUT 42H,AL ;送出高8位IN AL, 61H ;读入8255A端口B的内容MOV AH, AL ;保护B口的原状态OR AL, 03H ;使B口后两位置1,其余位保留OUT 61H,AL ;接通扬声器,使它发声
上传时间: 2013-10-17
上传用户:sunjet
TKS仿真器B系列快速入门
上传时间: 2013-10-31
上传用户:aix008
一个简单好用的B+树算法实现
上传时间: 2015-01-04
上传用户:缥缈
一个用Basic实现的B-Tree算法
上传时间: 2013-12-30
上传用户:ccclll