/*--------- 8051内核特殊功能寄存器 -------------*/ sfr ACC = 0xE0; //累加器 sfr B = 0xF0; //B 寄存器 sfr PSW = 0xD0; //程序状态字寄存器 sbit CY = PSW^7; //进位标志位 sbit AC = PSW^6; //辅助进位标志位 sbit F0 = PSW^5; //用户标志位0 sbit RS1 = PSW^4; //工作寄存器组选择控制位 sbit RS0 = PSW^3; //工作寄存器组选择控制位 sbit OV = PSW^2; //溢出标志位 sbit F1 = PSW^1; //用户标志位1 sbit P = PSW^0; //奇偶标志位 sfr SP = 0x81; //堆栈指针寄存器 sfr DPL = 0x82; //数据指针0低字节 sfr DPH = 0x83; //数据指针0高字节 /*------------ 系统管理特殊功能寄存器 -------------*/ sfr PCON = 0x87; //电源控制寄存器 sfr AUXR = 0x8E; //辅助寄存器 sfr AUXR1 = 0xA2; //辅助寄存器1 sfr WAKE_CLKO = 0x8F; //时钟输出和唤醒控制寄存器 sfr CLK_DIV = 0x97; //时钟分频控制寄存器 sfr BUS_SPEED = 0xA1; //总线速度控制寄存器 /*----------- 中断控制特殊功能寄存器 --------------*/ sfr IE = 0xA8; //中断允许寄存器 sbit EA = IE^7; //总中断允许位 sbit ELVD = IE^6; //低电压检测中断控制位 8051
上传时间: 2013-10-30
上传用户:yxgi5
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
1、程序的基本格式先介绍二条伪指令:EQU ——标号赋值伪指令ORG ——地址定义伪指令PIC16C5X在RESET后指令计算器PC被置为全“1”,所以PIC16C5X几种型号芯片的复位地址为:PIC16C54/55:1FFHPIC16C56:3FFHPIC16C57/58:7FFH一般来说,PIC的源程序并没有要求统一的格式,大家可以根据自己的风格来编写。但这里我们推荐一种清晰明了的格式TITLE This is ⋯⋯ ;程序标题;--------------------------------------;名称定义和变量定义;--------------------------------------F0 EQU 0RTCC EQU 1PC EQU 2STATUS EQU 3FSR EQU 4RA EQU 5RB EQU 6RC EQU 7┋PIC16C54 EQU 1FFH ;芯片复位地址PIC16C56 EQU 3FFHPIC16C57 EQU 7FFH;-----------------------------------------ORG PIC16C54 GOTO MAIN ;在复位地址处转入主程序ORG 0 ;在0000H开始存放程序;-----------------------------------------;子程序区;-----------------------------------------DELAY MOVLW 255┋RETLW 0;------------------------------------------;主程序区;------------------------------------------MAINMOVLW B‘00000000’TRIS RB ;RB已由伪指令定义为6,即B口┋LOOPBSF RB,7 CALL DELAYBCF RB,7 CALL DELAY┋GOTO LOOP;-------------------------------------------END ;程序结束注:MAIN标号一定要处在0页面内。2、程序设计基础
上传时间: 2013-11-14
上传用户:cjf0304
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
数字运算,判断一个数是否接近素数 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
We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
标签: represented integers group items
上传时间: 2016-01-17
上传用户:jeffery
本代码为编码开关代码,编码开关也就是数字音响中的 360度旋转的数字音量以及显示器上用的(单键飞梭开 关)等类似鼠标滚轮的手动计数输入设备。 我使用的编码开关为5个引脚的,其中2个引脚为按下 转轮开关(也就相当于鼠标中键)。另外3个引脚用来 检测旋转方向以及旋转步数的检测端。引脚分别为a,b,c b接地a,c分别接到P2.0和P2.1口并分别接两个10K上拉 电阻,并且a,c需要分别对地接一个104的电容,否则 因为编码开关的触点抖动会引起轻微误动作。本程序不 使用定时器,不占用中断,不使用延时代码,并对每个 细分步数进行判断,避免一切误动作,性能超级稳定。 我使用的编码器是APLS的EC11B可以参照附件的时序图 编码器控制流水灯最能说明问题,下面是以一段流水 灯来演示。
上传时间: 2017-07-03
上传用户:gaojiao1999
【问题描述】 在一个N*N的点阵中,如N=4,你现在站在(1,1),出口在(4,4)。你可以通过上、下、左、右四种移动方法,在迷宫内行走,但是同一个位置不可以访问两次,亦不可以越界。表格最上面的一行加黑数字A[1..4]分别表示迷宫第I列中需要访问并仅可以访问的格子数。右边一行加下划线数字B[1..4]则表示迷宫第I行需要访问并仅可以访问的格子数。如图中带括号红色数字就是一条符合条件的路线。 给定N,A[1..N] B[1..N]。输出一条符合条件的路线,若无解,输出NO ANSWER。(使用U,D,L,R分别表示上、下、左、右。) 2 2 1 2 (4,4) 1 (2,3) (3,3) (4,3) 3 (1,2) (2,2) 2 (1,1) 1 【输入格式】 第一行是数m (n < 6 )。第二行有n个数,表示a[1]..a[n]。第三行有n个数,表示b[1]..b[n]。 【输出格式】 仅有一行。若有解则输出一条可行路线,否则输出“NO ANSWER”。
标签: 点阵
上传时间: 2014-06-21
上传用户:llandlu
常用芯片DIP SOT SOIC QFP电阻电容二极管等3D模型库 3D视图封装库 STEP后缀三维视图(154个):050-9.STEP0805R.STEP1001-1.STEP1001-2.STEP1001-3.STEP1001-4.STEP1001-5.STEP1001-6.STEP1001-7.STEP1001-8.STEP103_1KV.STEP10X5JT.STEP1206R.STEP13PX2.STEP15PX2.STEP20P插针.STEP25V1000UF.STEP3296W.STEP35V2200UF.STEP3mmLED.STEP3mmLEDH.STEP3X3可调电阻.STEP400V0.1UF.STEP455.STEP630V0.1UF.STEP7805.STEP8P4R.STEPAXIAL-0.2-0.125W.STEPAXIAL-0.4-0.25W.STEPaxial-0.6-2W.STEPB-3528.STEPC-0805.STEPC06x18.STEPCAP-6032.STEPCH3.96 X2.STEPCH3.96-3P.STEPD-PAK.STEPDB25.STEPDC-30.STEPDIP14.STEPDIP16.STEPDIP6.STEPDIP8.STEPDO-214AA.STEPDO-214AB.STEPDO-214AC.STEPDO-41.STEPDO-41Z.STEPFMQ.STEPGNR14D.STEPH9700.STEPILI4981.STEPIN4007.STEPIN5408.STEPJP051-6P6C_02.STEPJQC-3F.STEPJS-1132-10.STEPJS-1132-11.STEPJS-1132-12.STEPJS-1132-13.STEPJS-1132-14.STEPJS-1132-15.STEPJS-1132-2.STEPJS-1132-3.STEPJS-1132-4.STEPJS-1132-5.STEPJS-1132-6.STEPJS-1132-7.STEPJS-1132-8.STEPJS-1132-9.STEPJS-1132R-2.STEPJS-1132R-3.STEPJS-1132R-4.STEPJS-1132R-5.STEPJS-1132R-6.STEPJS-1132R-7.STEPJS-1132R-8.STEPJZC-33F.STEPKBP210.STEPKE2108.STEPKF2510 X8.STEPKF301.STEPKF301x3.STEPKSD-9700.STEPLED5_BLUE.STEPLED5_GRE.STEPLED5_RED.STEPLED5_YEL.STEPLFCSP_WQ.STEPLQFP100.STEPLQFP48.STEPMC-146.STEPmolex-22-27-2021.STEPmolex-22-27-2031.STEPmolex-22-27-2041.STEPmolex-22-27-2051.STEPmolex-22-27-2061.STEPmolex-22-27-2071.STEPmolex-22-27-2081.STEPMSOP10.STEPMSOP8.STEPPA0630NOXOX-HA1.STEPPIN10.STEPPIN24.STEPPIN24A.STEPR 0805.STEPR0402.STEPR0603.STEPR0805.STEPR1206.STEPRA-15.STEPRA-20.STEPRS808.STEPSIP-3-3.96 22-27-2031.STEPSL-B.STEPSL-D.STEPSL-E.STEPSL-G.STEPSL-H.STEPSOD-123.STEPSOD-323.STEPSOD-523.STEPSOD-723.STEPSOD-80.STEPSOIC-8.STEPSOP-4.STEPSOP14.STEPSOP16.STEPSOP18.STEPSOT-89.STEPSOT223.STEPSOT23-3.STEPSOT23-5.STEPSSOP28.STEPTAJ-A.STEPTAJ-B.STEPTAJ-C.STEPTAJ-D.STEPTAJ-E.STEPTAJ-R.STEPTHB6064H.STEPTO-126.STEPTO-126X.STEPTO-220.STEPTO-247.STEPTO-252-3L.STEPTOSHIBA_11-4C1.STEPTSSOP-8.STEPTSSOP14-BOTTON.STEPTSSOP14.STEPTSSOP28.STEPUSB-A.STEPUSB-B.STEPWT.STEP
标签: 芯片 dip sot soic qfp 电阻 电容 二极管 封装
上传时间: 2021-11-21
上传用户:XuVshu
AR0231AT7C00XUEA0-DRBR(RGB滤光)安森美半导体推出采用突破性减少LED闪烁 (LFM)技术的新的230万像素CMOS图像传感器样品AR0231AT,为汽车先进驾驶辅助系统(ADAS)应用确立了一个新基准。新器件能捕获1080p高动态范围(HDR)视频,还具备支持汽车安全完整性等级B(ASIL B)的特性。LFM技术(专利申请中)消除交通信号灯和汽车LED照明的高频LED闪烁,令交通信号阅读算法能于所有光照条件下工作。AR0231AT具有1/2.7英寸(6.82 mm)光学格式和1928(水平) x 1208(垂直)有源像素阵列。它采用最新的3.0微米背照式(BSI)像素及安森美半导体的DR-Pix™技术,提供双转换增益以在所有光照条件下提升性能。它以线性、HDR或LFM模式捕获图像,并提供模式间的帧到帧情境切换。 AR0231AT提供达4重曝光的HDR,以出色的噪声性能捕获超过120dB的动态范围。AR0231AT能同步支持多个摄相机,以易于在汽车应用中实现多个传感器节点,和通过一个简单的双线串行接口实现用户可编程性。它还有多个数据接口,包括MIPI(移动产业处理器接口)、并行和HiSPi(高速串行像素接口)。其它关键特性还包括可选自动化或用户控制的黑电平控制,支持扩频时钟输入和提供多色滤波阵列选择。封装和现状:AR0231AT采用11 mm x 10 mm iBGA-121封装,现提供工程样品。工作温度范围为-40℃至105℃(环境温度),将完全通过AEC-Q100认证。
标签: 图像传感器
上传时间: 2022-06-27
上传用户:XuVshu