欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索

LCD240128(UC1698芯片)驅動程序 C語言 STM32的FSMC

查看數: 3911 | 評論數: 3 | 收藏 0
關燈 | 提示:支持鍵盤翻頁<-左 右->
    組圖打開中,請稍候......
發布時間: 2021-6-16 10:09

正文摘要:

LCD240128(UC1698芯片)驅動采用STM32的FSMC 單片機源程序如下: /*           (芯片:UC1698 芯片驅動,參考LCD_240128CFW顯示屏) */ #include "UC1698.h" #include "F ...

回復

ID:1064915 發表于 2025-6-5 08:48
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>
#define uchar unsigned char
#define uint unsigned int

#include <SimpleDHT.h>
int pinDHT11 = D5;
SimpleDHT11 dht11(pinDHT11);

int i=0;

int RST =D2;
int sck = D1;
int sda = D0;
int CS = D4;
int CD = D3;

// width: 144, height: 142

unsigned char col[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xf0,0x00,0x00,0x3f,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xf8,0x00,0x00,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xff,0xfc,0x00,0x1f,0xf0,0x00,0x07,0xfc,0x00,0x00,0x1e,0x00,0x00,0x01,0xff,0xff,0xfe,0x07,0xff,0x00,0x00,0x00,0x1f,0x80,0x01,0xff,0xc0,0x00,0x01,0xff,0xff,0xff,0x1f,0xf8,0x00,0x00,0x00,0x07,0xc0,0x07,0xff,0xf0,0x00,0x03,0xff,0xff,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x78,0x1f,0xff,0xfe,0x00,0x03,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x3e,0x3f,0xff,0xff,0x00,0x07,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x0f,0x3f,0xff,0xff,0x80,0x0f,0xff,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xc0,0x0f,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xc0,0x0f,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xff,0xff,0xc0,0x0f,0xff,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xff,0xe0,0x0f,0xff,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xf0,0x0f,0xff,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xf0,0x0f,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xf8,0x0f,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xf8,0x0f,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xf8,0x0f,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xf8,0x0f,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xf8,0x0f,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xf8,0x0f,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xf8,0x0f,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xff,0xf8,0x0f,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xf8,0x07,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xf8,0x03,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xf8,0x03,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xf8,0x01,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xf0,0x01,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xf0,0x01,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xf0,0x00,0x7f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf0,0x07,0xff,0xe0,0x00,0x3f,0xc0,0x00,0x00,0x00,0x1f,0xe0,0x00,0x00,0x7b,0xf0,0x07,0xff,0xc0,0x00,0x1f,0xc0,0x00,0x00,0x00,0x3f,0xfe,0x00,0x00,0x7f,0xf0,0x03,0xff,0x80,0x00,0x07,0x80,0x00,0x00,0x00,0xdf,0xff,0x86,0x01,0xff,0xe0,0x03,0xff,0x00,0x00,0x01,0x80,0x00,0x00,0x07,0xc0,0xff,0xc7,0x13,0xff,0x80,0x01,0xfe,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x01,0xff,0xff,0x1f,0xff,0xe0,0x01,0xfc,0x00,0x00,0x01,0x00,0x00,0x00,0x38,0x0f,0xff,0xff,0x1f,0xff,0xe0,0x00,0xc0,0x00,0x00,0x03,0x00,0x00,0x00,0x30,0xff,0xff,0xff,0x9f,0xfb,0xf0,0x00,0xc0,0x00,0x00,0x03,0x00,0x00,0x00,0x0f,0xff,0x9f,0xfc,0x3f,0xf1,0xf0,0x00,0xc0,0x00,0x00,0x06,0x00,0x00,0x00,0x0f,0xfe,0x0f,0xf8,0x3f,0xe0,0xe0,0x00,0xc0,0x00,0x00,0x06,0x00,0x00,0x00,0x0f,0xfe,0x07,0xc0,0x1f,0xc0,0xc0,0x00,0xc0,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x7c,0x0f,0x80,0x0f,0xe6,0x00,0x00,0x60,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x0f,0xfe,0x00,0x00,0x60,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x03,0xff,0x00,0x07,0xfe,0x00,0x00,0x60,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x03,0xf8,0x00,0x02,0x3e,0x00,0x00,0x60,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x30,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x30,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x03,0xc0,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x07,0xc0,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x0f,0xc0,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x1f,0xc0,0x00,0x00,0x00,0x00,0xfe,0x01,0xfc,0x1f,0xfc,0x00,0x00,0x1e,0x00,0x3f,0xc0,0x00,0x00,0x00,0x00,0xfe,0x01,0xff,0xff,0x9f,0x00,0x00,0x1f,0x80,0x7f,0xc0,0x00,0x00,0x00,0x03,0xfc,0x00,0xff,0xff,0x1f,0x00,0x00,0x1f,0x80,0x7f,0xc0,0x00,0x00,0x00,0x00,0xf0,0x00,0x3f,0xfe,0x06,0x00,0x00,0x1f,0x80,0xff,0xc0,0x00,0x00,0x00,0x00,0xe0,0x00,0x07,0xf8,0x02,0x00,0x00,0x1f,0xc0,0xff,0xc0,0x00,0x00,0x00,0x00,0xc0,0x00,0x03,0xf0,0x00,0x00,0x00,0x1f,0xc0,0xff,0xe0,0x00,0x00,0x00,0x00,0x40,0x00,0x06,0x00,0x00,0x00,0x00,0x1f,0xe0,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x1f,0xf0,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xf0,0xff,0xf0,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xf8,0xff,0xf8,0x00,0x00,0x00,0x00,0x0f,0xf1,0x60,0x00,0x00,0x00,0x00,0x3f,0xf8,0xff,0xf8,0x00,0x00,0x00,0x00,0x07,0xff,0xfc,0x7f,0x80,0x00,0x00,0x3f,0xfc,0xff,0xf8,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xe0,0x00,0x00,0x7f,0xfe,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0x80,0x00,0x00,0x7f,0xfe,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x7f,0xfe,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x00,0x00,0x01,0xd0,0x03,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x7f,0xff,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x1f,0xff,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x0f,0xfc,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x00,0x00,0x07,0xf8,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x00,0x00,0x03,0xf0,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff };


