毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 课程设计 >> 正文

单片机课程设计出租车计价器设计+源代码 第3页

更新时间:2012-9-25:  来源:毕业论文
/*-----清屏:screen: 0-全屏,1-左屏,2-右-----*/
void LCD_Clr(uchar screen)
{ unsigned char i,j;
  Select_Screen(screen);
  for(i=0;i<8;i++)
      {Set_Line(i);
          for(j=0;j<128;j++)
             { Write_Dat(0x00); }
      }                                 
}

/*-----初始化LCD------*/
void LCD_Init(void)
{ uchar i=250;           //延时
while(i--);
Select_Screen(0);
Set_OnOff(0);            //关显示
LCD_Clr(0);              //清屏
Select_Screen(0);
Set_OnOff(1);            //开显示
Select_Screen(0);
Set_StartLine(0);        //开始行:0
}

// 在指定位置显示字符:x=0-120(字母、数字)/0-112(汉字),y=0-6                        
void Out_Char(uchar x, uchar y, bit mode, char *fmt)    //mode: 1 正常显示,0 反白显示
{
    int c1,c2,cData;
        uchar i=0,j,uLen;
        uchar k;
       
    uLen=strlen(fmt);

        while(i<uLen)
        {
                c1 = fmt[i];
                c2 = fmt[i+1];

                if(c1>=0 && c1<128  )// ASCII
                {               
                  if(c1 < 0x20)
                    {
                        swi本文来自辣.文,论-文·网原文请找腾讯32491.14tch(c1)
                        {
                            case 13:
                            case 10: // 回车或换行
                                i++;
                                                //if(y < (LCD_Y_MAX - (2 * HZ_CHR_毕业论文http://www.751com.cn/  HEIGHT)))
                        if (y<7)
                           {x=0;  y+=2;}
                                continue;
                            case 8: // 退格
                                                i++;
                                if(y>ASC_CHR_WIDTH) y-=ASC_CHR_WIDTH;
                                cData = 0x00;
                                break;
                        }
                    }

           for(j=0;j<sizeof(ASC_16)/sizeof(ASC_16[0]);j++)                           //sizeof(ASC_16[0]
                    {
                        if(fmt[i] == ASC_16[j].Index_Char[0])
                        break;
                    }

                    for(k=0;k<2*ASC_CHR_WIDTH;k++)
                    {
                      if(j < sizeof(ASC_16)/sizeof(ASC_16[0]))
                 {
                  if (mode == 1)                 
                     cData=ASC_16[j].Msk_Char[k];  //正常
                  else
                     cData=~ASC_16[j].Msk_Char[k];  //反白
                 }
              else        
                  cData=0;

              if (k<ASC_CHR_WIDTH)    //字符上半部
                 { if ((x+k)<64)
                      { Select_Screen(1);  //选择左半屏
                        Set_Column(x+k);
                      }
                   else
                      { Select_Screen(2);  //选择右半屏
                        Set_Column(x+k-64);
                      }
                   Set_Line(y);

上一页  [1] [2] [3] [4] 下一页

单片机课程设计出租车计价器设计+源代码 第3页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。