【安卓 弹幕 源码】【视酷源码价格预测】【泰利快贷源码】停车计费 源码_停车计费 源码是什么
1.Cè¯è¨å车åºç®¡çç³»ç»
2.EDA课ç¨è®¾è®¡ï¼ç¨VHDLç¼ç¨ååºç§è½¦è®¡è´¹å¨
3.åºç§è½¦è®¡ä»·å¨
4.20个python3大项目开发源代码(含可执行程序及源码)
5.智慧停车方案+源码
Cè¯è¨å车åºç®¡çç³»ç»
/*----------------------------------------------------------------
// Copyright (C) æ²é³å·¥ç¨å¦é¢ä¿¡æ¯å®å ¨å·¥ä½å®¤
// çæææã
//
// æ件åï¼æ¨¡æå车åºé®é¢.cpp
// æ件åè½æè¿°ï¼æ¨¡æå车åºé®é¢
//
//
// å建æ è¯ï¼
//
// ä¿®æ¹æ è¯ï¼
// ä¿®æ¹æè¿°ï¼å®æç¼ç
//----------------------------------------------------------------*/
//头æ件
#include <iostream>
#include <malloc.h>
#include <string>
#include <windows.h>
//常éå®ä¹
#define MAX_STOP 4 //å®ä¹å车åºæ大å车æ°
#define MAX_PLATE //å®ä¹è½¦çå·æ大é¿åº¦
#define TIME_COUNT "ç§" //å®ä¹æ¶é´åä½
#define TIME_MS_TO_CONUT //å®ä¹æ¶é´è¿å¶ï¼æ为ç±TIME_COUNTå°æ¯«ç§çè¿å¶
#define UNIT_PRICE //å®ä¹åä½æ¶é´æ¶è´¹æ å
using namespace std; //使ç¨stdå½å空é´
//æ°æ®ç»æå®ä¹
//å®ä¹åå¨æ±½è½¦ä¿¡æ¯çç»æä½
typedef struct
{
char license_plate[MAX_PLATE]; //汽车çç §å·ç ï¼å®ä¹ä¸ºä¸ä¸ªå符æéç±»å
char state; //汽车å½åç¶æï¼å符p表示åæ¾å¨å车ä½ä¸ï¼å符s表示åæ¾å¨ä¾¿éä¸ï¼æ¯è¾è½¦çåå§ç¶æç¨å符iæ¥è¿è¡è¡¨ç¤º
int time; //汽车åå ¥å车åºæ¶çæ¶é´ï¼ç¨æ¥è®¡æ¶æ¶è´¹
}CAR;
//å®ä¹æ¨¡æå车åºçæ ç»æ
typedef struct
{
CAR STOP[MAX_STOP]; //汽车信æ¯çåå¨ç©ºé´
int top; //ç¨æ¥æ示æ 顶ä½ç½®çéææé
}SeqStack;
//å®ä¹æ¨¡æ便éçéåç»æ
typedef struct node
{
CAR WAIT; //汽车信æ¯çåå¨ç©ºé´
struct node *next; //ç¨æ¥æ示éåä½ç½®çå¨ææé
}QNode; //é¾éåèç¹çç±»å
//å®ä¹é¾éåçæ¶å°¾æé
typedef struct
{
QNode *front,*rear;
}LQueue; //å°å¤´å°¾æéå°è£ å¨ä¸èµ·çé¾é
//å½æ°å£°æ
int Empty_LQueue(LQueue *q); //å¤é空
int LeaveCheck(SeqStack parking , char *license_plate); //æ£æ¥ç¦»å¼ç车æ¯å¦å¨å车åºä¸
int QueueLength(LQueue *q); //å¤éé¿åº¦
int Out_LQueue(LQueue *&sidewalk , char *license_plate); //åºéæä½
int StackEmpty(SeqStack parking); //å¤ææ æ¯å¦ä¸ºç©º
int StackFull(SeqStack parking); //å¤ææ æ¯å¦ä¸ºæ»¡
int StackPop(SeqStack &parking); //åºæ æä½
int StackTop(SeqStack parking , char *license_plate , int &time);//åæ 顶å ç´
void Car_come(SeqStack &parking , LQueue *&sidewalk); //æ车å°æ¥æ¶çæä½
void Car_leave(SeqStack &parking , LQueue *&sidewalk); //æ车离å¼çæä½
void Display(SeqStack parking); //æ¾ç¤ºå车åºå çææä¿¡æ¯ è°è¯æ¶ç¨
void InitStack(SeqStack &parking); //åå§åæ
void InitList(LQueue *&sidewalk); //åå§åéå
void In_LQueue(LQueue *&sidewalk , char *license_plate); //è¿éæä½
void Input_Check(char *license_plate); ////æ£éªè¾å ¥ç车çæ¯å¦åæ³
void StackPush(SeqStack &parking , char *license_plate , int stop_time);//è¿æ æä½
void main()
{
//å®ä¹åé
SeqStack parking;
LQueue *sidewalk = NULL;
char *choice = new char;
int flag = 1; //å®ä¹ä¸ä¸ªåé å¤ææ¯å¦éåº
//åå§åä¸ä¸ªä¸ºç©ºçå车åº
InitStack(parking);
//åå§åä¸ä¸ªä¸ºç©ºç便é
InitList(sidewalk);
//è¿è¡çé¢ååè½éæ©
while(flag)
{
cout<<"\n\t å车åºæ¨¡æ管çç³»ç» \n\n";
cout<<"\t|--------------------------------------------------|\n\n";
cout<<"\t|æ¬ç¨åºä¸ºå车åºç模æ管çç³»ç»ï¼æ车å°æ¥æ¶è¯·æCé®ã|\n\n";
cout<<"\t|ç¶åæ ¹æ®å±å¹æ示è¿è¡ç¸å ³æä½ï¼æ车è¦èµ°æ¶è¯·ælé®ã|\n\n";
cout<<"\t|ç¶åæ ¹æ®å±å¹æ示è¿è¡ç¸å ³æä½ï¼æ¥çå车åºè¯·æDé®ã|\n\n";
cout<<"\t|ç¶åæ ¹æ®å±å¹æ示è¿è¡ç¸å ³æä½ï¼è¦éåºç³»ç»è¯·æQé®ã|\n\n";
cout<<"\t|--------------------------------------------------|\n\n";
cout<<"请éæ©æä½ï¼";
gets(choice);
if(1 != strlen(choice))
{
cout<<"请æ£ç¡®è¾å ¥é项!";
continue;
}
else
{
switch(*choice)
{
case 'c':
case 'C':
{
Car_come(parking,sidewalk);break;
}
case 'l':
case 'L':
{
Car_leave(parking,sidewalk);break;
}
case 'q':
case 'Q':
{
flag=0;break;
}
case 'd':
case 'D':
{
Display(parking);break;
}
default:
cout<<"éæ©ä¸æ£ç¡®ï¼è¯·éæ°éæ©ï¼\n";
}
}
}
}
//æ车å°æ¥æ¶çæä½
void Car_come(SeqStack &parking , LQueue *&sidewalk)
{
//å®ä¹åé
char license_plate[MAX_PLATE];
cout<<"请è¾å ¥è½¦è¾ç车çå·ç ï¼";
Input_Check(license_plate);
//å¤æå车åºæ¯å¦å·²æ»¡ï¼æ»¡åè¿å ¥ä¾¿éï¼ä¸æ»¡è¿å ¥å车åº
if(StackFull(parking))
{
In_LQueue(sidewalk , license_plate); //è¿å ¥ä¾¿é
cout<<"å车åºå·²æ»¡è¯·å¨ä¾¿éçå,æ¨çä½ç½®ä¸º"<<QueueLength(sidewalk)
<<endl;
}
else
{
StackPush(parking , license_plate , GetTickCount()); //è¿å ¥å车åº
cout<<"请è¿å ¥å车åºä¸ç"<<parking.top+1<<"å·å车ä½\n";
}
// Display(parking);
}
//æ车离å¼æ¶çæä½
void Car_leave(SeqStack &parking , LQueue *&sidewalk)
{
//å®ä¹åé
SeqStack tmpparking; //å®ä¹ä¸´æ¶å车åº
char leave_license_plate[MAX_PLATE]; //è¦ç¦»å¼ç车çå·
char license_plate[MAX_PLATE]; //åæ¾ä»å车åºä¸è¯»åºæ¥ç车çä¿¡æ¯
int time;
InitStack(tmpparking); //åå§å临æ¶å车åº
//å¤æå车åºä¸æ¯å¦æ车
if(StackEmpty(parking))
{
cout<<"å½åå车åºä¸æ²¡æ车\n";
return; //éåºåå½æ°
}
cout<<"请è¾å ¥è¦ç¦»å¼ç车çç §ï¼";
Input_Check(leave_license_plate);
cout<<"å½åå车åºä¸æ"<<parking.top+1<<"è¾è½¦\n";
if(LeaveCheck(parking , leave_license_plate)) //å¤æ车æ¯å¦å¨å车åºä¸
{
//车å¨å车åºä¸
cout<<"æ¨ç车å¨"<<LeaveCheck(parking , leave_license_plate)<<"å·è½¦ä½ä¸\n";
while(StackTop(parking , license_plate , time)
&& (strcmp(parking.STOP[parking.top].license_plate , leave_license_plate) != 0))
{
strcpy(parking.STOP[parking.top].license_plate , license_plate);
cout<<"çç §ä¸º"<<license_plate<<"ç车ææ¶éåºå车åº"<<parking.top+1<<"å·ä½\n";
StackPush(tmpparking , license_plate , time); //å车åºä¸ç车ææ¶éåº è¿å ¥ä¸´æ¶å车åº
StackPop(parking); //åºæ
}
cout<<"çç §ä¸º"<<license_plate<<"ç车离å¼å车åº"<<parking.top+1<<"å·ä½\n";
cout<<"æ¨å¨å车åºä¸åäº"<<(GetTickCount()-time)/TIME_MS_TO_CONUT<<TIME_COUNT<<endl; //è¾åºæåæ¶é´ä¿¡æ¯
cout<<"åºç¼´è´¹ç¨ä¸º"<<(GetTickCount()-time)/TIME_MS_TO_CONUT*UNIT_PRICE<<"å \n";; //è¾åºè´¹ç¨ä¿¡æ¯
StackPop(parking); //åºæ
//å°ä¸´æ¶å车åºä¸ç车ååå车åº
while(StackEmpty(tmpparking) != 1)
{
StackTop(tmpparking , license_plate , time);
StackPush(parking , license_plate , time);
cout<<"çç §ä¸º"<<license_plate<<"ç车è¿å ¥å车åº"<<parking.top+1<<"å·ä½\n";
license_plate[0] = '\0';
StackPop(tmpparking);
}
if(parking.top+1 == MAX_STOP-1) //å¤æ车离å¼åå车åºæ¯å¦å满
if(QueueLength(sidewalk)) //å¦æå满åå¤æ便éä¸æ¯å¦æ车
{
//便éä¸æ车 åä»ä¾¿éä¸åå ¥å车åº
Out_LQueue(sidewalk , license_plate); //åºé
StackPush(parking , license_plate , GetTickCount()); //å ¥æ
cout<<"å¨ä¾¿éä¸çç §ä¸º"<<license_plate<<"ç车è¿å ¥å车åº"<<parking.top+1<<"å·ä½\n";
}
}
else
//车ä¸å¨å车åºä¸
cout<<"æ¨ç车ä¸å¨å车åºä¸ï¼\n";
}
//åå§å顺åºæ
void InitStack(SeqStack &parking)
{
parking.top = -1;
}
//å¤æ 空
int StackEmpty(SeqStack parking)
{
if(parking.top == -1)
return 1;
else
return 0;
}
//å¤æ 满
int StackFull(SeqStack parking)
{
if(parking.top == MAX_STOP-1)
return 1;
else
return 0;
}
//å ¥æ
void StackPush(SeqStack &parking , char *license_plate , int stop_time)
{
parking.top++;
strcpy(parking.STOP[parking.top].license_plate , license_plate);
parking.STOP[parking.top].state = 'p';
parking.STOP[parking.top].time = stop_time;
}
//åºæ è¿åæ 顶æé
int StackPop(SeqStack &parking)
{
if(StackEmpty(parking))
return 0;
else
return parking.top--;
}
//åæ 顶å ç´
int StackTop(SeqStack parking , char *license_plate , int &time)
{
if(StackEmpty(parking))
return 0;
else
{
strcpy(license_plate , parking.STOP[parking.top].license_plate);
time = parking.STOP[parking.top].time;
return 1;
}
}
//æ¾ç¤ºææ
void Display(SeqStack parking)
{
if(parking.top == -1)
printf("å车åºä¸ºç©º\n");
else
{
while(parking.top != -1)
{
cout<<"车çå·ä¸ºï¼"<<parking.STOP[parking.top].license_plate;
cout<<"ï¼åå¨"<<parking.top + 1 <<"å·è½¦ä½ä¸";
cout<<"ï¼å·²å"<<(GetTickCount()-parking.STOP[parking.top].time)/TIME_MS_TO_CONUT<<TIME_COUNT<<endl;
parking.top--;
}
}
}
//åå§åéå
void InitList(LQueue *&sidewalk)
{
sidewalk = (LQueue *)malloc(sizeof(LQueue));
sidewalk->front=sidewalk->rear = NULL;
}
//å ¥é
void In_LQueue(LQueue *&sidewalk,char *license_plate)
{
QNode *car_on_sidewalk;
car_on_sidewalk = (QNode *)malloc(sizeof(QNode)); //为æ°èç¹å¼è¾æ°ç©ºé´
strcpy(car_on_sidewalk->WAIT.license_plate , license_plate); //å°æ°æ®åå ¥èç¹
car_on_sidewalk->WAIT.state = 's'; //åå ¥å车信æ¯
car_on_sidewalk->WAIT.time = GetTickCount(); //åå ¥å车æ¶é´
car_on_sidewalk->next = NULL;
if(Empty_LQueue(sidewalk)) //é空åå建第ä¸ä¸ªèç¹
sidewalk->front = sidewalk->rear = car_on_sidewalk;
else
{
//éé空æå ¥éå°¾
sidewalk->rear->next = car_on_sidewalk;
sidewalk->rear = car_on_sidewalk;
}
}
//å¤é空
int Empty_LQueue(LQueue *q)
{
if(q->front == NULL)
return 1;
else
return 0;
}
//å¤éé¿åº¦ è¿åéé¿
int QueueLength(LQueue *q)
{
QNode *p=q->front;
int i=0;
while(p != NULL)
{
i++;
p=p->next;
}
return i;
}
//åºé æåè¿å1 é空è¿å0
int Out_LQueue(LQueue *&sidewalk,char *license_plate)
{
QNode *car_on_sidewalk;
if(Empty_LQueue(sidewalk)) //å¦æé空è¿å0
return 0;
car_on_sidewalk = sidewalk->front;
strcpy(license_plate , car_on_sidewalk->WAIT.license_plate);//ååºé头å ç´
if(sidewalk->front == sidewalk->rear) //éä¸åªæä¸ä¸ªå ç´
sidewalk->front = sidewalk->rear=NULL; //å é¤å ç´
else
sidewalk->front = sidewalk->front->next; //é头æéå移
free(car_on_sidewalk); //éæ¾æé
return 1;
}
//æ£æ¥ç¦»å¼ç车æ¯å¦å¨å车åºä¸ è¿å车å¨å车åºä¸ä½ç½® ä¸å¨åè¿å0
int LeaveCheck(SeqStack parking,char *license_plate)
{
int flag = parking.top+1; //å®ä¹åéè®°å½å½å车å¨å车åºä¸ä½ç½®
if(StackEmpty(parking))
return 0;
else
{
//æ¥æ¾ç¦»å¼è½¦æå¨ä½ç½®
while(parking.top != -1 && strcmp(parking.STOP[parking.top].license_plate , license_plate) != 0)
{
flag--;
parking.top--;
}
return flag;
}
}
//æ£éªè¾å ¥ç车çæ¯å¦åæ³
void Input_Check(char *license_plate)
{
int flag = 1;
int i;
string tmpstr;
while(flag)
{
cin>>tmpstr;
getchar();
if(tmpstr.length()<MAX_PLATE)
{
for(i=0;i<;i++)
license_plate[i] = tmpstr.c_str()[i];
flag = 0;
}
else
cout<<"è¾å ¥æ误ï¼è¯·éæ°è¾å ¥ï¼";
}
}
以åç课设 ä½ ççå§ çº¯æå·¥ç~~
EDA课ç¨è®¾è®¡ï¼ç¨VHDLç¼ç¨ååºç§è½¦è®¡è´¹å¨
课ç¨è®¾è®¡å 容ä¸è¦æ±
1ï¼ç¨å¼å ³æé®è¡¨ç¤ºèå²ï¼æ¯ä¸ªèå²ä»£è¡¨ç±³ï¼ä¸ªèå²1å ¬éï¼æ¯å ¬é1.4å ï¼è½åæ¥æ¾ç¤ºéç¨åè´¹ç¨ï¼
2ï¼ä½äº2å ¬é5å 计费ï¼é«äº2å ¬éæ»è´¹ç¨=èµ·æ¥è´¹ç¨+ï¼éç¨-2å ¬éï¼*éç¨åä»·+
çåæ¶é´*çååä»·ï¼
3ï¼çåæ¶é´å¤§äº2åéï¼ææ¯åé1.3å 计费ï¼
4ï¼å¯ä»¥è®¾å®èµ·æ¥ä»·åéç¨åä»·ã
ä¸ã设计åçä¸ææ¯æ¹æ³ï¼
å æ¬ï¼çµè·¯å·¥ä½åçåæä¸åçå¾ãå å¨ä»¶éæ©ä¸åæ°è®¡ç®ãçµè·¯è°è¯æ¹æ³ä¸ç»æ说æï¼
软件设计说æ书ä¸æµç¨å¾ã软件æºç¨åºä»£ç ã软件è°è¯æ¹æ³ä¸è¿è¡ç»æ说æã
æ ¹æ®è®¾è®¡è¦æ±ï¼ç³»ç»çè¾å ¥ä¿¡å·clkï¼è®¡ä»·å¼å§ä¿¡å·startï¼çå¾ ä¿¡å·stopï¼éç¨èå²ä¿¡å·finãç³»ç»çè¾åºä¿¡å·æï¼æ»è´¹ç¨æ°C0âc3ï¼è¡é©¶è·ç¦»k0âk1ï¼çå¾ æ¶é´m0âm1çãç³»ç»æ两个èå²è¾å ¥ä¿¡å·clk_k,fin,å ¶ä¸clk_kå°æ ¹æ®è®¾è®¡è¦æ±åé¢æhzï¼hzå1hzåå«ä½ä¸ºå ¬é计费åè¶ æ¶è®¡è´¹çèå²ã两个æ§å¶è¾å ¥å¼å ³startï¼stopï¼æ§å¶è¿ç¨ä¸ºï¼startä½ä¸ºè®¡è´¹å¼å§çå¼å ³ï¼å½start为é«çµå¹³æ¶ï¼ç³»ç»å¼å§æ ¹æ®è¾å ¥çæ åµè®¡è´¹ãå½æä¹å®¢ä¸è½¦å¹¶å¼å§è¡é©¶æ¶ï¼finèå²å°æ¥ï¼è¿è¡è¡é©¶è®¡è´¹ï¼æ¤æ¶çstopéè¦ç½®ä¸º0ï¼å¦éå车çå¾ ï¼å°±æstopå为é«çµå¹³ï¼
并å»é¤finè¾å ¥èå²ï¼è¿è¡çå¾ è®¡è´¹ï¼å½ä¹å®¢ä¸è½¦ä¸ä¸çå¾ æ¶ï¼ç´æ¥å°start置为0ï¼ç³»ç»åæ¢å·¥ä½ï¼ä»·æ ¼å¼å§å½ä¸ºèµ·æ¥ä»·5.0å ã
æ´ä¸ªè®¾è®¡ç±åé¢æ¨¡åï¼è®¡é模åï¼è®¡è´¹æ¨¡åï¼æ§å¶æ¨¡ååæ¾ç¤ºæ¨¡åäºä¸ªé¨åç»æã
å ¶ä¸è®¡é模åæ¯æ´ä¸ªç³»ç»å®ç°éç¨è®¡æ°åæ¶é´è®¡æ°çéè¦é¨åï¼æ§å¶æ¨¡åæ¯å®ç°ä¸å计费æ¹å¼çéæ©é¨åï¼æ ¹æ®æ设计ç使è½ç«¯éæ©æ¯æ ¹æ®éç¨è®¡è´¹è¿æ¯æ ¹æ®çå¾ æ¶é´è®¡è´¹ï¼åæ¶è®¾è®¡éè¿åé¢æ¨¡å产çä¸åé¢ççèå²ä¿¡å·æ¥å®ç°ç³»ç»ç计费ã计é模åéç¨1hzç驱å¨ä¿¡å·ï¼è®¡è´¹æ¨¡åéç¨hzï¼hzç驱å¨ä¿¡å·ï¼è®¡é模åæ¯è®¡æ°ä¸æ¬¡ï¼è®¡é模åå°±å®ç°æ¬¡æè 次计æ°ï¼å³ä¸ºå®ç°è®¡æ¶ç1.3å /minï¼è®¡ç¨æ¶ç1.4å /kmçæ¶è´¹ãç»ææ¡å¾å¦ä¸æ示ï¼
1.ç¾è¿å¶æ¨¡åï¼
å®ç°ç¾ç±³èå²ç驱å¨ä¿¡å·ï¼å 件æ¡å¾å¦å¾3æ示ï¼
å¾3 ç¾è¿å¶æ¨¡åæ¡å¾
æºç¨åºå¦ä¸ï¼
library ieee;
use ieee.std_logic_.all;
use ieee.std_logic_unsigned.all;
entity baijinzhi is
port(start,clk2: in std_logic; --ç§èå²
a: out std_logic_vector(3 downto 0));
end baijinzhi;
architecture rt1 of baijinzhi is
signal count_1:std_logic_vector(3 downto 0);
begin
a<=count_1;
process(start,clk2)
begin
if(start='0')then
count_1<="";
elsif(clk2'event and clk2='1')then
if(count_1="")then
count_1<="";
else
count_1<=count_1+'1';
end if;
end if;
end process;
end rt1
2.计费模å
; å®ç°éç¨åçåæ¶é´ç计费并è¾åºå°æ¾ç¤ºï¼å 件æ¡å¾4å¦ä¸ï¼
å¾4 计费模åæ¡å¾
æºç¨åºå¦ä¸ï¼
Library IEEE;
use IEEE.std_logic_.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity jifei is
port(clk2:in std_logic; --计费驱å¨ä¿¡å·
start:in std_logic; --计费å¼å§ä¿¡å·
c0,c1,c2,c3:buffer std_logic_vector(3 downto 0));
end jifei;
architecture rt1 of jifei is
begin
process(clk2,start)
begin
if start='0'then c3<="";c2<="";c1<="";c0<=""; --èµ·æ¥ä»·5å
elsif clk2'event and clk2='1'then
if c0="" then c0<="";
if c1="" then c1<="";
if c2="" then c2<="";
if c3="" then c3<="";
else c3<=c3+1;
end if;
else c2<=c2+1;
end if;
else c1<=c1+1;
end if;
else c0<=c0+1;
end if;
end if;
end process;
end rt1;
3.å ¬é模å
å®ç°åç¨ç计æ°åè¾åºè®¡è´¹èå²ï¼å 件æ¡å¾5å¦ä¸ï¼
å¾5 å ¬é模åæ¡å¾
æºç¨åºå¦ä¸ï¼
library ieee;
use ieee.std_logic_.all;
use ieee.std_logic_unsigned.all;
entity gongli is
port(clk1,start: in std_logic; --ç¾ç±³èå²
k1,k2,k3,k4: out std_logic_vector(3 downto 0); --éç¨æ¾ç¤º
temp2 : out std_logic);
end gongli;
architecture rt1 of gongli is
signal count_1: std_logic_vector(3 downto 0);
signal count_2: std_logic_vector(3 downto 0);
signal count_3: std_logic_vector(3 downto 0);
signal count_4: std_logic_vector(3 downto 0);
begin
k1<=count_1;
k2<=count_2;
k3<=count_3;
k4<=count_4;
process(start,clk1)
begin
if(start='0')then
count_1<="";
count_2<="";
count_3<="";
count_4<=""; ---å ¬éæ¸ é¶
elsif(clk1'event and clk1='1')then
if(count_1="")then --å ¬é计æ°å¨
count_1<="";count_2<=count_2+1;temp2<='1';
if(count_2="")then
count_2<="";count_3<=count_3+'1';
if(count_3="")then
count_3<="";count_4<=count_4+'1';
end if;
end if;
else
count_1<=count_1+'1';temp2<='0';
end if;
end if;
end process;
end rt1;
4.è¾åºæ¨¡å
å®ç°æææ°æ®çè¾åºï¼å 件æ¡å¾6å¦ä¸ï¼
å¾6 è¾åºæ¨¡åæ¡å¾
æºç¨åºå¦ä¸ï¼
library ieee;
use ieee.std_logic_.all;
use ieee.std_logic_unsigned.all;
entity shuchu is
port(y: in std_logic_vector(3 downto 0);
e: out std_logic_vector(6 downto 0));
end shuchu;
architecture rt1of shuchu is
begin
process
begin
case y is
when""=>e<="";
when""=>e<="";
when""=>e<="";
when""=>e<="";
when""=>e<="";
when""=>e<="";
when""=>e<="";
when""=>e<="";
when""=>e<="";
when""=>e<="";
when others=>e<="";
end case;
end process;
end rt1;
5.æ¾ç¤ºæ¨¡å
å®ç°æææ°æ®çæ¾ç¤ºï¼å 件æ¡å¾7å¦ä¸ï¼
å¾7 æ¾ç¤ºæ¨¡åæ¡å¾
æºç¨åºå¦ä¸ï¼
library ieee;
use ieee.std_logic_.all;
use ieee.std_logic_unsigned.all;
entity xianshi is
port(start: in std_logic;
a:in std_logic_vector(3 downto 0); --éæ©ä¿¡å·
c1,c2,c3,c4,out1,out2,out3,out4:in std_logic_vector(3 downto 0); --éç¨æ¾ç¤º,æ¶é´æ¾ç¤ºè¾å ¥
y:out std_logic_vector(3 downto 0)); --éç¨æ¾ç¤º,æ¶é´æ¾ç¤ºè¾åº
end xianshi;
architecture rt1 of xianshi is
begin
process
begin
if(start='0')then
y<="";
else case a is
when ""=> y<=c1 ;
when ""=> y<=c2 ;
when ""=> y<=c3 ;
when ""=> y<=c4 ;
when ""=> y<=out1 ;
when ""=> y<=out2;
when ""=> y<=out3 ;
when ""=> y<=out4;
when others =>y<= "";
end case;
end if;
end process;
end rt1;
6.dian模å
å¾8 dian模åæ¡å¾
æºç¨åºå¦ä¸ï¼
library ieee;
use ieee.std_logic_.all;
use ieee.std_logic_unsigned.all;
entity dian is
port(a: in std_logic_vector(3 downto 0);
e: out std_logic);
end dian;
architecture rt1 of dian is
begin
process
begin
case a is
when ""=>e<='1';
when ""=>e<='1';
when others=>e<='0';
end case;
end process;
end rt1;
ä¸ãä¸å个模å设计åæ
ç³»ç»æ»ä½é¡¶å±æ¡å¾å¦ä¸ï¼
ç³»ç»æ»ä½é¡¶å±æ¡å¾
ç¨åºæç»åè½å®ç°æ³¢å½¢ä»¿ç
1. åé¢æ¨¡å
ç±äºå®éªç®±ä¸æ²¡æhzåhzçæ´æ°åæ¶éä¿¡å·ï¼å æ¤éç¨é¢çè¾å¤§çkhzè¿è¡åé¢ï¼ä»¥è¿ä¼¼å¾å°hzï¼hzå1hzçæ¶éé¢çãéè¿ä»¥ä¸ä¸ç§ä¸åé¢ççèå²ä¿¡å·å®è¡åºç§è½¦è¡é©¶ï¼çå¾ ä¸¤ç§æ åµä¸çä¸å计费ã模åå 件å¦ä¸ï¼
åé¢æ¨¡åæ¡å¾
æºç¨åºå¦ä¸ï¼
Library IEEE;
use IEEE.std_logic_.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity fenpin is
port(clk_k:in std_logic; --ç³»ç»æ¶é
clk_:buffer std_logic; --åé¢
clk_:buffer std_logic; --åé¢
clk_1 : buffer std_logic); --1åé¢
end fenpin ;
architecture rt1 of fenpin is
signal q_:integer range 0 to ; --å®ä¹ä¸é´ä¿¡å·é
signal q_:integer range 0 to ;
signal q_1:integer range 0 to ;
begin
process(clk_k)
begin
If(clk_k' event and clk_k='1')then
If q_= then q_<=0;clk_<=not clk_;
else q_<=q_+1;
end if; --å¾hzé¢çä¿¡å·
If q_= then q_<=0;clk_<=not clk_;
else q_<=q_+1;
end if; --å¾hzé¢çä¿¡å·
If q_1= then q_1<=0;clk_1<=not clk_1;
else q_1<=q_1+1;
end if; --å¾1hzé¢çä¿¡å·
end if;
end process;
end rt1ï¼
2. 计é模å
计é模å主è¦å®æ计æ¶å计ç¨åè½ã
计æ¶é¨åï¼è®¡ç®ä¹å®¢ççå¾ ç´¯ç§¯æ¶é´ï¼å½çå¾ æ¶é´å¤§äº2minæ¶ï¼æ¬æ¨¡åä¸en1使è½ä¿¡å·å为1ï¼å½clk1æ¯æ¥ä¸ä¸ªä¸å沿ï¼è®¡æ¶å¨å°±èªå¢1ï¼è®¡æ¶å¨çéç¨ä¸ºminï¼æ»¡éç¨åèªå¨å½é¶ã
计ç¨é¨åï¼è®¡ç®ä¹å®¢æè¡é©¶çå ¬éæ°ï¼å½è¡é©¶éç¨å¤§äº2kmæ¶ï¼æ¬æ¨¡åä¸en0使è½ä¿¡å·å为1ï¼å½clkæ¯æ¥ä¸ä¸ªä¸å沿ï¼è®¡ç¨å¨å°±èªå¢1ï¼è®¡ç¨å¨çéç¨ä¸ºkmï¼æ»¡éç¨åèªå¨å½é¶ã
å 件æ¡å¾ä¸ºï¼
计é模åæ¡å¾
计é模å仿ç波形为ï¼
æºç¨åºå¦ä¸ï¼
library ieee;
use ieee.std_logic_.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity jiliang is
port(start:in std_logic; --计费å¼å§ä¿¡å·
fin:in std_logic; --éç¨èå²ä¿¡å·
stop:in std_logic; --è¡é©¶ä¸éçå¾ ä¿¡å·
clk1:in std_logic; --驱å¨èå²
en1,en0:buffer std_logic; --计费å价使è½ä¿¡å·
k1,k0:buffer std_logic_vector(3 downto 0); --è¡é©¶å ¬é计æ°
m1,m0:buffer std_logic_vector(3 downto 0)); --çå¾ æ¶é´è®¡æ°
end jiliang;
architecture rt2 of jiliang is
signal w:integer range 0 to ; --计æ¶èå´0~
begin
process(clk1)
begin
if(clk1'event and clk1='1')then
if start='0' then
w<=0;en1<='0';en0<='0';m1<="";
m0<="";k1<="";k0<="";
elsif stop='1' then --计æ¶å¼å§ä¿¡å·
if w= then
w<=0;
else w<=w+1;
end if;
if m0="" then
m0<="";
if m1="" then
m1<="";
else m1<=m1+1;
end if;
else m0<=m0+1;
end if;
if stop='1' then en0<='0';
if m1&m0>"" then en1<='1'; --è¥çå¾ æ¶é´å¤§äº2minåen1ç½®1
else en1<='0';
end if;
end if;
elsif fin='1' then --éç¨è®¡æ°å¼å§
if k0="" then k0<="";
if k1="" then k1<=""; --计ç¨èå´0~
else k1<=k1+1;
end if;
else k0<=k0+1;
end if;
if stop='0' then
en1<='0';
if k1&k0>"" then
en0<='1'; --è¥è¡ä½¿éç¨å¤§äº2kmï¼åen0ç½®1
else en0<='0';
end if;
end if;
end if;
end if;
end process;
end rt2;
3. æ§å¶æ¨¡å
æ¬æ¨¡å主è¦æ¯éè¿è®¡é模å产çç两个ä¸åçè¾å ¥ä½¿è½ä¿¡å·en0ï¼en1ï¼å¯¹æ¯ä¸ªåé¢æ¨¡åè¾åºçhzï¼hzçèå²è¿è¡éæ©è¾åºçè¿ç¨ï¼æ¬æ¨¡åå®ç°äºåèå²çäºéä¸ï¼æç»ç®ç为äºè®¡è´¹æ¨¡åä¸å¯¹è¡é©¶è¿ç¨ä¸ä¸åçæ¶æ®µè¿è¡è®¡ä»·ã
模åå 件å¦ä¸ï¼
æ§å¶æ¨¡åæ¡å¾
æ§å¶æ¨¡å仿ç波形为ï¼
æºç¨åºå¦ä¸ï¼
Library IEEE;
use IEEE.std_logic_.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity kongzhi is
port(en0,en1:in std_logic; --使è½éæ©ä¿¡å·
clk_in1:in std_logic; --åé¢è¾å ¥ä¿¡å·
clk_in2:in std_logic; --åé¢è¾å ¥ä¿¡å·
clk_out:out std_logic); --è¾åºä¿¡å·
end kongzhi;
architecture rt3 of kongzhi is
begin
process(en0,en1)
begin
if en0='1' then --å®ç°äºéä¸åè½
clk_out<=clk_in1;
elsif en1='1' then
clk_out<=clk_in2;
end if;
end process;
end rt3;
4.计费模å
å½è®¡è´¹ä¿¡å·startä¸ç´å¤äºé«çµå¹³å³è®¡è´¹ç¶ææ¶ï¼æ¬æ¨¡åæ ¹æ®æ§å¶æ¨¡åéæ©åºçä¿¡å·ä»è对ä¸åçåä»·æ¶æ®µè¿è¡è®¡è´¹ãå³è¡ç¨å¨2kmå ï¼èä¸çå¾ ç´¯è®¡æ¶é´å°äº2minå为起æ¥ä»·5å ï¼2kmå¤ä»¥æ¯å ¬é1.4.å 计费ï¼çå¾ ç´¯ç§¯æ¶é´è¶ è¿2minåææ¯åé1.3å 计费ãc0ï¼c1ï¼c2ï¼c3åå«è¡¨ç¤ºè´¹ç¨çæ¾ç¤ºã
模åå 件为ï¼
计费模åæ¡å¾
计费模å仿ç波形为ï¼
æºç¨åºå¦ä¸ï¼
Library IEEE;
use IEEE.std_logic_.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity jifei is
port(clk2:in std_logic; --计费驱å¨ä¿¡å·
start:in std_logic; --计费å¼å§ä¿¡å·
c0,c1,c2,c3:buffer std_logic_vector(3 downto 0));
end jifei;
architecture rt4 of jifei is
begin
process(clk2,start)
begin
if start='0'then c3<="";c2<="";c1<="";c0<=""; --èµ·æ¥ä»·5å
elsif clk2'event and clk2='1'then
if c0="" then c0<="";
if c1="" then c1<="";
if c2="" then c2<="";
if c3="" then c3<=""; --计价èå´0~.9
else c3<=c3+1;
end if;
else c2<=c2+1;
end if;
else c1<=c1+1;
end if;
else c0<=c0+1;
end if;
end if;
end process;
end rt4;
5.æ¾ç¤ºæ¨¡å
æ¾ç¤ºæ¨¡åå®æ计价ï¼è®¡æ¶å计ç¨æ°æ®æ¾ç¤ºã计费æ°æ®éå ¥æ¾ç¤ºæ¨¡åè¿è¡è¯ç ï¼æåéè³ä»¥ç¾å ï¼åå ï¼å ï¼è§ä¸ºåä½å¯¹åºçæ°ç 管ä¸æ¾ç¤ºã计æ¶æ°æ®éå ¥æ¾ç¤ºæ¨¡åè¿è¡è¯ç ï¼æåéè³ä»¥å为åä½å¯¹åºçæ°ç 管ä¸æ¾ç¤ºã计ç¨æ°æ®éå ¥æ¾ç¤ºæ¨¡åè¿è¡è¯ç ï¼æåéè³ä»¥km为åä½çæ°ç 管ä¸æ¾ç¤ºã
模åå 件为ï¼
æ¾ç¤ºæ¨¡åæ¡å¾
æºç¨åºå¦ä¸ï¼
library ieee;
use ieee.std_logic_.all;
use ieee.std_logic_unsigned.all; --å®ä¹åºå
entity xianshi is --å®ä¹å®ä½
port(
clk_scan:in std_logic; --æ«ææ¶éä¿¡å·ç«¯å£è®¾ç½®
c3,c2,c1,c0:in std_logic_vector(3 downto 0); --æ»è´¹ç¨è¾å ¥ç«¯å£
k0,k1:in std_logic_vector(3 downto 0); --éç¨è¾å ¥ç«¯å£
m0,m1:in std_logic_vector(3 downto 0); --çå¾ æ¶é´è¾å ¥ç«¯å£
sel:out std_logic_vector(2 downto 0); --æ§å¶æ°ç 管ä½éä¿¡å·çæ«æä¿¡å·è¾åºç«¯å£
led:out std_logic_vector(6 downto 0); --æ°ç 管çæ§å¶ç«¯å£
led_dp:out std_logic --æ°ç 管çå°æ°ç¹è¾åºç«¯å£
);
end xianshi;
architecture rt5 of xianshi is
signal duan:std_logic_vector(6 downto 0); --æ°ç æ¾ç¤ºç®¡ä¸é´åé
signal shuju:std_logic_vector(3 downto 0); --éæ©è¾å ¥ç«¯çä¸é´åé
signal cnt:std_logic_vector(2 downto 0); --æ§å¶æ°ç 管çä¸é´åé
signal xiaodian:std_logic; --å°æ°ç¹çä¸é´åé
begin
process(clk_scan) --å¼å§è¿ç¨
begin
if clk_scan'event and clk_scan='1' then
cnt<=cnt+1; --æ¯æä¸ä¸ªæ«æä¿¡å·ä¸å沿å®ç°å 1æ«æ
end if;
end process; --ç»æè¿ç¨
process(cnt) --å¼å§è¿ç¨(éæ©æ«ææ¾ç¤ºæ°ç 管)
begin
case cnt is --æ«ææ¶ç»æ¯ä¸ªæ°ç 管èµå¼
when ""=>shuju<=c0;
when ""=>shuju<=c1;
when ""=>shuju<=c2;
when ""=>shuju<=c3;
when ""=>shuju<=k0;
when ""=>shuju<=k1;
when ""=>shuju<=m0;
when ""=>shuju<=m1;
when others=> null;
end case;
if (cnt="" or cnt="")
then xiaodian<='1'; --å¨éç¨åæ»è´¹ç¨ç个ä½å¤æ¾ç¤ºå°æ°ç¹
else xiaodian<='0';
end if;
end process; --ç»æè¿ç¨
process(shuju) --å¼å§è¿ç¨(è¯ç æ¾ç¤º)
begin
case shuju is
when ""=>duan<=""; --0
when ""=>duan<=""; --1
when ""=>duan<=""; --2
when ""=>duan<=""; --3
when ""=>duan<=""; --4
when ""=>duan<=""; --5
when ""=>duan<=""; --6
when ""=>duan<=""; --7
when ""=>duan<=""; --8
when ""=>duan<=""; --9
when others=>null;
end case;
end process;
sel<=cnt;
led<=duan;
led_dp<=xiaodian;
end rt5;
äºã课ç¨è®¾è®¡å·¥ä½è®°å½ï¼
å æ¬ï¼è®¾è®¡æ¥éª¤ä¸æ¶é´å®æãè°è¯æ¥éª¤ä¸æ¶é´å®æã课é¢å®æç»æ说æ
2.课é¢å®æç»æ说æï¼
æ¤è®¡è´¹å¨è½å®ç°èµ·æ¥ä»·æ¯5å ï¼å®ç°å®éªè¦æ±ç1å ¬é计费ä¸æ¬¡åä»·ï¼è¡é©¶å ¬é大äº2kmæ¶æ¯å ¬éæ1.4å 计费并è½æ¾ç¤ºéç¨åæ»å ±çè´¹ç¨ãå½è¡é©¶äº6å ¬éï¼çå¾ äº4åéæ¶ï¼è´¹ç¨æ¾ç¤ºä¸º.8å ãä¸è®¡ç®å ¬å¼æ»è´¹ç¨=èµ·æ¥è´¹ç¨+ï¼éç¨-2å ¬éï¼*éç¨åä»·+çåæ¶é´*çååä»·ï¼å³.8=5+ï¼6-2ï¼*1.4+4*1.3ãå®éªç»æä¸ç论ç»æå®å ¨ä¸è´ï¼å®éªè®¾è®¡æåã
åºç§è½¦è®¡ä»·å¨
ä¸ãé¢ç®ï¼Aé¢ è®¾è®¡å¹¶å¶ä½ä¸ä¸ªç¨äºåºç§è½¦ç计费系ç»ã
äºã设计è¦æ±
1ãåºæ¬è¦æ±ï¼
ï¼1ï¼å¶ä½ä¸ä¸ªæ¨¡æ车轮ç¨ç´æµçµå¨æºï¼ææ¥è¿çµæºï¼é©±å¨ï¼ç°åºæ¨¡æ以ä¸è¿è¡æ åµçæ¶è´¹æ åµï¼
u å设车轮çå¨é¿ä¸ºä¸ç±³ã
u èµ·æ¥ä»·ä¸ºä¸å ¬éäºå ï¼ç½å¤©æ¯å ¬éä¸å ï¼æä¸æ¯å ¬éåå ã
u è¿è¡äºå ¬éä¹åï¼åä¸åéï¼åè¿è¡äºå ¬éä¹åä¹å®¢ä¸è½¦ï¼ç±äºæ¼ç¤ºçæ¶é´çéè¦ï¼éä¸åè½¦è¶ è¿ä¸åéå¼å§æ¶è´¹ï¼è¶ è¿çæ¶é´æ¯åéä¸å ã
ï¼2ï¼è½å¤æå¨ä¿®æ¹åä»·ã
ï¼3ï¼å ·ææ°æ®çå¤ä½åè½ã
ï¼5ï¼æ°æ®è¾åº
u åä»·è¾åº è³å°2ä½
u è·¯ç¨è¾åº è³å°2ä½
u æ»éé¢è¾åº è³å°3ä½
2ãåæ¥é¨åï¼
ï¼1ï¼è½å¤å¨æçµçæ åµä¸åå¨åä»·çæ°æ®ã
ï¼2ï¼è½å¤æ¾ç¤ºãè°èå½åçç³»ç»æ¶é´ï¼å¹¶æ ¹æ®å½åçç³»ç»æ¶é´è¿è¡è®¡è´¹ï¼6æ¶è³æ¶ä¸ºç½å¤©ï¼æ¶è³ç¬¬äºå¤©6æ¶ä¸ºæä¸ï¼ã
ï¼3ï¼æè¯é³æ¥ä»·åè½ã
1.2 æ¹æ¡æ¯è¾ä¸è®ºè¯
1.2.1æ§å¶å¨æ¨¡å
æ¹æ¡ä¸ï¼éç¨å¯ç¼ç¨é»è¾å¨ä»¶CPLD ä½ä¸ºæ§å¶å¨ãCPLDå¯ä»¥å®ç°åç§å¤æçé»è¾åè½ãè§æ¨¡å¤§ãå¯åº¦é«ãä½ç§¯å°ã稳å®æ§é«ãIOèµæºä¸°å¯ãæäºè¿è¡åè½æ©å±ãéç¨å¹¶è¡çè¾å ¥è¾åºæ¹å¼ï¼æé«äºç³»ç»çå¤çé度ï¼éåä½ä¸ºå¤§è§æ¨¡æ§å¶ç³»ç»çæ§å¶æ ¸å¿ãä½æ¬ç³»ç»ä¸éè¦å¤æçé»è¾åè½ï¼å¯¹æ°æ®çå¤çé度çè¦æ±ä¹ä¸æ¯é常é«ãä¸ä»ä½¿ç¨åç»æµçè§åº¦èèæ们æ¾å¼äºæ¤æ¹æ¡ã
æ¹æ¡äºï¼éç¨åé³å ¬å¸çä½åçæºï¼å®æ¯ä½æ§å¶å¨ï¼å ·æä½ç§¯å°ã驱å¨è½åé«ãéæ度é«ãææ©å±ãå¯é æ§é«ãåèä½ãç»æç®åãä¸æå¤çè½å强çç¹ç¹ãå¤çé度é«ï¼å°¤å ¶éç¨äºè¯é³å¤çåè¯å«çé¢åï¼éç¨æ¤åçæºè½å¤å¾æ¹ä¾¿çå®ç°åæ¥é¨åçè¯é³æ¥ä»·åè½ï¼ä½æ¤åçæºè¾é¾ä¹°å°ï¼èä¸ä»·æ ¼ç¨è´µï¼æ æ¾å¼äºæ¤æ¹æ¡ã
æ¹æ¡ä¸ï¼éç¨Atmelå ¬å¸çATSåçæºä½ä¸ºä¸»æ§å¶å¨ï¼æ¤åçæºæ¯å æ ¸çCMOS 8ä½åçæºï¼çå å«8k空é´çå¯åå¤æ¦äºæ¬¡çFlash读ååå¨å¨ï¼å ·æ bytesçéæºååæ°æ®åå¨å¨ï¼RAMï¼ï¼ä¸ªIOå£ï¼ä½ ç¥éåæ¿è£ ä¿®ååæ ·æ¿ã2个ä½å¯ç¼ç¨å®æ¶è®¡æ°å¨ãå ¶ä»·æ ¼ä½å»ï¼é常éåç¨äºå°ç³»ç»çå¼åï¼å¼éç¨ISPå¨çº¿ç¼ç¨ï¼ç¨åºçä¸è½½åä¿®æ¹ä¹å¾æ¹ä¾¿ãé¢ç®æè¦æ±çç³»ç»å¯¹æ§å¶å¨çè¦æ±ä¸é«ï¼æ们综åå¤æ¹é¢èèéç¨äºæ¤æ¹æ¡ã
1.2.2车轮转éæ¢æµæ¨¡å
æ¹æ¡ä¸ï¼ç¨å æçµé»ç»æå ææ¢æµå¨ãå æçµé»çé»å¼å¯ä»¥è·éå¨å´ç¯å¢å 线çååèååãå½å çº¿ç §å°å°è½¦è½®ç ççç½è²é¨åæ¶ï¼å 线åå°å¼ºçï¼å çº¿ç §å°å°è½¦è½®ç ççé»è²é¨åæ¶ï¼å 线åå°è¾å¼±ãå æ¤å æçµé»å¨ç½è²é¨ååé»è²é¨åä¸æ¹æ¶ï¼é»å¼ä¼åçææ¾çååãå°é»å¼çååå¼ç»è¿æ¯è¾å¨å°±å¯ä»¥è¾åºé«ä½çµå¹³ãæ¤æ¹æ¡æåå¤çå 线çå¹²æ°ã
æ¹æ¡äºï¼éç¨éå°ä¼ æå¨æ为æ¢æµå¨ä»¶ï¼éå°ä¼ æå¨ç两é¨ååå«å®è£ å¨è½¦è½®ååºå®çµè·¯æ¿ä¸ï¼æ ¹æ®è½¦è½®è½¬å¨æ¶å°ååçç£åºå¼ºåº¦è½¬æ¢ä¸ºèå²çµä¿¡å·ï¼æ¤æ¹æ¡è½å¤ä½¿å¯¹è½¦è½®è®¡æ°ç²¾ç¡®ï¼å·¥ä½ç¨³å®ï¼ä½ææ¬è¾é«ã
æ¹æ¡ä¸ï¼éç¨çº¢å¤å¯¹ç®¡ï¼å½çº¢å¤åå°ç®¡åå°åºç红å¤çº¿ç §å°ç ççç½è²é¨ååé»è²é¨åæ¶ï¼å ¶åå°ç红å¤çº¿å¼ºåº¦ä¸åï¼éè¿çº¢å¤æ¥æ¶ç®¡æ¥æ¶åç»çµåæ¯è¾å¨LMæ¯è¾åå³å¯è¾åºé«ä½çµå¹³ãæ¤æ¹æ¡ææ¬ä½ï¼å®¹æå®ç°ï¼ä¸çµæ度è¾é«ã
æ ¹æ®æ¬ç³»ç»ç设计è¦æ±ï¼å¯¹è½¦è½®è½¬éçæ¢æµåå¤ççå¹²æ°è¾å°ï¼èéç¨éç¨çº¢å¤å¯¹ç®¡å·¥ä½çµè·¯ç®åï¼è°è¯æ¹ä¾¿ï¼æ以æ们éæ©æ¤æ¹æ¡ã
1.2.3æ¶éæ§å¶æ¨¡å
æ¹æ¡ä¸ï¼éç¨.MHzçæ¶æ¯äº§çéè¡åç»å¤ä¸ªLSè¿è¡æ¬¡2åé¢ï¼äº§ç精确çç§ä¿¡å·ï¼èªè¡æ建æ¶é´çµè·¯ãæ¤æ¹æ¡å ·æè¾å¥½çååæ§ï¼ä½çµè·¯æ建起æ¥è¾ä¸ºå¤æï¼å·¥ä½ä¸å¤ç¨³å®ï¼ä¹ä¸æ¹ä¾¿è°èã
æ¹æ¡äºï¼ç´æ¥éç¨åçæºå é¨çæ¶éä¿¡å·ãè¿æ ·è½å¤å¤§å¤§ç®å硬件ç设计ï¼ä½æçµåä¸è½å·¥ä½ï¼èä¸å¤§éå ç¨åçæºæéçå åèµæºã
æ¹æ¡ä¸ï¼éç¨DSä¸ç¨æ¶éè¯çãDSæ¯åè½å¼ºå¤§çå®æ¶æ¶éè¯çï¼å ç½®éçµæ± ï¼å ç½®æ¶æ¯ãæä¾äºè¿å¶æ°åBCDç 两ç§æ°æ®è¡¨ç¤ºæ¹å¼ãå¯åæ¢å°æ¶å¶åå°æ¶å¶æ¶é´è¡¨ç¤ºãå ·æé¹éåè½ãå¯ç¼ç¨æ¹æ³¢è¾åºãæä¾åèéæ失åå¨ç©ºé´ï¼ç¨äºæçµä¿åæ°æ®ã
ç±äºæ¬ç³»ç»çå¾å¤åè½é½æ¯åºäºæ¶é´çåºç¡ä¸å®ç°çï¼å æ¤å¯¹æ¶éçè¦æ±è¾é«ï¼æ æ们éæ©æ¹æ¡ä¸ã
1.2.4æ¾ç¤ºæ¨¡å
æ¹æ¡ä¸ï¼ç¨æ°ç 管è¿è¡æ¾ç¤ºãæ°ç 管ç±äºæ¾ç¤ºé度快ï¼ä½¿ç¨ç®åï¼æ¾ç¤ºææç®æ´æäºèå¾å°äºå¹¿æ³åºç¨ï¼ä½æ¾ç¤ºçå å®¹ä» ä» å±éäºæ°åï¼äººæºçé¢ä¸å¤å好å æ¤æ们æ¾å¼äºæ¤æ¹æ¡ã
æ¹æ¡äºï¼ç¨LCD液æ¶è¿è¡æ¾ç¤ºãLCDç±äºå ¶æ¾ç¤ºæ¸ æ°ï¼æ¾ç¤ºå 容丰å¯ãæ¸ æ°ï¼æ¾ç¤ºä¿¡æ¯é大ï¼ä½¿ç¨æ¹ä¾¿ï¼æ¾ç¤ºå¿«éèå¾å°äºå¹¿æ³çåºç¨ãç±äºæ¬æ¤ç³»ç»éè¦æ¾ç¤ºçå 容è¾å¤ï¼ä¸ºè¾¾å°è¾å¥½ç人æºäº¤äºçé¢ï¼æ们éæ©äºæ¤æ¹æ¡ã
1.3æç»éæ©æ¹æ¡
u éç¨ATSåçæºä½ä¸ºä¸»æ§å¶å¨ã
u éç¨çº¢å¤å¯¹ç®¡+LMä½ä¸ºè½¦è½®è½¬éæ¢æµæ¨¡åã
u éç¨DSä½ä¸ºå®æ¶æ¶éæ§å¶è¯çã
u éç¨LCD液æ¶ä½ä¸ºæ¾ç¤ºæ¨¡åã
u éç¨æ®éçç´æµçµæºåèªå¶ç车轮åç çä½ä¸ºæ¨¡æ车轮ã
1.4ç³»ç»ç»æå¾
æé®ï¼
红å¤æåºæ¨¡å
MCU
ATS
DSç³»ç»æ¶é´ï¼æçµä¿åæ°æ®
LCD液æ¶æ¾ç¤º
模æ车轮
å¾1 ç³»ç»ç»ææ¡æ¶
第äºç« :åé¨åçµè·¯åçä¸è®¾è®¡
2.1åçæºä¸»æ§æ¨¡åç设计
Atmelå ¬å¸çATSæ¯å æ ¸çåçæºãä¸ç¨ç§åå¨èåªç¨ä¸²å£æè 并å£å°±å¯ä»¥å¾åçæºä¸ä¸è½½ç¨åºã
æ们æ设计çåçæºæå°ç³»ç»æ¿éç¨çåé¾å ¬å¸ç并å£ä¸è½½æ åï¼ä¸å¨æ¿ä¸çæä¸è½½çº¿æ座ï¼è¿æ ·å¯ä»¥é常æ¹ä¾¿çå®ç°éè¿PCæºç并å£å¾åçæºä¸ä¸è½½ç¨åºãåæ¶å°ç¨³åçµæºé¨åä¹éå¨å ¶ä¸ï¼ç»è¿ç¨³ååç+5Vçµæºä¸ºé¤çµæºå¤çå ¶ä»ç³»ç»æ¨¡åæä¾å·¥ä½çµæºã
åçæºæ§å¶æ¨¡åç示æå¾å¦å¾9æ示ï¼
å¾2 åçæºä¸»æ§æ¨¡å
åçæºçI/Oå£åé å¦ä¸ï¼
P0,P2.5~P2.7 LCD模å
P1,P2.0~P2.3,P3.3 å®æ¶æ¶é模å
P3.0~P3.1,P3.5~P3.7 æé®å¼å ³
P3.2 红å¤æ¢æµæ¨¡å
2.2红å¤æ¢æµæ¨¡åç设计
æ们éè¿å°çº¢å¤æ¥æ¶äºæ管çä¸ååéä¸åºåçµåéå ¥çµåæ¯è¾å¨LMè¿è¡æ¯è¾ï¼è¾åºå¯¹åºçé«ä½çµå¹³ä¿¡å·ï¼éå°åçæºè¿è¡å¤çãå ¶çµè·¯åçå¾å¦ä¸ï¼
å¾3 红å¤æ¢æµæ¨¡å
å¨å¾3ä¸ï¼å¯è°çµé»RWå¯ä»¥è°èæ¯è¾å¨çé¨éçµåï¼ç»ç¤ºæ³¢å¨è§å¯ï¼è¾åºæ³¢å½¢ç¸å½è§åï¼å¯ä»¥ç´æ¥å¤åçæºæ¥è¯¢ä½¿ç¨ã
ç±äºæ们çç çéç¨äºåæ³è¿è¡è®¾è®¡ï¼é»ç½ä¸¤ç§é¢è²åå åå¨çä¸åï¼å æ¤åçæºæ¯æ¥æ¶å°ä¸ä¸ªé«çµå¹³ä¿¡å·å模æ车轮转äºä¸åï¼éè¿è®¡ç®æ¯ç§éåçæºæ¥æ¶å°çé«çµå¹³ä¿¡å·ä¸ªæ°å³å¯æ¹ä¾¿ç计ç®åºè½¦è½®çé度åæèµ°çéç¨ã
2.3模æ车轮ç设计
å°è½¦çé度åéç¨çæµéæ¯éè¿å çµå¯¹ç®¡æ£æµç çå®ç°çãæ们éç¨æ®éçç´æµçµæºåç©å ·è½¦ç车轮ï¼èªå¶ç çï¼åæ模æ车轮ï¼ä¾æµéç¨ã
èèå°çµæºè¿è¡æ¶å¯¹çµåçå¹²æ°ï¼çµæºççµæºç´æ¥ç±è¾å ¥çæªç»è¿ç¨³åççµæºæä¾ï¼è¯ç¨æ解é¤å³å¨ååã并设ç«ç¬ç«çå¼å ³ï¼æ人工æ§å¶ï¼è¿æ ·æ´ç¬¦åå®é çå·¥ä½æ åµã
为é²æ¢å çµç®¡äº§ç误å¨ä½ï¼æ们å°å çµç çå为2份é»ç½ç¸é´çåçï¼æ¯ä»½åå åå¨çä¸åï¼å¦å¾4ï¼
å¾4 模æ车轮ç ç
å°å ¶ç´§è´´å¨è½¦è½®çå 侧ãå¨å°è£ çå³ä¾§æä¸ä¸ªæ¹åï¼çº¢å¤å¯¹ç®¡éè¿æ¹å对å çµç çè¿è¡æ£æµå°±å¯ä»¥å¾å°è½¦è½®è½¬è¿çåæ°ãä»è计ç®åºå°è½¦åè¿çè·¯ç¨ã
æ¬ç³»ç»å设车轮çå¨é¿ä¸º1ç±³ï¼å设åçæºæ¯ç§æ£æµå°é»ç½ä¿¡å·çåå为nï¼å ±èµ°äºkç§åå°è½¦èµ°è¿çè·¯ç¨ä¸ºSï¼nkç±³ã
2.4å®æ¶æ¶éæ§å¶æ¨¡åç设计
æ们éç¨çDSåè½å¼ºå¤§ï¼å ç½®éçµæ± ï¼å ç½®æ¶æ¯ï¼å¯ä»¥ä½ä¸ºå®æ¶çµåéï¼ä¸ºæ´ä¸ªç³»ç»æä¾æ¶éï¼å¾å¥½å°è§£å³äºé¢ç®åæ¥é¨åâè½å¤æ¾ç¤ºãè°èå½åçç³»ç»æ¶é´ï¼å¹¶æ ¹æ®å½åçç³»ç»æ¶é´è¿è¡è®¡è´¹ï¼6æ¶è³æ¶ä¸ºç½å¤©ï¼æ¶è³ç¬¬äºå¤©6æ¶ä¸ºæä¸ï¼âçè¦æ±ãåæ¶å©ç¨å ¶é¹éåè½å¯¹æ¢æµä¿¡å·è¿è¡éæ ·ï¼ç²¾ç¡®ç计ç®åºè½¦éãç±äºè¯çè¿æä¾åèéæ失åå¨ç©ºé´ï¼å æ¤æ们å°é¢ç®è¦æ±çåç§ä»·æ ¼ç设置æ¹ä¾¿çä¿åå¨éé¢ï¼è¾¾å°æçµä¿åæ°æ®çåè½ã
å¾5 æ¶é模åçµè·¯å¾
2.5人æºäº¤äºçé¢ç设计
为使系ç»ææ´è¯å¥½ç人æºäº¤äºçé¢ï¼æ们å°LCD液æ¶æ¾ç¤ºæ¨¡åï¼æä½æé®ï¼ç³»ç»å¤ä½å¼å ³å车轮æ§å¶å¼å ³éä¸äºå°è£ ççé¢æ¿ä¸ï¼æ¹ä¾¿ç¨æ·æä½ï¼å¦ä¸å¾ï¼
å¾6 人æºäº¤äºçé¢
2.6ç³»ç»æ»ä½çµè·¯å¾
å¾7 ç³»ç»æ»çµè·¯å¾
å¾8 ç³»ç»è£ ç®±åçå é¨å®ç©å¾
第ä¸ç« ï¼ç³»ç»ç¨åºè®¾è®¡
3.1ç³»ç»ç¨åºæå®ç°çåè½
u å®æ¶æ¾ç¤ºæ»éé¢ï¼æ»éç¨ï¼è½¦éï¼å·²èµ°è¿æ¶é´ï¼ç³»ç»æ¶é´ã
u å¯å¨çº¿ä¿®æ¹ç³»ç»æ¶é´ã
u å¯ä¿®æ¹èµ·æ¥ä»·åèµ·æ¥è·ç¦»ã
u å¯ä¿®æ¹æ¯è¶ è¿ä¸å ¬éå æ¶è´¹ç¨ã
u å¯ä¿®æ¹éä¸åè½¦è¶ è¿æ¶é´å¼å§æ¶è´¹çæ¶é´ååä»·ã
3.2ç¨åºä»»å¡åé
表1 ç¨åºä»»å¡åé
å¤é¨ä¸æ0ï¼æ¥èªè½¦è½®ï¼
å¤é¨ä¸æ1ï¼æ¥èªæ¶éï¼
主å½æ°
æ´æ°è·¯ç¨ï¼å æ»ä»·ï¼å¤ä½è®¡æ¶å¨ï¼å¦ææ¾ç¤ºå±ä½¿ç¨æå¨INT0ï¼å°±æ´æ°æ¾ç¤ºã
æ¾ç¤ºå±ä½¿ç¨æç¨screenåé表示ã
计ç®é度ï¼è®¡ç®è¡è½¦æ¶é´ï¼è®¡æ¶å¹¶å¨åè½¦è¶ æ¶åå é±ãæ ¹æ®æ¾ç¤ºå±ä½¿ç¨æå¤ææ¯å¦æ´æ°æ¾ç¤ºã
æ ¹æ®real_timeåéçå¼å³å®æ¯å¦æç³»ç»æ¶é´æ´æ°å°å±å¹ä¸ã
读åæé®ãå³å®æ§å¶é»è¾ã
3.3主ç¨åºæµç¨å¾
å¼å§
åå§åLCDãå®æ¶æ¶é
ä»åå¨å¨è¯»åºåä»·çæ°æ®
æ¾ç¤ºlogo
ä»»æé®
空é²ç¶æï¼æ¾ç¤ºç³»ç»æ¶é´
æé®æä¸
空é²ç¶æ
计费ç¶æ
设置�
N
Y
设置
çå¾ æé®
æ¯2é®?
N
Y
åå§å计费å±å¹ï¼è¿å ¥è®¡è´¹ç¶æ
æ¯3é®
Y
æ¥çç³»ç»æ¶é´ï¼å»¶æ¶4ç§
N
æ¯4é®?
Y
åæ¢è®¡è´¹ï¼è¿å ¥ç©ºé²ç¶æ
N
æä¸2é®å¤ä½
3.4åæ°æ®å¨ä¸åå¨å°å
表2 åæ°æ®å¨ä¸åå¨å°å
å°å
åé
åè½
0x0e
d
//èµ·æ¥ä»· d å ¬é p è§
0x0f
p
0x
day_price
//ç½å¤©æ¯å ¬éä»·æ ¼ï¼åä½ï¼è§
0x
night_price
//å¤ææ¯å ¬éä»·æ ¼ï¼åä½ï¼è§
0x
x
//ä¸éåè½¦è¶ è¿yåéä¹åæxè§æ¯åé计价
0x
y
3.5ä¸ææå¡0ç¨åºæµç¨å¾
触åä¸æ
è·¯ç¨å ä¸ç±³
å 许使ç¨æ¾ç¤ºå±?
计æ¶å¨å¤ä½
è·¯ç¨ï¼ï¼èµ·æ¥è·¯ç¨ï¼
è·¯ç¨>èµ·æ¥è·¯ç¨ï¼
Y
N
Y
æ´æ°è·¯ç¨æ¾ç¤º
åæ»éé¢å ä¸å ¬éä»·
N
æ´æ°æ»éé¢æ¾ç¤º
Y
N
Y
å ¬é计ç¨å¨å¤ä½
ä¸æ2æå¡ç¨åºçtimer_stateåtimer_countåé
counter_åé
å ¬é计ç¨å¨å 1
å ¬é计ç¨å¨ï¼ï¼?
ç»æ
N
Y
åæ»éé¢å ä¸å ¬éä»·
å 许使ç¨æ¾ç¤ºå±?
æ´æ°æ»éé¢æ¾ç¤º
Y
N
å ¬é计ç¨å¨å¤ä½
0å·ä¸ææå¡ç¨åºï¼
车轮转å¨ä¸å触åä¸æ¬¡
3.6 ä¸ææå¡2ç¨åºæµç¨å¾
触åä¸æ
ç³»ç»å¨è®¡è´¹ç¶æï¼
Y
N
éè¦åæ¥æ¶é´ï¼
Y
N
ç»æ
é度=ç°å¨çè·¯ç¨âä¸ç§ä¹åçè·¯ç¨
è¡è½¦æ¶é´å ä¸ç§
计æ¶å¨å ä¸ç§
计æ¶çäºæ大å车æ¶é´ï¼
N
æ»éé¢å æ¯åéä»·
è¿å ¥åè½¦è¶ æ¶ç¶æ
Y
åè½¦è¶ æ¶ç¶æï¼
Y
æ¯åéå é±
N
å°ç³»ç»æ¶é´åæ¥æåæ¥å°å±å¹ä¸
2å·ä¸ææå¡ç¨åºï¼
æ¯ç§é触åä¸æ¬¡
第åç« :ç³»ç»è°è¯ç»æä¸åæ
4.1è°è¯æ¹æ³ä¸ä»ªå¨
表3 æµè¯ä»ªå¨è®¾å¤æ¸ å
仪å¨å称
åå·
ç¨é
æ°é
PCæº
èæ³
è°è¯åä¸è½½ç¨åº
1
æ°åä¸ç¨è¡¨
UNI-TA
æµéåçµè·¯å·¥ä½æ åµ
1
ç§è¡¨
è®°å½æ¶é´
1
ç´æµç¨³åçµæº
ALKIMIA
æä¾çµæº
1
4.2è°è¯æ¥éª¤ä¸æµè¯æ°æ®
4.2.1ç³»ç»æ¶é´ä¸ç§è¡¨å®é æ¶é´æµé
å¼æºåæâå¼å§âé®è¿å ¥è®¡æ¶å·¥ä½ç¶æï¼åæ¶å¯å¨ç§è¡¨è¿è¡åæ¶å¯¹æ¯ï¼åå«å¯¹å·¥ä½æ¶é´ä¸º1åéï¼2åéï¼3åéï¼4åéï¼5åéè¿è¡æµéæ¯è¾ï¼ç»æå¦è¡¨2
表4 ç³»ç»æ¶é´æµè¯æ¯è¾
æµè¯æ¶é´
ç³»ç»æ¾ç¤ºæ¶é´
ç§è¡¨æµéæ¶é´
s
s
.s
s
s
.s
s
s
.s
s
s
.s
s
s
.s
4.2..2车轮转éæµè¯
æ¬ç³»ç»ç设计对æ¢æµä¿¡å·çä¸é沿è¿è¡è§¦åï¼å æ¤å½çº¢å¤å¯¹ç®¡æ¢æµå°çç çä»ç½è²è½¬ä¸ºé»è²æ¶ï¼åçæºä¸æ触åï¼è®¡æ°å¨å ä¸ã
å¯å¨è®¡è´¹ç³»ç»ï¼åæ¶æ工转å¨è½¦è½®ä¸å¨ï¼æ¾ç¤ºå±ä¸è·¯ç¨æ¾ç¤º1mï¼å¨è½¬å¨è½¦è½®å åï¼LCDçæ¾ç¤ºæ°å¼åä¸å®é ç¸ç¬¦ã
4.2.3计费系ç»æµè¯
表5 ä¸åæ åµä¸ç计费ç»ææµè¯
计费æ¶é´æ®µ
è¡é©¶éç¨
è¡é©¶æ¶é´
ä¸éå车æ¶é´
è®¡è´¹ä»·æ ¼
ç½å¤©
m
s
0
5.0å
ç½å¤©
m
s
0
.0å
æä¸
m
s
0
.0å
æä¸
m
s
s
.0å
4.2.4æ°æ®è®¾å®åæçµå¨ååè½
å¨å¾ æºç¶æä¸æâ设置âé®ï¼åå«ä¿®æ¹èµ·æ¥ä»·4kmå 8å ï¼ç½å¤©æ¯å ¬é5å ï¼æä¸æ¯å ¬é7å ï¼ä¿®æ¹ç³»ç»æ¶é´ï¼ç¶åä¿åï¼å ³æºï¼æå¼çµæºï¼çå¾ 5åéä¹åéæ°å¼æºï¼åç°æ°æ®ä¸ºä¿®æ¹åçæ°æ®ï¼å³æ°æ®ç设å®åæçµå¨ååè½ææã
4.3æµè¯ç»æåæ
éè¿è°è¯åç³»ç»æµè¯ï¼åç°ç³»ç»è½å¾å¥½å°å®ç°é¢æçç®çï¼å®ç°äºé¤è¯é³åè½å¤çå ¶ä»ææåè½ï¼å·¥ä½æ§è½ç¨³å®ï¼è®¡è´¹ç²¾ç¡®ãç³»ç»æ¶é´å®æ¶è¿è¡ï¼åç¡®ï¼éç¨çæ¾ç¤ºè¯¯å·®å¨1m以å ãå¾å¥½çå®æäºèµé¢çè¦æ±ã
第äºç« ï¼ç³»ç»æ§è½æ»ç»åç¹ç¹
5.1 å®ç°åºæ¬è¦æ±åè½
表4 åºæ¬åè½çå®ç°æ åµ
åºæ¬è¦æ±åè½
åè½å®ç°æ åµ
åºæ¬è¦æ±ç¬¬ï¼1ï¼é¡¹
å®ç°
åºæ¬è¦æ±ç¬¬ï¼2ï¼é¡¹
å®ç°
åºæ¬è¦æ±ç¬¬ï¼3ï¼é¡¹
å®ç°
åºæ¬è¦æ±ç¬¬ï¼4ï¼é¡¹
å®ç°
åºæ¬è¦æ±ç¬¬ï¼5ï¼é¡¹
å®ç°
5.2 å®ç°åæ¥é¨ååè½
表5 åæ¥åè½çå®ç°æ åµ
åæ¥è¦æ±åè½
åè½å®ç°æ åµ
åæ¥è¦æ±ç¬¬ï¼1ï¼é¡¹
å®ç°
åæ¥è¦æ±ç¬¬ï¼2ï¼é¡¹
å®ç°
åæ¥è¦æ±ç¬¬ï¼3ï¼é¡¹
æªå®ç°
5.3 å¢å çå ¶ä»åè½
u ä¸è®¡è´¹ç³»ç»ç¸å ³çææåæ°ç¨æ·åå¯ä¿®æ¹å¹¶å¨åã
u å ¼æä¸å¹´ååæ°åçµåéåè½ã
u ä¸ä½å人æºäº¤äºçé¢æ§å¶é¢æ¿ï¼ç¡¬ä»¶ç³»è£ ç®±ï¼æé«æºæ¢°å¼ºåº¦ï¼å®å ¨æ§è½åç¾è§åº¦ã
第å ç« ï¼éå½
éå½ä¸ ç³»ç»ç¨åºæºä»£ç
/