char shi1[] = {
0x00,0x00,0x00,0x00,0x7F,
      0x49,0x49,0x49,0x49,0x49,
      0x7F,0x00,0x00,0x80,0x00,
      0x00,0x01,0x81,0x41,0x21,
      0x1D,0x21,0x41,0x7F,0x89,
      0x89,0x8D,0x89,0x81,0xC1,
      0x41,0x00
};

char qiu[] = {
/*--  文字:  秋  --*/
/*--  宋體18;  此字體下對應的點陣為:寬x高=24x24   --*/
0x00,0x00,0x00,0x20,0x10,0x10,0x18,0xFC,
      0x06,0x86,0x00,0x80,0x00,0x00,0xD3,0xFF,
      0x02,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,
      0x00,0x00,0x02,0x82,0x63,0x31,0x1F,0xFF,
      0x0D,0x39,0x31,0x03,0x1E,0x80,0xFF,0x3F,
      0xC8,0x06,0x03,0x00,0x00,0x00,0x00,0x00,
      0x00,0x06,0x03,0x00,0x00,0x00,0xF7,0xFF,
      0x00,0xC0,0x60,0x30,0x0C,0x07,0x00,0x00,
      0x01,0x0E,0x38,0x70,0x60,0x40,0x40,0x00};
char one[] =
{
    0x00,0x10,0x10,0x18,0x18,  // -1-
  0xFC,0xFC,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0xFF,0xFF,0x00,
  0x00,0x00,0x00,0x00,0x00,
  0x00,0x20,0x20,0x20,0x3F,
  0x3F,0x20,0x20,0x20,0x00,
  0x00 };
