资源描述:
《软件设计-程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、附录:基于单片机的出租车计价器软件设计的源程序代码//============================================================//工程名称:Taxi//功能描述:实现现行出租车计价器的基本功能//涉及的库:CMacro.lib//SACMV26e.lib//组成文件:main.c,ConstValues.c,ConstValues.h,//Cal.c,Cal.h,Cost.c,Cost.h,Distance.c,Distance.h,//InterFace.c,InterFace.
2、h,PicResource.c,PicResource.h,Speed.c,Speed.h//DataOSforLCD.asm,SPLC501Driver_IO.asm,SPLC501User.c,SPLC501User.h,SPLC501Driver_IO.inc//DrvKEY.c,DrvKey.h,KEY.c,KEY.h//hardware.asm,PlaySnd.c,PlaySnd.h,PlayService.c,PlayService.h//isr.asm,SetInterruptStatus.asm,SetInter
3、ruptStatus.h,spce061a.h,spce061a.inc//FloatToBin.asm,FloatToBin.h,TypeOS.h//硬件连接://SPLC501液晶模组61板//D0~D7<-->IOA8~IOA15//A0<-->IOB3//R/W<-->IOB4//EP<-->IOB5//将61板的IOB2与IOB9相连//====================================
4、===========#include".KEYKey.h"#include"Cal.h"#include"Cost.h"#include"Speed.h"#include"InterFace.h"-79-#include"PlayService.h"#include"SetInterruptS
5、tatus.h"#include"Distance.h"#include"PlaySnd.h"StatusSysStatus;//系统状态//Status结构体在InterFace.h中定义//============================================================//语法格式:intmain(void)//实现功能:主函数//参数:无//返回值:无//====================
6、========================================intmain(){unsignedintKey,KeyType;SysStatus=IDLE;KeyScan_Init();SetINTStatus(C_IRQ5_2Hz);SetINTStatus(C_IRQ4_1KHz);__asm("IRQON");InterFace_Init();//初始化用户界面InterFace_Normal();//显示常规界面InterFace_UpdateStatus(SysS
7、tatus);//显示当前系统状态(空车)while(1){Key=KeyScan_GetKey(&KeyType);//按键扫描switch(Key){caseC_StartStopKey:-79-if(C_SReleaseKeyState==KeyType){if(IDLE==SysStatus){SysStatus=RUN;//如果是空车状态,则进入行驶状态Cost_StartRunning();//启动计费InterFace_UpdatePrice();InterFace_UpdateStatus(Sys
8、Status);//更新显示PlaySnd(Cal_GetHello(Cal_GetHour())+VOICE_MORNING,NO_WAIT);PlaySnd(VOICE_WELCOM,WAIT_OTHER_END);//播放提示音}elseif(RUN==SysStatus){SysStatus=IDLE;Cost_StopRunning();//如果是行驶状态,则停止计费InterFace_UpdatePrice();InterFace