虫虫首页| 资源下载| 资源专辑| 精品软件
登录| 注册

EA-series-chinese

  • 可编程自动控制控制跑马灯

    这一颗,我们学习如何让跑马灯自动按照我们预定的顺序进行。这种控制在工控场合经常用到。这个程序里,我们预先定义了一个变化的顺序speedcode,每跑一圈灯就根据预定设置的表格数据来决定下一圈的跑马速度。这样我们就实现了按照预定的顺序自动变化运行。请看代码:-----------------------------------#define uchar unsigned char //定义一下方便使用#define uint unsigned int#define ulong unsigned long#include <reg52.h> //包括一个52 标准内核的头文件sbit P10 = P1^0; //头文件中没有定义的IO 就要自己来定义了sbit P11 = P1^1;sbit P12 = P1^2;sbit P13 = P1^3;bit ldelay=0; //长定时溢出标记,预置是0uchar speed=10; //设置一个变量保存跑马灯的移动速度uchar code speedcode[10]={3,1,5,12,3,20,2,10,1,4}; //10 个预定义的速度char code dx516[3] _at_ 0x003b;//这是为了仿真设置的//可编程自动控制跑马灯void main(void) // 主程序{uchar code ledp[4]={0xfe,0xfd,0xfb,0xf7};//预定的写入P1 的值uchar ledi; //用来指示显示顺序uchar i;RCAP2H =0x10; //赋T2 的预置值0x1000,溢出30 次就是1 秒钟RCAP2L =0x00;TR2=1; //启动定时器ET2=1; //打开定时器2 中断EA=1; //打开总中断

    标签: 可编程 自动控制 控制 跑马灯

    上传时间: 2013-11-20

    上传用户:ming529

  • 基于单片机的红外门进控制系统设计与制作(含源程序和原理图)

    基于单片机的红外门进控制系统设计与制作:我们所做的创新实验项目“基于单片机的红外门控系统”已基本完成,现将其工作原理简要说明。该系统主要分为两大部分:一是红外传感器部分。二是单片机计数显示控制部分。基本电路图如下:其中红外传感器部分我们采用红外对管实现,红外对管平行放置,平常处于接收状态,经比较器输出低电平,当有人经过时,红外线被挡住,接收管接收不到红外线,经比较器输出高电平。这样,当有人经过时便会产生一个电平的跳变。单片机控制部分主要是通过外部两个中断判断是否有人经过,如果有人经过,由于电平跳变的产生,进入中断服务程序,这里我们采用了两对红外传感器接到两个外部中断口,中断0作为入口,实现加1操作,中断1作为出口,实现减1操作。另外,我们通过P0口控制室内灯的亮暗,当寄存器计数值为0时,熄灯,不为0时,灯亮。显示部分,采用两位数码管动态显示,如有必要,可以很方便的扩展为四位计数。精益求精!在实验过程中,我们走了非常多的弯路,做出来的东西根本不是自己想要的,我们本想做成室内只有一个门的进出计数,原理已清楚,即在门的两边放置两对红外对管,进出时,挡住两对对管的顺序不同,因此,可判断是进入还是出去,从而实现加减计数,编程时,可分别在两个中断服务程序的入口置标志位,根据标志位判断进出,详细内容在程序部分。理论如此,但在实际过程中,还是发现实现不了上述功能,我们初步判定认为是程序掌握得不够好,相信随着自己对单片机了解的深入,应该会做出更好的 (因为我们是临时学的单片机),程序的具体内容如下: $MOD52    ORG   0000H         LJMP  MAIN         ORG   0003H         LJMP  0100H         ORG   0013H         LJMP  0150H         ORG   0050HMAIN:    CLR   A         MOV   30H , A           ;初始化缓存区         MOV   31H , A         MOV   32H , A         MOV   33H , A         MOV   R6  , A         MOV   R7  , A  SETB  EA  SETB  EX0  SETB  EX1  SETB  IT0  SETB  IT1  SETB  PX1NEXT1:   ACALL HEXTOBCDD        ;调用数制转换子程序         ACALL DISPLAY          ;调用显示子程序         LJMP  NEXT1          ORG   0100H  ;中断0服务程序 LCALL  DELY mov 70h,#2 djnz 70h,next JBC  F0,NEXT         SETB F0        CLR P0.0 LCALL  DELY0 SETB   P0.0                  MOV   A , R7   ADD   A , #1   MOV   R7, A   MOV   A , R6         ADDC  A , #0  MOV   R6 , A  CJNE  R6 , #07H , NEXT  CLR   A  MOV   R6 , A  MOV   R7 , ANEXT:  RETI  ORG   0150H    ;中断1服务程序 LCALL  DELY mov 70h,#2 djnz 70h,next2 JBC  F0,NEXT2 SETB  F0 CLR P0.0 LCALL  DELY0 SETB   P0.0    CLR C                     MOV   A , R7   SUBB   A , #1  MOV   R7, A  MOV   A , R6   SUBB  A , #0  MOV   R6 , A  CJNE  R6 , #07H , NEXT2  CLR   A  MOV   R6 , A  MOV   R7 , ANEXT2:  RETI   ORG   0200HHEXTOBCDD:MOV  A , R6               ;由十六进制转化为十进制         PUSH  ACC         MOV   A , R7         PUSH  ACC  MOV   A , R2         PUSH  ACC  CLR   A         MOV   R3 , A  MOV   R4 , A  MOV   R5 , A  MOV   R2 , #10HHB3:     MOV   A  , R7              ;将十六进制中最高位移入进位位中         RLC   A  MOV   R7 , A  MOV   A  , R6  RLC   A  MOV   R6 , A  MOV   A  , R5              ;每位数加上本身相当于将这个数乘以2  ADDC  A  , R5  DA    A  MOV   R5 , A  MOV   A  , R4  ADDC  A  , R4  DA    A                   ;十进制调整  MOV   R4 , A  MOV   A  , R3  ADDC  A  , R3  DJNZ  R2 , HB3  POP   ACC   MOV   R2 , A  POP   ACC   MOV   R7 , A  POP   ACC  MOV   R6 , A  RET  ORG   0250HDISPLAY:  MOV   R0 , #30H         MOV   A  , R5  ANL   A  , #0FH  MOV   @R0 , A  MOV   A  , R5  SWAP  A  ANL   A  , #0FH  INC   R0  MOV   @R0 , A  MOV   A  , R4  ANL   A , #0FH  INC   R0  MOV   @R0 , A  MOV   A   , R4  SWAP  A  ANL   A  , #0FH  INC   R0  MOV   @R0 , A  MOV   R0 , #30H  MOV   R2 , #11111110BAGAIN:   MOV   A  , R2         MOV   P2 , A         MOV   A  , @R0  MOV   DPTR , #TAB  MOVC  A  , @A+DPTR  MOV   P1 , A  ACALL DELAY  INC   R0  MOV   A  , R2  RL    A  MOV   R2 , A  JB    ACC.4  , AGAIN   RETTAB:     DB    03FH , 06H , 5BH , 4FH , 66H , 6DH , 7DH , 07H , 7FH , 6FH   ;七段码表DELY:    MOV   R1,#80D1:        MOV    R2,#100             DJNZ   R2,$ DJNZ    R1,D1 RET DELAY:   MOV   TMOD , #01H           ;延时子程序         MOV   TL0  , #0FEH         MOV   TH0  , #0FEH  SETB  TR0WAIT:    JNB   TF0  , WAIT         CLR   TF0  CLR   TR0  RETDELY0:   MOV  R1,  #200D3:  MOV  R2,#250          DJNZ  R2,$  DJNZ  R1,D3    RET          END       该系统实际应用广泛。可用在生产线上产品数量统计、公交车智能计数问候(需添加语音芯片)、超市内人数统计等公共场合。另外,添加串口通信部分便可实现与PC数据交换的功能。   由于,实验简化了,剩下不少零件和资金,所以我们又做了两项其他的实验。

    标签: 单片机 红外 控制系统设计 原理图

    上传时间: 2013-12-22

    上传用户:tangsiyun

  • Input Signal Rise and Fall Tim

    All inputs of the C16x family have Schmitt-Trigger input characteristics. These Schmitt-Triggers are intended to always provide proper internal low and high levels, even if anundefined voltage level (between TTL-VIL and TTL-VIH) is externally applied to the pin.The hysteresis of these inputs, however, is very small, and can not be properly used in anapplication to suppress signal noise, and to shape slow rising/falling input transitions.Thus, it must be taken care that rising/falling input signals pass the undefined area of theTTL-specification between VIL and VIH with a sufficient rise/fall time, as generally usualand specified for TTL components (e.g. 74LS series: gates 1V/us, clock inputs 20V/us).The effect of the implemented Schmitt-Trigger is that even if the input signal remains inthe undefined area, well defined low/high levels are generated internally. Note that allinput signals are evaluated at specific sample points (depending on the input and theperipheral function connected to it), at that signal transitions are detected if twoconsecutive samples show different levels. Thus, only the current level of an input signalat these sample points is relevant, that means, the necessary rise/fall times of the inputsignal is only dependant on the sample rate, that is the distance in time between twoconsecutive evaluation time points. If an input signal, for instance, is sampled throughsoftware every 10us, it is irrelevant, which input level would be seen between thesamples. Thus, it would be allowable for the signal to take 10us to pass through theundefined area. Due to the sample rate of 10us, it is assured that only one sample canoccur while the signal is within the undefined area, and no incorrect transition will bedetected. For inputs which are connected to a peripheral function, e.g. capture inputs, thesample rate is determined by the clock cycle of the peripheral unit. In the case of theCAPCOM unit this means a sample rate of 400ns @ 20MHz CPU clock. This requiresinput signals to pass through the undefined area within these 400ns in order to avoidmultiple capture events.For input signals, which do not provide the required rise/fall times, external circuitry mustbe used to shape the signal transitions.In the attached diagram, the effect of the sample rate is shown. The numbers 1 to 5 in thediagram represent possible sample points. Waveform a) shows the result if the inputsignal transition time through the undefined TTL-level area is less than the time distancebetween the sample points (sampling at 1, 2, 3, and 4). Waveform b) can be the result ifthe sampling is performed more than once within the undefined area (sampling at 1, 2, 5,3, and 4).Sample points:1. Evaluation of the signal clearly results in a low level2. Either a low or a high level can be sampled here. If low is sampled, no transition willbe detected. If the sample results in a high level, a transition is detected, and anappropriate action (e.g. capture) might take place.3. Evaluation here clearly results in a high level. If the previous sample 2) had alreadydetected a high, there is no change. If the previous sample 2) showed a low, atransition from low to high is detected now.

    标签: Signal Input Fall Rise

    上传时间: 2013-10-23

    上传用户:copu

  • 介绍C16x系列微控制器的输入信号升降时序图及特性

    All inputs of the C16x family have Schmitt-Trigger input characteristics. These Schmitt-Triggers are intended to always provide proper internal low and high levels, even if anundefined voltage level (between TTL-VIL and TTL-VIH) is externally applied to the pin.The hysteresis of these inputs, however, is very small, and can not be properly used in anapplication to suppress signal noise, and to shape slow rising/falling input transitions.Thus, it must be taken care that rising/falling input signals pass the undefined area of theTTL-specification between VIL and VIH with a sufficient rise/fall time, as generally usualand specified for TTL components (e.g. 74LS series: gates 1V/us, clock inputs 20V/us).The effect of the implemented Schmitt-Trigger is that even if the input signal remains inthe undefined area, well defined low/high levels are generated internally. Note that allinput signals are evaluated at specific sample points (depending on the input and theperipheral function connected to it), at that signal transitions are detected if twoconsecutive samples show different levels. Thus, only the current level of an input signalat these sample points is relevant, that means, the necessary rise/fall times of the inputsignal is only dependant on the sample rate, that is the distance in time between twoconsecutive evaluation time points. If an input signal, for instance, is sampled throughsoftware every 10us, it is irrelevant, which input level would be seen between thesamples. Thus, it would be allowable for the signal to take 10us to pass through theundefined area. Due to the sample rate of 10us, it is assured that only one sample canoccur while the signal is within the undefined area, and no incorrect transition will bedetected. For inputs which are connected to a peripheral function, e.g. capture inputs, thesample rate is determined by the clock cycle of the peripheral unit. In the case of theCAPCOM unit this means a sample rate of 400ns @ 20MHz CPU clock. This requiresinput signals to pass through the undefined area within these 400ns in order to avoidmultiple capture events.

    标签: C16x 微控制器 输入信号 时序图

    上传时间: 2014-04-02

    上传用户:han_zh

  • 68HC05K0 Infra-red Remote Cont

    The MC68HC05K0 is a low cost, low pin countsingle chip microcomputer with 504 bytes of userROM and 32 bytes of RAM. The MC68HC05K0 isa member of the 68HC05K series of devices whichare available in 16-pin DIL or SOIC packages.It uses the same CPU as the other devices in the68HC05 family and has the same instructions andregisters. Additionally, the device has a 15-stagemulti-function timer and 10 general purposebi-directional I/0 lines. A mask option is availablefor software programmable pull-downs on all ofthe I/O pins and four of the pins are capable ofgenerating interrupts.The device is ideally suited for remote-controlkeyboard applications because the pull-downs andthe interrupt drivers on the port pins allowkeyboards to be built without any externalcomponents except the keys themselves. There isno need for external pull-up or pull-down resistors,or diodes for wired-OR interrupts, as these featuresare already designed into the device.

    标签: Infra-red Remote Cont 05K

    上传时间: 2014-01-24

    上传用户:zl5712176

  • 模拟串口通讯程序(51汇编代码编写)

    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

    上传用户:二十八号

  • 单片机课程总结

    单片机基础知识单片机的外部结构:1、 DIP40双列直插;2、 P0,P1,P2,P3四个8位准双向I/O引脚;(作为I/O输入时,要先输出高电平)3、 电源VCC(PIN40)和地线GND(PIN20);4、 高电平复位RESET(PIN9);(10uF电容接VCC与RESET,即可实现上电复位)5、 内置振荡电路,外部只要接晶体至X1(PIN18)和X0(PIN19);(频率为主频的12倍)6、 程序配置EA(PIN31)接高电平VCC;(运行单片机内部ROM中的程序)7、 P3支持第二功能:RXD、TXD、INT0、INT1、T0、T1 单片机内部I/O部件:(所为学习单片机,实际上就是编程控制以下I/O部件,完成指定任务)1、 四个8位通用I/O端口,对应引脚P0、P1、P2和P3;2、 两个16位定时计数器;(TMOD,TCON,TL0,TH0,TL1,TH1)3、 一个串行通信接口;(SCON,SBUF)4、 一个中断控制器;(IE,IP)针对AT89C52单片机,头文件AT89x52.h给出了SFR特殊功能寄存器所有端口的定义。教科书的160页给出了针对MCS51系列单片机的C语言扩展变量类型。 C语言编程基础:1、 十六进制表示字节0x5a:二进制为01011010B;0x6E为01101110。2、 如果将一个16位二进数赋给一个8位的字节变量,则自动截断为低8位,而丢掉高8位。3、 ++var表示对变量var先增一;var—表示对变量后减一。4、 x |= 0x0f;表示为 x = x | 0x0f;5、 TMOD = ( TMOD & 0xf0 ) | 0x05;表示给变量TMOD的低四位赋值0x5,而不改变TMOD的高四位。6、 While( 1 ); 表示无限执行该语句,即死循环。语句后的分号表示空循环体,也就是{;}第一章    单片机最小应用系统:单片机最小系统的硬件原理接线图:1、 接电源:VCC(PIN40)、GND(PIN20)。加接退耦电容0.1uF2、 接晶体:X1(PIN18)、X2(PIN19)。注意标出晶体频率(选用12MHz),还有辅助电容30pF3、 接复位:RES(PIN9)。接上电复位电路,以及手动复位电路,分析复位工作原理4、 接配置:EA(PIN31)。说明原因。第二章      基本I/O口的应用第三章      显示驱动第七章      串行接口应用

    标签: 单片机

    上传时间: 2013-10-30

    上传用户:athjac

  • 《51单片机C语言应用程序实例精讲》

    /* 4位8段数码管分别动态显示“1234”, */   #include "7LEDShow.h"   void main() {        DIGPORT = 0;                                    // 关闭显示               TMOD = 0x01;                                         // T0工作方式1          /* 2ms 定时设置 */        time0_tmp = 65536-time0*fosc/12;        TH0 = (time0_tmp/256);        TL0 = (time0_tmp%256);               TR0 = 1;        ET0 = 1;        EA = 1;               digbit = 0x01;                                         // 从第一位数码管开始

    标签: 51单片机C语言 应用程序

    上传时间: 2013-12-12

    上传用户:kachleen

  • I2C总线驱动程序

    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;

    标签: I2C 总线 驱动程序

    上传时间: 2014-04-11

    上传用户:xg262122

  • Virtex-7HT_Press_Pitch-Chinese-final

    赛灵思正式发货全球首款异构 3D FPGA,为 Nx100G 和 400G 线路卡解决方案带来突破性集成能力

    标签: HT_Press_Pitch-Chinese-final Virtex

    上传时间: 2013-10-11

    上传用户:13033095779