char wen[]={      0x00,0x00,0x00,0xC0,0x80,0x82,0x06,0x1C,      0x80,0x00,0x00,0xFF,0x26,0x26,0x22,0x32,      0x32,0xC2,0xFF,0x03,0x00,0x00,0x00,0x00,      0x00,0x00,0x00,0x00,0x01,0x03,0xE0,0x3E,      0x01,0x70,0xE0,0x27,0x66,0xF2,0x33,0x13,      0xF1,0x11,0x11,0xF8,0x18,0x00,0x00,0x00,      0x00,0x00,0x00,0x0C,0x18,0x1F,0x03,0x00,      0x00,0x00,0x1F,0x10,0x10,0x1F,0x10,0x1C,      0x1F,0x10,0x1E,0x1F,0x10,0x18,0x10,0x00};
char du[]={0x00,0x00,0x00,0x00,0x00,0xF8,0x60,0x20,      0x20,0x60,0xF0,0x33,0x16,0x16,0x10,0xF0,      0x10,0x18,0x98,0x98,0x00,0x00,0x00,0x00,     0x00,0x00,0x00,0x00,0x80,0xFF,0x02,0x02,      0x82,0x82,0xBF,0x93,0xD3,0xD1,0x5D,0xDF,      0xE1,0x41,0x01,0x01,0x01,0x00,0x00,0x00,      0x00,0x80,0x60,0x38,0x0F,0x01,0x00,0x80,     0xC0,0x42,0x22,0x34,0x1C,0x1C,0x33,0x61,      0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x00};
char shi[]={0x00,0x00,0x00,0x00,0x02,0x04,0x1C,0x08,      0x80,0x00,0xFE,0x44,0x44,0x44,0x64,0x64,      0x24,0xE6,0x7E,0x06,0x00,0x00,0x00,0x00,      0x00,0x00,0x01,0x03,0x06,0x06,0xF0,0x1F,      0x00,0xC0,0x87,0x06,0xF6,0x22,0x02,0xFA,      0x12,0x03,0xC2,0x60,0x00,0x00,0x00,0x00,      0x00,0x00,0x08,0x18,0x38,0x3F,0x01,0x20,      0x20,0x20,0x23,0x20,0x3F,0x20,0x20,0x3F,      0x36,0x33,0x30,0x30,0x30,0x20,0x00,0x00};
char abc[]={  0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0x80,   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  0x81,0xC3,0xC3,0x81,0x00,0x00,0x00,0x00,  0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x01,  0x00,0x00,0x00,0x00};
char C[]={ 0xC0,0xF0,0x38,0x0C,0x04,0x04,0x04,0x0C,  0x18,0x38,0x7C,0x00,0xFF,0xFF,0x00,0x00,  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  0x03,0x0F,0x1C,0x30,0x20,0x20,0x20,0x30,  0x18,0x0E,0x06,0x00};

   char H[]={0x04,0xFC,0xFC,0x04,0x00,0x00,0x00,0x04,  0xFC,0xFC,0x04,0x00,0x00,0xFF,0xFF,0x08,  0x08,0x08,0x08,0x08,0xFF,0xFF,0x00,0x00,  0x20,0x3F,0x3F,0x20,0x00,0x00,0x00,0x20,  0x3F,0x3F,0x20,0x00};

char O[]={0xC0,0xE0,0x20,0x20,0x20,  0xE0,0xC0,0x00,0x07,0x0F,  0x08,0x08,0x08,0x0F,0x07,  0x00};

char num_24_12[][36]=
  {
     // -0-
    {0x00,0xC0,0xF0,0x38,0x0C,    0x04,0x0C,0x38,0xF0,0xC0,    0x00,0x00,0xFF,0xFF,0x00,    0x00,0x00,0x00,0x00,0x00,    0x00,0xFF,0xFF,0x00,0x00,    0x03,0x0F,0x1C,0x30,0x20, 0x30,0x1C,0x0F,0x03,0x00,0x00},
   // -1-
    {0x00,0x10,0x10,0x18,0x18,    0xFC,0xFC,0x00,0x00,0x00,    0x00,0x00,0x00,0x00,0x00,    0x00,0x00,0xFF,0xFF,0x00,    0x00,0x00,0x00,0x00,0x00,    0x00,0x20,0x20,0x20,0x3F,    0x3F,0x20,0x20,0x20,0x00,    0x00},
   // -2-
    {0x60,0xF0,0xF8,0x0C,0x04,    0x04,0x04,0x0C,0x18,0xF0,    0xE0,0x00,0x00,0x00,0x00,    0x80,0xC0,0x60,0x30,0x18,    0x0E,0x07,0x01,0x00,0x38,    0x3E,0x3F,0x33,0x30,0x30,    0x30,0x30,0x30,0x30,0x3C,    0x00},
    // -3-
    {0x00,0x30,0x78,0x78,0x0C,    0x04,0x04,0x0C,0x18,0xF8,    0xF0,0x00,0x00,0x00,0x00,    0x00,0x08,0x08,0x1C,0x16,    0x33,0xE1,0xC0,0x00,0x0C,    0x1E,0x3E,0x30,0x20,0x20,    0x20,0x30,0x18,0x1F,0x0F,    0x00},
   // -4-
    {0x00,0x00,0x00,0x00,0x80,    0xE0,0x38,0xFC,0xFC,0x00,    0x00,0x00,0x80,0xE0,0x38,    0x0E,0x03,0x00,0x00,0xFF,    0xFF,0x00,0x00,0x00,0x01,    0x01,0x01,0x01,0x01,0x21,    0x21,0x3F,0x3F,0x21,0x21,    0x01},
   // -5-
    {0x00,0xFC,0xFC,0x0C,0x0C,    0x0C,0x0C,0x0C,0x0C,0x0C,   0x00,0x00,0x00,0x1F,0x0F,    0x08,0x04,0x02,0x02,0x06,    0x1C,0xF8,0xE0,0x00,0x0C,    0x1E,0x3E,0x30,0x20,0x20,    0x20,0x30,0x1C,0x0F,0x03,    0x00},
  // -6-
    {0xC0,0xF0,0x38,0x0C,0x04,    0x04,0x0C,0x7C,0x78,0x30,    0x00,0x00,0xFF,0xFF,0x08,    0x04,0x02,0x02,0x02,0x06,    0x1C,0xF8,0xE0,0x00,0x03,    0x0F,0x1C,0x30,0x20,0x20,    0x20,0x30,0x1C,0x0F,0x03,    0x00},
   // -7-
    {0x78,0x1C,0x0C,0x0C,0x0C,    0x0C,0x0C,0x0C,0xCC,0x7C,   0x1C,0x00,0x00,0x00,0x00,   0x00,0x80,0xF0,0x7C,0x0F,    0x01,0x00,0x00,0x00,0x00,    0x00,0x00,0x00,0x3F,0x3F,    0x00,0x00,0x00,0x00,0x00,    0x00},
   // -8-
    {0x00,0xF0,0xF8,0x0C,0x04,    0x04,0x04,0x0C,0xF8,0xF0,    0x00,0x00,0xC0,0xE0,0x31,    0x1B,0x0E,0x0C,0x0E,0x1B,    0x31,0xE0,0xC0,0x00,0x07,  0x0F,0x18,0x30,0x20,0x20,    0x20,0x30,0x18,0x0F,0x07,    0x00},
   // -9-
    {0xC0,0xF0,0x38,0x0C,0x04,    0x04,0x04,0x0C,0x38,0xF0,    0xC0,0x00,0x07,0x1F,0x38,    0x60,0x40,0x40,0x40,0x20,    0x10,0xFF,0xFF,0x00,0x00,    0x0C,0x1E,0x3E,0x30,0x20,    0x20,0x30,0x1C,0x0F,0x03,    0x00},
};


