zfbipt

    1. void LcdSpiObj::LcdDisplayString(const char * string) {   while(*string) {     LcdSendData(*string ++);         LcdCol ++;   } } //注意下列2个函数(函数重载) void LcdSpiObj::LcdDisplayNumber(char Val) { char str[4];   itoa((int)Val, (char *)str, 10);   LcdDisplayString((char *)str); } void LcdSpiObj::LcdDisplayNumber(int Val) { char str[6];   itoa(Val, (char *)str, 10);   LcdDisplayString((char *)str); } LcdSpiObj LcdSpi; //main程序 int main(void) { unsigned int i = 0; unsigned char row, col;   LcdSpi.LcdInit();   LcdSpi.SetLcdDisplayPos(0, 1);//汉字定位到上行左端   LcdSpi.LcdDisplayString("汉字显示演示"); // sei();   for(;;) {     LcdSpi.LcdSpiDelayMs(1000);//上电等待延时1000Ms     LcdSpi.SetLcdDisplayPos(1,0);//字符定位到下行左端     LcdSpi.LcdDisplayString("123456789ABCDEF");//必须换行     LcdSpi.LcdDisplayPos(1, 4, "汉字");     LcdSpi.GetLcdDisplayPos(row, col);//解除C语言的&row,&col之烦恼     LcdSpi.SetLcdDisplayPos(1, 6);     LcdSpi.LcdDisplayNumber(row);//字节型数字(0~255)     LcdSpi.LcdDisplayNumber(col);     LcdSpi.SetLcdDisplayPos(1, 0);     LcdSpi.LcdDisplayNumber(i ++);//字型数字(0~65535)   }            return 0; }
    2. LcdSpiObj::LcdSpiObj(void) {   LcdRow = 0;   LcdCol = 0;   LcdSpiModeSetup(); } void LcdSpiObj::LcdSpiModeSetup(void) { /* 设置MOSI 和SCK 及SS 为输出,其他为输入 */   DDRB = (1

最近访客

< 1/1 >

统计信息

已有59人来访过

  • 芯积分:--
  • 好友:--
  • 主题:1
  • 回复:2

留言

你需要登录后才可以留言 登录 | 注册


现在还没有留言