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
介绍一种以MSP430单片机为基础的智能频率测量系统,采用硬件逻辑与软件指令相结合的方式控制闸门,实现0 MHz~10 MHz范围内无档切换的等精度测量。 Abstract: An intelligent frequency measurement system based on MSP430 singlechip is introduced. The system uses a way that can combine hardware logic and software instructions to contronl the strobe ,and completes the functions of equal precision in the range of 0MHz~10MHz without shifting
上传时间: 2013-10-28
上传用户:dbs012280
摘要:“网络通”是基于普通单片机的廉价以太网测控网关。它可以将具有RS-232、RS-485等接口的测控设备简单而且直接地连接在以太网(因特网)上,利用丰富的现成的以太网资源,组成一系列以太网的分布式测控系统。关键词:以太网分布式测控系统 以太网测控网关 网关 网络通
上传时间: 2014-12-27
上传用户:xg262122
摘要:本文主要提出了一种基于普通单片机的网络接入模块的设计方案。网络接入模块是廉价的测控网络接入方案,它可以将具有RS-232等接口的测控设备简单又直接地连接在局域网上,利用丰富现成的局域网资源,组成一系列局域网的分布式测控系统,可以作为一种新的实用测控网络分布式控制的方法。关键词:网络接入模块,TCP,IP,UDP,ARP
上传时间: 2013-11-07
上传用户:assef
基于中颖SH79F164单片机的电子血压计应用:电子血压计因具有无创性、操作简单、携带方面等优点,目前得到广泛的应用和推广。无创检测血压的方法很多,如柯氏音法,测振法,超声法、双袖带法、恒定袖带法、逐拍跟踪法、张力定测法和恒定容积法等。其中测振法就是我们常说的示波法,由于具有较好的抗干扰能力,能比较可靠地判断血压、实现血压的自动检测而成为无创血压的主流。目前国内外大多数电子血压计都采用示波法。示波法的原理同柯氏音法,也需要充气袖套来阻断动脉流,但在放气过程中不是检测柯氏音,而是检测气袖内气体的振荡波(测振法由此得名),这些振荡波是袖带与动脉耦合的结果,源于心血管周期内血管壁由于收缩舒张引起的压力脉动。理论计算和实践均证明此振荡波的幅度有一定的规律,与动脉收缩压、平均压以及舒张压有一定的函数关系。针对示波法,本文将详细介绍基于中颖电子SH79F164 单片机的血压计系统方案与软硬件实现。 在硬件电路设计方面,笔者参考了大量的资料,最终选定SH79F164 单片机作为主控IC。其理由是SH79F164 内建资源丰富,既能节省大量外围器件,又方便系统调试。SH79F164 内建资源主要有:可编程仪表放大器(PGA)、带通滤波器、固定增益放大器、恒流源放大器、10 位A/D 转换器、时基定时器(RTC)。硬件部分构成:压力传感器、SH79F164 单片机、LCD、袖套、充气泵、放气阀、按键等(见图3)。
上传时间: 2013-10-23
上传用户:muhongqing
题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。 1.程序分析:(a>b)?a:b这是条件运算符的基本例子。
上传时间: 2015-01-08
上传用户:lifangyuan12
RSA算法 :首先, 找出三个数, p, q, r, 其中 p, q 是两个相异的质数, r 是与 (p-1)(q-1) 互质的数...... p, q, r 这三个数便是 person_key,接著, 找出 m, 使得 r^m == 1 mod (p-1)(q-1)..... 这个 m 一定存在, 因为 r 与 (p-1)(q-1) 互质, 用辗转相除法就可以得到了..... 再来, 计算 n = pq....... m, n 这两个数便是 public_key ,编码过程是, 若资料为 a, 将其看成是一个大整数, 假设 a < n.... 如果 a >= n 的话, 就将 a 表成 s 进位 (s
标签: person_key RSA 算法
上传时间: 2013-12-14
上传用户:zhuyibin
使用vhdl语言写的fpga的应用程序,使献策内容为等精度频率计
上传时间: 2014-01-01
上传用户:frank1234
数字运算,判断一个数是否接近素数 A Niven number is a number such that the sum of its digits divides itself. For example, 111 is a Niven number because the sum of its digits is 3, which divides 111. We can also specify a number in another base b, and a number in base b is a Niven number if the sum of its digits divides its value. Given b (2 <= b <= 10) and a number in base b, determine whether it is a Niven number or not. Input Each line of input contains the base b, followed by a string of digits representing a positive integer in that base. There are no leading zeroes. The input is terminated by a line consisting of 0 alone. Output For each case, print "yes" on a line if the given number is a Niven number, and "no" otherwise. Sample Input 10 111 2 110 10 123 6 1000 8 2314 0 Sample Output yes yes no yes no
上传时间: 2015-05-21
上传用户:daguda