char num_16_8[][16]=
{
   // -0-
  {0xF8,0xFC,0x04,0xC4,0x24,  0xFC,0xF8,0x00,0x07,0x0F,  0x09,0x08,0x08,0x0F,0x07,  0x00},
    // -1-
  {0x00,0x10,0x18,0xFC,0xFC,  0x00,0x00,0x00,0x00,0x08,  0x08,0x0F,0x0F,0x08,0x08,  0x00},
    // -2-
  {0x08,0x0C,0x84,0xC4,0x64,  0x3C,0x18,0x00,0x0E,0x0F,  0x09,0x08,0x08,0x0C,0x0C,  0x00},
  // -3-
  {0x08,0x0C,0x44,0x44,0x44,  0xFC,0xB8,0x00,0x04,0x0C,  0x08,0x08,0x08,0x0F,0x07,  0x00},
// -4-
  {0xC0,0xE0,0xB0,0x98,0xFC,  0xFC,0x80,0x00,0x00,0x00,  0x00,0x08,0x0F,0x0F,0x08,  0x00},
  // -5-
  {0x7C,0x7C,0x44,0x44,0xC4,  0xC4,0x84,0x00,0x04,0x0C,  0x08,0x08,0x08,0x0F,0x07,  0x00},
  // -6-
  {0xF0,0xF8,0x4C,0x44,0x44,  0xC0,0x80,0x00,0x07,0x0F,  0x08,0x08,0x08,0x0F,0x07,  0x00},
// -7-
  {0x0C,0x0C,0x04,0x84,0xC4,  0x7C,0x3C,0x00,0x00,0x00,  0x0F,0x0F,0x00,0x00,0x00,  0x00},
// -8-
  {0xB8,0xFC,0x44,0x44,0x44,  0xFC,0xB8,0x00,0x07,0x0F,  0x08,0x08,0x08,0x0F,0x07,  0x00},
  // -9-
  {0x38,0x7C,0x44,0x44,0x44,  0xFC,0xF8,0x00,0x00,0x08,  0x08,0x08,0x0C,0x07,0x03,  0x00},
  };

void num_str_2412(char x,char y,int data)
{
  int ge=data%10;
  int shi=data/10;
  words_2424(x, y, 1, num_24_12[shi]);
  words_2424(x+4, y, 1, num_24_12[ge]);

  }

void write_160160(bool flag, uchar dat)
{
  uchar i;
  digitalWrite(CD, flag);//flag=0,write command;flag=1,write data
  digitalWrite(CS, 0);
  for(i = 0; i < 8; i++)
  {  
    if(dat&0x80)
    {
      digitalWrite(sda, 1);
    }
    else
    {
      digitalWrite(sda, 0);
    }
    dat<<=1;     
    digitalWrite(sck, 1);   
    digitalWrite(sck, 0);
  }
  digitalWrite(CS,1);
}

void LCD_SetAddress(int x, int y)
{
  x = 0x25 + x / 3; //計算出該點所在的列地址,注意該液晶每3個點共有一個地址
  write_160160(0, 0x60 | (y & 0x0f)); //寫行地址低位
  write_160160(0, 0x70 | (y >> 4)); //寫行地址高位
  write_160160(0, x & 0x0f); //寫列地址低位
  write_160160(0, 0x10 | (x >> 4)); //寫列地址高位
}

