输入信号:左转弯传感器LH,右转弯传感器RH和紧急制动或慢行传感器JMH,另外,汽车尾灯主要是给后面行使汽车的司机注意。为了使尾灯的光信号更明显,采用亮灭交替的闪烁信号,其闪烁周期为2秒,即尾灯亮1秒,灭1秒,再亮1秒…。在图9-21中设置了一个1秒时钟的输入信号CP。 输出信号:输出共设两个,左面一个尾灯,右面一个尾灯,既左转弯时指示灯LD和右转弯时指示灯RD。
上传时间: 2013-12-15
上传用户:GHF
通用串行总线(USB)是一种新兴的计算机外围串行通信接口标准,与常用的计算机接口(如串口、并口等)相比,通用串行总线(Universal Serial Bus,USB)具有热插拔、即插即用、数据传输可靠、扩展方便、低成本等优点。从问世以来,它得到了广泛的应用,一方面已成为当前计算机必备的接口之一,同时也被广泛地应用于嵌入式系统设计中。 从1994年USB 0.7出现开始,USB实施者论坛(Implementation Forum)先后定义了USB 0.8、0.9、1.0、1.1、2.0以及USB OTG等规范,以及各种不同的设备类规范。其中USB1.1规范目前正逐步广泛应用,而USB2.0和USBOTG作为USB协议的更新和扩展,也将使USB占领更广的外设
上传时间: 2016-02-17
上传用户:王小奇
进行键盘扫描及键处理时,在程序中直接调用函数KeyProcess()即可。键处理函数原 型声明在头文件Key.h中,键处理函数可放在程序的任何地方,一个按键对应一个处理函 数。 该键盘扫描程序去抖动为什么不需软件延时?因为从无按键到键被按下,要进行两次 扫描,此间相当于延时去抖动。 该键盘扫描程序还有一特色:用二维数组进行按键功能处理,使程序更简单。 /*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 矩阵键盘键值扫描,功能处理函数 本程序处理4*4的矩阵键盘,直接用于8051系列单片机,也可移植到其它机型. 行输出在P1口高四位 列输入在P1口低四位,如果不同,则需修改键值读取函数 即:GetKeyCode() 有10个数字键0--9,1个小数点,1个负号键。 第二功能键和回车键共用一个,如果连续按下该键2秒钟,则键盘进入第二功能。 在键盘初始化程序InitKeyboard中把ucKey1和ucKey2赋值0xff
标签: 键盘扫描
上传时间: 2016-02-19
上传用户:二驱蚊器
进行键盘扫描及键处理时,在程序中直接调用函数KeyProcess()即可。键处理函数原 型声明在头文件Key.h中,键处理函数可放在程序的任何地方,一个按键对应一个处理函 数。 该键盘扫描程序去抖动为什么不需软件延时?因为从无按键到键被按下,要进行两次 扫描,此间相当于延时去抖动。 该键盘扫描程序还有一特色:用二维数组进行按键功能处理,使程序更简单。 /*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 矩阵键盘键值扫描,功能处理函数 本程序处理4*4的矩阵键盘,直接用于8051系列单片机,也可移植到其它机型. 行输出在P1口高四位 列输入在P1口低四位,如果不同,则需修改键值读取函数 即:GetKeyCode() 有10个数字键0--9,1个小数点,1个负号键。 第二功能键和回车键共用一个,如果连续按下该键2秒钟,则键盘进入第二功能。 在键盘初始化程序InitKeyboard中把ucKey1和ucKey2赋值0xff
标签: 键盘扫描
上传时间: 2013-12-21
上传用户:dreamboy36
Mark Allen Weiss的《数据结构与算法分析》C语言描述版的习题答案,网上一般为1-9章答案,这里提供1-12章,可以下载看看,绝对经典。
上传时间: 2016-09-01
上传用户:moerwang
symbian C++ 入门经典 初学者必读,step by step 目录 1 概述 5 2 预备知识 5 3 Symbian OS Platform及应用开发5 3.1 内核和用户库.5 3.2 文件和目录5 3.3 目标平台及其变种6 3.4 Symbian OS的目标类型.6 4 应用开发工具包(SDKs)和工具7 4.1 SDK安装后的目录结构.7 4.1.1 根目录.7 4.1.2 Epoc32\.7 4.1.3 Epoc32Ex\8 4.2 应用构建工具.8 4.2.1 项目定义文件9 4.2.2 组件描述文件(bld.inf)9 4.2.3 bldmake命令9 5 渐进式指导10 5.1 控制台应用.10 5.2 基本源文件.10 5.3 构建应用.10 5.4 运行应用.11 6 深入研讨 13
上传时间: 2014-01-19
上传用户:yuanyuan123
Implementation of Edmonds Karp algorithm that calculates maxFlow of graph. Input: For each test case, the first line contains the number of vertices (n) and the number of arcs (m). Then, there exist m lines, one for each arc (source vertex, ending vertex and arc weight, separated by a space). The nodes are numbered from 1 to n. The node 1 and node n should be in different sets. There are no more than 30 arcs and 15 nodes. The arc weights vary between 1 and 1 000 000. Output: The output is a single line for each case, with the corresponding minimum size cut. Example: Input: 7 11 1 2 3 1 4 3 2 3 4 3 1 3 3 4 1 3 5 2 4 6 6 4 5 2 5 2 1 5 7 1 6 7 9 Output: 5
标签: Implementation calculates algorithm Edmonds
上传时间: 2014-01-04
上传用户:kiklkook
% 生成训练样本集 clear all; clc; P=[110 0.807 240 0.2 15 1 18 2 1.5; 110 2.865 240 0.1 15 2 12 1 2; 110 2.59 240 0.1 12 4 24 1 1.5; 220 0.6 240 0.3 12 3 18 2 1; 220 3 240 0.3 25 3 21 1 1.5; 110 1.562 240 0.3 15 3 18 1 1.5; 110 0.547 240 0.3 15 1 9 2 1.5]; 0 1.318 300 0.1 15 2 18 1 2]; T=[54248 162787 168380 314797; 28614 63958 69637 82898; 86002 402710 644415 328084; 230802 445102 362823 335913; 60257 127892 76753 73541; 34615 93532 80762 110049; 56783 172907 164548 144040]; @907 117437 120368 130179]; m=max(max(P)); n=max(max(T)); P=P'/m; T=T'/n; %-------------------------------------------------------------------------% pr(1:9,1)=0; %输入矢量的取值范围矩阵 pr(1:9,2)=1; bpnet=newff(pr,[12 4],{'logsig', 'logsig'}, 'traingdx', 'learngdm'); %建立BP神经网络, 12个隐层神经元,4个输出神经元 %tranferFcn属性 'logsig' 隐层采用Sigmoid传输函数 %tranferFcn属性 'logsig' 输出层采用Sigmoid传输函数 %trainFcn属性 'traingdx' 自适应调整学习速率附加动量因子梯度下降反向传播算法训练函数 %learn属性 'learngdm' 附加动量因子的梯度下降学习函数 net.trainParam.epochs=1000;%允许最大训练步数2000步 net.trainParam.goal=0.001; %训练目标最小误差0.001 net.trainParam.show=10; %每间隔100步显示一次训练结果 net.trainParam.lr=0.05; %学习速率0.05 bpnet=train(bpnet,P,T); %------------------------------------------------------------------------- p=[110 1.318 300 0.1 15 2 18 1 2]; p=p'/m; r=sim(bpnet,p); R=r'*n; display(R);
上传时间: 2016-05-28
上传用户:shanqiu
/*#include<reg52.h> #define uint unsigned int #define uchar unsigned char #define uchar unsigned char sbit K1=P3^4; sbit K2=P3^5; sbit ledr=P1^0; sbit ledg=P1^1; sbit ledb=P1^2; bit LEDDirection=0;//LED控制方向0:渐亮1:渐灭 char pwm=0; char pwmr=0; char scw=0;//中断记数 char tt=0; char n; void dealy(uint z); void Timer0Init(void) { TMOD=0x01; TH0=0xff; TL0=0x47; EX0=1; IT0=0; PX0=1; ET0=1; TR0=1; EA=1; } void main() { Timer0Init(); while(1){ if(K1==0) { dealy (1); if(K1==0) {TR0=1; ledr=0; dealy(5); TR0=0; } } if(K2==0) { dealy (1); if(K2==0) { while(1) { ledr=0; //亮 dealy(100-n*10); ledr=1; //熄 dealy(n*10); } } } } } void Time0Isr(void) interrupt 1 { // pwm=0; TH0=0xff; TL0=0x47; scw++; }*/ #include<reg52.h> #define uchar unsigned char bit LEDDirection=0; sbit P2_0=P1^0; sbit key1=P3^4; sbit key2=P3^5; sbit key3=P3^6; uchar zkb,i,t;// zkb指占空比 uchar pwm; void delay(uchar z) { uchar x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } void init() //初始化函数 { TMOD=0X01; TH0=(65536-1000)/256; TL0=(65536-1000)%256; EA=1; ET0=1; TR0=1; } void keyscan() //键盘扫描 { P3=0XFF; if(key1==0) { delay(5); if(key1==0) { while(!key1); if(zkb<9) { zkb++; } } } if(key2==0) { delay(5); if(key2==0) { while(!key2); if(zkb>0) { zkb--; } } } if(key3==0) {TR0=1; delay(5); if(key3==0) {while(!key3); if((zkb<=9)&&(0==LEDDirection)) { zkb++; if(zkb>9) { LEDDirection=1; zkb=9; } } if((zkb>=0 )&&(1==LEDDirection)) { zkb--; if(zkb<0 ) { LEDDirection=0; zkb=0 ; //dealy(3000); } } } //pwm=pwmr; } } void main() //主函数 { zkb=2; init(); while(1) { keyscan(); } } void time0(void) interrupt 1 //中断函数 { TH0=(65536-200)/256; TL0=(65536-200)%256; ++i; if(i>10) { i=0; }; if(i<=zkb) { P2_0=1; } else P2_0=0; } /*void time0(void) interrupt 0 //中断函数 { TH0=(65536-1000)/256; TL0=(65536-1000)%256; ++i; if(i>10) { i=0; }; if(i<=zkb) { P2_0=1; } else P2_0=0; }*/
标签: 调光
上传时间: 2016-07-02
上传用户:184890962
#include <iostream> #include <stdio.head> #include <stdlib.head> #include <string.head> #define ElemType int #define max 100 using namespace std; typedef struct node1 { ElemType data; struct node1 *next; }Node1,*LinkList;//链栈 typedef struct { ElemType *base; int top; }SqStack;//顺序栈 typedef struct node2 { ElemType data; struct node2 *next; }Node2,*LinkQueue; typedef struct node22 { LinkQueue front; LinkQueue rear; }*LinkList;//链队列 typedef struct { ElemType *base; int front,rear; }SqQueue;//顺序队列 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 //1.采用链式存储实现栈的初始化、入栈、出栈操作。 LinkList CreateStack()//创建栈 { LinkList top; top=NULL; return top; } bool StackEmpty(LinkList s)//判断栈是否为空,0代表空 { if(s==NULL) return 0; else return 1; } LinkList Pushead(LinkList s,int x)//入栈 { LinkList q,top=s; q=(LinkList)malloc(sizeof(Node1)); q->data=x; q->next=top; top=q; return top; } LinkList Pop(LinkList s,int &e)//出栈 { if(!StackEmpty(s)) { printf("栈为空。"); } else { e=s->data; LinkList p=s; s=s->next; free(p); } return s; } void DisplayStack(LinkList s)//遍历输出栈中元素 { if(!StackEmpty(s)) printf("栈为空。"); else { wheadile(s!=NULL) { cout<<s->data<<" "; s=s->next; } cout<<endl; } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 //2.采用顺序存储实现栈的初始化、入栈、出栈操作。 int StackEmpty(int t)//判断栈S是否为空 { SqStack.top=t; if (SqStack.top==0) return 0; else return 1; } int InitStack() { SqStack.top=0; return SqStack.top; } int pushead(int t,int e) { SqStack.top=t; SqStack.base[++SqStack.top]=e; return SqStack.top; } int pop(int t,int *e)//出栈 { SqStack.top=t; if(!StackEmpty(SqStack.top)) { printf("栈为空."); return SqStack.top; } *e=SqStack.base[s.top]; SqStack.top--; return SqStack.top; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 //3.采用链式存储实现队列的初始化、入队、出队操作。 LinkList InitQueue()//创建 { LinkList head; head->rear=(LinkQueue)malloc(sizeof(Node)); head->front=head->rear; head->front->next=NULL; return head; } void deleteEle(LinkList head,int &e)//出队 { LinkQueue p; p=head->front->next; e=p->data; head->front->next=p->next; if(head->rear==p) head->rear=head->front; free(p); } void EnQueue(LinkList head,int e)//入队 { LinkQueue p=(LinkQueue)malloc(sizeof(Node)); p->data=e; p->next=NULL; head->rear->next=p; head->rear=p; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 //4.采用顺序存储实现循环队列的初始化、入队、出队操作。 bool InitQueue(SqQueue &head)//创建队列 { head.data=(int *)malloc(sizeof(int)); head.front=head.rear=0; return 1; } bool EnQueue(SqQueue &head,int e)//入队 { if((head.rear+1)%MAXQSIZE==head.front) { printf("队列已满\n"); return 0; } head.data[head.rear]=e; head.rear=(head.rear+1)%MAXQSIZE; return 1; } int QueueLengthead(SqQueue &head)//返回队列长度 { return (head.rear-head.front+MAXQSIZE)%MAXQSIZE; } bool deleteEle(SqQueue &head,int &e)//出队 { if(head.front==head.rear) { cout<<"队列为空!"<<endl; return 0; } e=head.data[head.front]; head.front=(head.front+1)%MAXQSIZE; return 1; } int gethead(SqQueue head)//得到队列头元素 { return head.data[head.front]; } int QueueEmpty(SqQueue head)//判断队列是否为空 { if (head.front==head.rear) return 1; else return 0; } void travelQueue(SqQueue head)//遍历输出 { wheadile(head.front!=head.rear) { printf("%d ",head.data[head.front]); head.front=(head.front+1)%MAXQSIZE; } cout<<endl; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 //5.在主函数中设计一个简单的菜单,分别测试上述算法。 int main() { LinkList top=CreateStack(); int x; wheadile(scanf("%d",&x)!=-1) { top=Pushead(top,x); } int e; wheadile(StackEmpty(top)) { top=Pop(top,e); printf("%d ",e); }//以上是链栈的测试 int top=InitStack(); int x; wheadile(cin>>x) top=pushead(top,x); int e; wheadile(StackEmpty(top)) { top=pop(top,&e); printf("%d ",e); }//以上是顺序栈的测试 LinkList Q; Q=InitQueue(); int x; wheadile(scanf("%d",&x)!=-1) { EnQueue(Q,x); } int e; wheadile(Q) { deleteEle(Q,e); printf("%d ",e); }//以上是链队列的测试 SqQueue Q1; InitQueue(Q1); int x; wheadile(scanf("%d",&x)!=-1) { EnQueue(Q1,x); } int e; wheadile(QueueEmpty(Q1)) { deleteEle(Q1,e); printf("%d ",e); } return 0; }
上传时间: 2018-05-09
上传用户:123456..