基于AT89S52单片机模拟小车的程序设计/******************************************************************** Name:C003 Content:Test the speed of the car Time:2012/7/15 09:30 *******************************************************************/ #include #define uchar unsigned char #define uint unsigned int sbit fmq=P3^6; sbit K1=P1^4; //每按一次,距离值加一 sbit K2=P1^5; //每按一次,距离值减一 sbit K3=P1^6; //确认键 sbit K4=P1^7; //操作结束后 按下 K4 对前五次的速度值扫描 float time1=0,time2=0,time3=0,time4=0,time5=0; // 时 间值 float speed1=0,speed2=0,speed3=0,speed4=0,speed5=0; //速度值 char JL; //JL 表示距离 uint x=0,y=0; uint t1=0,t2=0,t3=0,t4=0,t5=0; uchar z2=0,z1=0,f1=0,f2=0; uchar count=0; //测速次数 uchar key_num=0; //键值 float sudu[5]; //定义一个浮点型数组,可存放五个速度值 uchar Tab[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; //无小数点的段码表 uchar KKK[10]={0x40,0x