void init160160(void)
{
  digitalWrite(CS, 0);
  /*************************reset*************************/
  digitalWrite(RST, 0);
  delay(2);      //power on reset
  digitalWrite(RST, 1);
  delay(800);
  write_160160(0, 0xe2);     //reset by command
  delay(2);
  /**********************power control*********************/
  write_160160(0, 0xe9);     //Bias Ratio:1/10 bias LCD 偏壓比  偏壓比設置為1/10
  write_160160(0, 0x2b);     //Bias Ratio:1/10 bias LCD 偏壓比  偏壓比設置為1/10
  write_160160(0, 0x24);     //set temperate compensation as 0%  溫度補償   設置驅動偏壓(VBIAS)的溫度補償系TC
  write_160160(0, 0x81);     //electronic potentionmeter   設置對比度調節值 取值范圍為0 ~255
  write_160160(0, 198);   //0xc6不起作用
/**********************display control*******************/
  write_160160(0, 0xa4); //0xa4 關閉所有像素    0xa5  啟動全顯示功能   
  write_160160(0, 0xa6); //關閉像素反顯 決定屏幕反顯     a6為正性顯示;a7為負性顯示
  //write_160160(0, 0xa8);//..顯示使能  開關灰度

  /*************************lcd control********************/
   write_160160(0,0xc0);      //partial display and MX disable,MY enable設置顯示RAM 驅動數據的輸出與驅動行COM 端和驅動列SEG 端的對應關系
  //  write(0,0xc7);//
  //write_160160(0, 0xe2);    //系統初始化,啟用此選項屏變淡
  write_160160(0, 0xa3);     //line rate 15.2klps 設置幀頻率
  write_160160(0, 0xd1);     //rgb-rgb 顯示數據格式
  write_160160(0, 0xd5);     //4k color mode  12-bit/RGB
  write_160160(0, 0x84);     //partial display control disable 局部顯示控制
  /********************n-line inversion********************/
  write_160160(0, 0xc8);  //set n-line inversion
  write_160160(0,0x10);      //enable NIV
  /********************com scan fuction********************/
  write_160160(0, 0xd8);     //enable FRC,PWM,LRM sequence設置COM 掃描模式

    /***********************window***區域操作指令*************************
  *column and row set fix the display district,for example
  *when AC[0]=1,AC[1]=0;(automatic wraparound,column first)
  *column auto_icrement will restart after the end address
  *顯示窗口大小設置
  *********************************************************/
  write_160160(0, 0xf4);     //wpc0:column   操作窗口的左邊界列地址
  write_160160(0, 0x25);     //start from 130  
  write_160160(0, 0xf6);     //wpc1       ending column address   操作窗口右邊界(結束列地址)設置
  write_160160(0, 0x5A);     //end:272      90
  //因為列開始到結尾共90-37=53個數所以 一個數代表160/53=3個像素
  write_160160(0, 0xf5);     //wpp0:row     starting row address   操作窗口上邊界(起始行地址)設置
  write_160160(0, 0x00);     //start from 0
  write_160160(0, 0xf7);     //wpp1       ending  row address    操作窗口下邊界(結束行地址)設置
  write_160160(0, 0x9F);     //end 160  0x9F=159
  //行開始到結束共160個數所以一個數代表160/160=1個像素
  write_160160(0, 0xf8);     //inside mode   窗口操作的使能   0xf9:使能無效
  write_160160(0, 0x89);     //RAM control   地址自動加一    AC1=0 列先增加    AC2=0  控制行增加+1還是-1   AC0=1
  write_160160(0, 0x8b);    //是0x89的90°翻轉顯示      AC1=1 行先增加                 AC0=1
  write_160160(0,0x8d);     //                 AC1=0             AC2=1  控制行增加+1還是-1   AC0=1
  write_160160(0,0x8a);     //這四行控制一次性寫入時地址增加方向  直接向地址中寫數據時不管用....

  write_160160(0, 0xad);     //display on,select on/off mode.Green Enhance mode disable     顯示使能設置 關灰度,增強模式無效  背景深黑雪花
    /***************卷動指令*********scroll line**********滾動行***********/
  write_160160(0, 0x40);     //低4位卷動行號
  write_160160(0, 0x50);     //高4位卷動行號
  write_160160(0, 0xc4);     //19,enable FLT and FLB   set lcd Mapping control
  write_160160(0, 0x90);     //14:FLT,FLB set     局部卷動功能而分解卷動區域和固定區域,FLT,FLB 為固定區域
  write_160160(0, 0x00);
    /**********************partial display*******區域操作指令***********/
  write_160160(0, 0x84);     //12,set partial display controlff  控制局部顯示功能 0x84: 局部顯示無效;0x85:局部顯示使能
  write_160160(0, 0xf1);     //com end      COM 掃描結束行設置
  write_160160(0, 0x9f);     //160           取值范圍0~9F。復位后默認為9FH。
  write_160160(0, 0xf2);     //display start      局部顯示起始行設置
  write_160160(0, 0);      //0
  write_160160(0, 0xf3);     //display end     局部顯示結束行設置
  write_160160(0, 159);    //160
}

