系统源程序(C语言版)/*+++++++++++++++++++++++++++++++++++++LCD显示,采用FM12864FLCD显示模块(带中文字库)功能说明:键盘显示,键盘采用普通彩电遥控器(SAA3010A),语音芯片采用ISD1420P,能够录放20秒,单片机采用AT89C51,通过键盘控制实现,语音报站同时LCD显示站名,晶振24MHz。接线说明:P1口接LCD的数据口,P0口接ISD1420P的地址口,P3.2----PLAYP3.3----RECP3.4----RSP3.5----WRP3.6----EP3.7接SM0038信号输出脚版本时间:2007-05-2723:12+++++++++++++++++++++++++++++++++++++++*/#includereg51.hvoidClear();voidDelay(unsignedintt);voidWrite_com(unsignedchard);voidWrite_data(unsignedchard);unsignedcharRead_data();voidDisp_char(unsignedcharpos,unsignedchardat);voidDisp_word0(unsignedcharposx,unsignedchar*p,unsignedcharn);voidLcd_system(void);bithw_yima();voiddelay0(unsignedintt);voidDisp_control(unsignedcharzm);voidDisp_number(unsignedcharpos,unsignedintdat);voidReport(unsignedcharsl);voidRec_bus(unsignedcharrec);voidDisp_pucture(unsignedchar*p);voidbus_contorl();unsignedcharn=0;//红外码位数unsignedcharp_last=0;//上一次显示指针偏移量unsignedcharzm_last=0;unsignedchark=0;unsignedchar*q2;unsignedintsecret=0;//录音密码unsignedintymcode=255;//红外线编码bitflag0=1;//译码标志位bits;bithw=0;//解码成功失败标志位bitmode=0;//模式选择,0:报站模式,1录音模式(录音需要输入密码)。bitxs=0;//显示输入密码标志位bitly=0;//录音允许位sbitP1_0=P3^7;//红外线信号输入断口sbitPLAY=P3^3;//放音sbitREC=P3^2;//录音sbitLCD_RS=P3^4;//数据、命令选择信号sbitLCD_WR=P3^5;//读写信号sbitLCD_E=P3^6;//使能信号unsignedinttm=0;unsignedcharcodegImage_word0[1024];unsignedcharcodegImage_word2[1024];unsignedcharcodetable0[]={虎泉桌刀泉广阜屯街道口洪山丁字桥傅家坡大东门阅马场下一站:};unsignedcharcodetable1[]={深圳市勤正达电子有限公司成立于2002年,是专业研发及生产液晶显示器和液晶模块的高新技术企业。LCD显示器覆盖了多种系列多年来公司秉承全力面向客户,技术专攻的经营理念,一直致力于为广大电子成品制造商提供质量精良,性能稳定,品种齐全的LCD显示屏及LCM显示模块系列产品。望成为您的首选合作伙伴。};unsignedcharcodetable2[]={请输入密码:录音模式密码错误!};voidmain(){unsignedcharnum=0;unsignedinti=0;unsignedchar*q;TMOD=0x11;TH1=0xF0;TL1=0x60;EA=1;ET1=1;REC=1;PLAY=1;Delay(100);Lcd_system();//系统初始化q=gImage_word2;Disp_pucture(q);delay0(30000);q=gImage_word0;Disp_pucture(q);delay0(40000);Clear();while(1){q=table1;for(num=0;num5;num++){if(0==mode){Disp_word0(0,q,32);q=q+64;}for(i=0;i60000;i++){bus_contorl();}}}}/****************************************名称:Clear()*说明:*功能:清除全屏显示*参数:无*返回值:无****************************************/voidClear(){Write_com(0x01);Write_com(0x34);Write_com(0x30);}/****************************************名称:Lcd_system()*说明:*功能:系统初始化*参数:无*返回值:无****************************************/voidLcd_system(void){Delay(600);LCD_E=0;Write_com(0x34);Delay(10000);Write_com(0x30);Delay(10000);Write_com(0x01);Delay(10000);Write_com(0x06);Delay(10000);Write_com(0x0c);Delay(10000);}/****************************************名称:Delay(unsignedintt)*说明:*功能:延时*参数:t:延时长度*返回值:无****************************************/voidDelay(unsignedintt){unsignedinti;for(i=0;it;i++){;;;;;;;;;;}}/****************************************名称:Write_com(unsignedchard)*说明:*功能:写命令字*参数:d:命令代码*返回值:无****************************************/voidWrite_com(unsignedchard){LCD_RS=0;LCD_E=0;LCD_WR=0;P1=d;LCD_E=1;Delay(40);LCD_E=0;LCD_WR=1;Delay(100);}/****************************************名称:Write_data(unsignedchard)*说明:*功能:写数据*参数:d:需要写入的数据*返回值:无****************************************/voidWrite_data(unsignedchard){LCD_E=0;LCD_RS=1;LCD_WR=0;P1=d;LCD_E=1;Delay(40);LCD_E=0;LCD_WR=1;Delay(100);}/****************************************名称:unsignedcharRead_data(void)*说明:*功能:读数据*参数:无*返回值:d:读出数据****************************************/unsignedcharRead_data(void){unsignedchard=0;LCD_E=0;LCD_RS=1;LCD_WR=1;LCD_E=1;Delay(50);d=P1;LCD_E=0;LCD_WR=0;Delay(100);return(d);}/****************************************名称:Disp_word0(unsignedcharposx,unsignedchar*p,unsignedcharn)*说明:*功能:显示一串汉字*参数:pos:显示位置(第一行:0-6,第二行:7-13),p:汉字码的地址指针,n:显示字的个数,*返回值:无****************************************/voidDisp_word0(unsignedcharposx,unsignedchar*p,unsignedcharn){unsignedchari=0;unsignedcharpos;for(i=0;in;i++){pos=posx;if((pos8)||((pos15)&&(pos24))){if(pos15)pos=pos-8;Write_com(0x80|pos);Write_data(p[0]);Write_data(p[1]);}else{if(pos16){pos=pos-8;}else{pos=pos-16;}Write_com(0x90|pos);Write_data(p[0]);Write_data(p[1]);}posx++;p=p+2;}}/****************************************名称:Disp_row(unsignedcharrow,unsignedcharpos,unsignedchardat)*说明:*功能:显示一个字母或数字*参数:row:行选择,pos:显示位置(0-15),dat:数字码*返回值:无****************************************/voidDisp_row(unsignedcharrow,unsignedcharpos,unsignedchardat){unsignedchardat0;unsignedcharpos0;row=row%2;row=row4;pos0=pos/2;if((pos+1)/2==pos0){Write_com((0x80+row)|pos0);Write_data(dat);}else{Write_com((0x80+row)|pos0);dat0=Read_data();Write_data(dat);}}/****************************************名称:Disp_char(unsignedcharpos,unsignedchardat)*说明:*功能:显示一个字母或数字*参数:pos:显示位置(第一行:0-15,第二行:16-31,第一行:32-47,第二行:48-63),dat:数字码*返回值:无****************************************/voidDisp_char(unsignedcharpos,unsignedchardat){if(pos16){Disp_row(0,pos,dat);}if((pos32)&&(pos15)){Disp_row(1,pos-16,dat);}if((pos48)&&(pos31)){Disp_row(2,pos-16,dat);}if((pos64)&&(pos47)){Disp_row(3,pos-32,dat);}}/****************************************名称:voidDisp_number(unsignedcharpos,unsignedlongdat)*说明:*功能:显示一个数(0-65536)*参数:pos:显示位置,dat:显示数据*返回值:无*****