void cleadlCD()
{
  uint i;
  write_160160(0,0xf4); write_160160(0,0x25); //設置操作窗口左邊界 0--53
  write_160160(0,0xf5); write_160160(0,0x00); //設置操作窗口上邊界
  write_160160(0,0xf6); write_160160(0,0x5a); //設置操作窗口右邊界
  write_160160(0,0xf7); write_160160(0,0x9f); //設置操作窗口下邊界
  write_160160(0,0xf8); //設置窗口操作使能
  write_160160(0,0x05);write_160160(0,0x12); //設置起始列地址
  write_160160(0,0x60); write_160160(0,0x70); //設置起始行地址

  for (i=0;i<160*28;i++) //循環總的數據量(列塊x 行數)
  {
    write_160160(1,0x00); //寫入數據pixel1,pixel2
    write_160160(1,0x00); //寫入數據pixel3,pixel4
    write_160160(1,0x00); //寫入數據pixel5,pixel6
  }
}

void cleadlCD1()
{
  uint i;
  write_160160(0,0xf4); write_160160(0,0x25); //設置操作窗口左邊界 0--53
  write_160160(0,0xf5); write_160160(0,0x00); //設置操作窗口上邊界
  write_160160(0,0xf6); write_160160(0,0x5a); //設置操作窗口右邊界
  write_160160(0,0xf7); write_160160(0,0x9f); //設置操作窗口下邊界
  write_160160(0,0xf8); //設置窗口操作使能
  write_160160(0,0x05);write_160160(0,0x12); //設置起始列地址
  write_160160(0,0x60); write_160160(0,0x70); //設置起始行地址

  for (i=0;i<160*28;i++) //循環總的數據量(列塊x 行數)
  {
    write_160160(1,0xff); //寫入數據pixel1,pixel2
    write_160160(1,0xff); //寫入數據pixel3,pixel4
    write_160160(1,0xff); //寫入數據pixel5,pixel6
  }
}

void lcdscan(uchar dat1,uchar dat2)
{
  uchar i,j;
  write_160160(0,0x60); write_160160(0,0x25); //設置操作窗口左邊界 0--53
  write_160160(0,0x70); write_160160(0,0x00); //設置操作窗口上邊界
  write_160160(0,0x05); write_160160(0,0x5a); //設置操作窗口右邊界
  write_160160(0,0x12); write_160160(0,0x9f); //設置操作窗口下邊界
  write_160160(0,0xf8);//設置窗口操作使能
  write_160160(0,0x05);write_160160(0,0x12); //設置起始列地址
  write_160160(0,0x60); write_160160(0,0x70); //設置起始行地址
  for(j=0;j<160;j++)
  {
    for(i=0;i<27;i++)
    {
      if(j%2==0)
      {
        write_160160(1,dat1);
        write_160160(1,dat1);
        write_160160(1,dat1);
      }
      else
      {
        write_160160(1,dat2);
        write_160160(1,dat2);
        write_160160(1,dat2);
      }
    }
  }
}


void words_1616(char x, char y, char type, char *p) //type=1,ascii;type=2,Chinese character   顯示16*16像素 漢字  小四
{ //x控制列顯示地址  y控制行顯示地址  
  //漢字取模方式 16*16 從左到右從上到下 縱向8點下高位
  char i, k, j, m, n, l, x0, dat0, dat1, dat2, dat3, dat6;
  x = 37 + x; //控制LCD RAM地址用
  x0 = 0x00 | (x & 0x0f);
  x = 0x10 | ((x & 0xf0) >> 4);
  for (i = 0; i < 2; i++) //橫向 2個字節 因為是縱向取模 所以橫向 共2*8=16個像素點  i的上限為字符寬度/8 eg:16/8=2
  { //i的值控制著字符寬度若顯示48*24則for(i=0;i<6;i++)
    n = i * 8 * type; //縱向 type==2時為漢字 因為是16*16尺寸的漢字所以縱向每次需要16個bit
    //n的值控制著字符高度像素若顯示24*48則n=i*24*type (type==2時顯示漢字)
    for (j = 0; j < 8; j++) //j的8次循環負責將取模字節中的數據還原成8bit像素數據
    {
      m = i * 8 + j; //控制LCD RAM的地址
      write_160160(0, 0x89); //地址自動加一
      write_160160(0, x0); // write display address   area
      write_160160(0, x); //  write display address   area
      write_160160(0, 0x60 | ((y + m) & 0x0f)); //  write display address   area
      write_160160(0, 0x70 | (((y + m) & 0xf0) >> 4)); //  write display address   area
      for (k = 0; k < 2 * type; k++) //此循環顯示漢字的時候執行4*4=16個字節(for循環中用dat0-dat4計算字模中的4個字節)
      {
        l = k * 4 + n; //l和n聯合控制漢字高度因為是24*24所以每次執行4*4=16個循環  其中(4表示k的數據范圍 4表示k的公倍數)
        dat6 = 0x01 << j; //通過上一層j的for循環來取出沒個字節中的8bit數據
        dat0 = (*(p + l))&dat6;
        dat0 = dat0 >> j;
        dat0 <<= 7; //取出字模數組中第p+l個字節的第j位并移到第8位上
        dat1 = (*(p + l + 1))&dat6;
        dat1 = dat1 >> j;
        dat1 <<= 3; //取出字模數組中第p+l+1個字節的第j位并移到第4位上
        dat2 = *(p + 2 + l)&dat6;
        dat2 = dat2 >> j;
        dat2 <<= 7; //取出字模數組中第p+l+2個字節的第j位并移到第8位上
        dat3 = (*(p + 3 + l))&dat6;
        dat3 = dat3 >> j;
        dat3 <<= 3; //取出字模數組中第p+l+3個字節的第j位并移到第8位上
        write_160160(1, dat0 | dat1); //寫入的數據是16進制包含2個字節數據  將dat0放到高4位 dat1放到第4位
        write_160160(1, dat2 | dat3);
      }
      write_160160(0, 0x88);
    }
  }
  write_160160(0, 0x89);
}



void words_2424(char x, char y, char type, char *p)
{ //x控制列顯示地址  y控制行顯示地址 type=1,ascii;type=2,Chinese character   顯示24*24像素   宋體 小二
  //漢字取模方式 24*24 縱向取模  從上往下一次八個點,從左往右  每個ascii加4
  char i, k, j, m, n, l, x0, dat0, dat1, dat2, dat3, dat4, dat5, dat6;
  x = 37 + x;
  x0 = 0x00 | (x & 0x0f);
  x = 0x10 | ((x & 0xf0) >> 4);

  for (i = 0; i < 3; i++) //橫向 3個字節 因為是縱向取模 所以橫向 共3*8=24個像素點  i的上限為字符寬度/8 eg:24/8=3
  { //i的值控制著字符寬度若顯示48*24則for(i=0;i<6;i++)
    n = i * 12 * type; //縱向 type==2時為漢字 因為是24*24尺寸的漢字所以縱向每次需要24個bit
    //n的值控制著字符高度像素若顯示24*48則n=i*24*type (type==2時顯示漢字)
    for (j = 0; j < 8; j++) //j的8次循環負責將取模字節中的數據還原成8bit像素數據
    {
      m = i * 8 + j; //控制LCD RAM的地址
      write_160160(0, 0x89); //地址自動加一
      write_160160(0, x0); // write display address   area
      write_160160(0, x); //  write display address   area
      write_160160(0, 0x60 | ((y + m) & 0x0f)); //  write display address   area
      write_160160(0, 0x70 | (((y + m) & 0xf0) >> 4)); //  write display address   area
      for (k = 0; k < 2 * type; k++) //此循環顯示漢字的時候執行4*6=24個字節(for循環中用dat0-dat6計算字模中的6個字節)
      {
        l = k * 6 + n; //l和n聯合控制漢字高度因為是24*24所以每次執行4*6=24個循環  其中(4表示k的數據范圍 6表示k的公倍數)
        dat6 = 0x01 << j; //通過上一層j的for循環來取出沒個字節中的8bit數據
        dat0 = (*(p + l))&dat6;
        dat0 = dat0 >> j;
        dat0 <<= 7; //取出字模數組中第p+l個字節的第j位并移到第8位上
        dat1 = (*(p + l + 1))&dat6;
        dat1 = dat1 >> j;
        dat1 <<= 3; //取出字模數組中第p+l+1個字節的第j位并移到第4位上
        dat2 = *(p + 2 + l)&dat6;
        dat2 = dat2 >> j;
        dat2 <<= 7; //取出字模數組中第p+2個字節的第j位并移到第8位上
        dat3 = (*(p + 3 + l))&dat6;
        dat3 = dat3 >> j;
        dat3 <<= 3; //取出字模數組中第p+l+3個字節的第j位并移到第4位上
        dat4 = (*(p + 4 + l))&dat6;
        dat4 = dat4 >> j;
        dat4 <<= 7; //取出字模數組中第p+l+4個字節的第j位并移到第8位上
        dat5 = (*(p + 5 + l))&dat6;
        dat5 = dat5 >> j;
        dat5 <<= 3; //取出字模數組中第p+l+5個字節的第j位并移到第4位上
        write_160160(1, dat0 | dat1); //寫入的數據是16進制包含2個字節數據  將dat0放到高4位 dat1放到第4位
        write_160160(1, dat2 | dat3);
        write_160160(1, dat4 | dat5);
      }
      write_160160(0, 0x88); //
    }
  }
  write_160160(0, 0x89);
}

//--圖形寫入函數-------------------
// 圖形格式要求:水平方向寬度要以3 和8 的倍數出現
// 8 的倍數是數據以字節形式出現
// 3 的倍數是因為DDRAM 列地址以列塊形式計算的,即3 點像素數據為一個列塊
void ShowBMP(uchar x,uchar y,uchar width,uchar high,uchar bmp[])
{
  // 坐標X 為像素列塊0-79 列塊,3 像素點數據/列塊
  // 坐標Y 為像素點行數0-159
  // 圖形寬度width 為水平方向點列數,要求該值為3 和8 的倍數
  // 圖形高度high 為垂直方向點行數,取值為0-159
  // 圖形數組bmp[]為所要寫入的圖形數據,以1bpp(8dots/byte)、水平排列格式表示
  uint p;
  uchar i,j,k,m,Ddata;
    write_160160(0,0xf4);  write_160160(0,0x25+x);        // 設置操作窗口左邊界
    write_160160(0,0xf5);  write_160160(0,y);             // 設置操作窗口上邊界
    write_160160(0,0xf6);  write_160160(0,0x25+x+width/3-1);  // 設置操作窗口右邊界
    write_160160(0,0xf7);  write_160160(0,high-1+y);        // 設置操作窗口下邊界
    write_160160(0,0xf8);                          // 設置窗口操作使能
    x=x+0x25;
    write_160160(0,x&0x0f);  write_160160(0,0x10|(x>>4)); // 設置起始列地址
    write_160160(0,0x60+(y&0x0f));   write_160160(0,0x70+(y>>4)); // 設置起始行地址
  p=0; // 數組指針初始化
  for(i=0;i<high;i++) // 循環行數數據量
  {
    for ( j=0;j<width/8;j++) // 循環字節數/行
    {
      k=bmp[p++]; // 取圖形數據
      for (m=0;m<4;m++) // 1 字節轉換成4 字節數據寫入
      {
        switch (k&0xc0) // 根據數據位值設置顯示數據
        {
          case 0x00 : Ddata=0x00;break;
          case 0x40 : Ddata=0x0f;break;
          case 0x80 : Ddata=0xf0;break;
          case 0xc0 : Ddata=0xff;break;
        }
          write_160160(1,Ddata); // 寫入數據
        k=k<<2;
      }
    }
    switch (width%3)
    {
      case 0 : break;
      case 1 : write_160160(1,0x00);break; //補充余數據為0
      case 2 : write_160160(1,0x00); write_160160(1,0x00);break;// 補充余數據為0
    }
  }
}


void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(RST, OUTPUT);
  pinMode(sda, OUTPUT);
  pinMode(sck, OUTPUT);
  pinMode(CS, OUTPUT);
  pinMode(CD, OUTPUT);

  pinMode(pinDHT11, OUTPUT);

  Serial.begin(115200);

  init160160();
  words_1616(8,24,2,shi);
  cleadlCD();
  Serial.println("初始化完成");
   }

void loop() {

  words_2424(10, 1, 2, wen);
  words_2424(18, 1, 2, du);
  words_2424(26, 1, 1, abc);
  words_2424(10, 25, 2, shi);
  words_2424(18, 25, 2, du);
  words_2424(26, 25, 1, abc);

  Serial.println("=================================");
  Serial.println("Sample DHT11...");

  byte temperature = 0;
  byte humidity = 0;
  int err = SimpleDHTErrSuccess;
  if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
   Serial.print("Read DHT11 failed, err="); Serial.println(err);delay(1000);
   return;
  }
  
  Serial.print("Sample OK: ");
  Serial.print((int)temperature); Serial.print(" *C, ");
  Serial.print((int)humidity); Serial.println(" H");
  delay(1500);
  num_str_2412(30,1,(int)temperature);
words_1616(39, 0, 1, O);
  words_2424(42, 1, 1, C);

  num_str_2412(30,25,(int)humidity);
  words_2424(39, 25, 1, H);


num_str_2412(0,0,i);
i++;
if(i>30) i=0;

  ShowBMP(10,50,120,110,col);
  delay(1000);


  Serial.println("start");
}
ID:146324 發表于 2025-6-4 16:49
學習一下。謝謝
ID:336670 發表于 2025-4-3 11:26
值得借鑒,謝謝

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表