亚洲春色中文字幕久久久-三上亚,一吻二脱三床四吻胸,国产真实伦对白视频全集,在线毛片观看,精品成品入口黄网,国产毛aⅴ片久久久,亚洲AV色香蕉一区二区三区老师,萧皇后A级艳片,色情日本视频更新,99久久亚洲精品日本无码

標(biāo)題: STM32驅(qū)動(dòng)帶字庫(kù)12864的大字體時(shí)鐘源程序 [打印本頁(yè)]

作者: kissme    時(shí)間: 2020-3-23 19:09
標(biāo)題: STM32驅(qū)動(dòng)帶字庫(kù)12864的大字體時(shí)鐘源程序
串口調(diào)整時(shí)間。自動(dòng)背光。24節(jié)氣,溫度顯示。星期以及農(nóng)歷顯示。特殊日期顯示等。因本人才入門,故此程序?qū)懙膶?shí)在不咋滴。望批評(píng)指教 。謝謝

制作出來的實(shí)物圖如下:



void LCD12864_InitPort(void)//12864使用的端口配置
{
        GPIO_InitTypeDef  GPIO_InitStructure;        //定義結(jié)構(gòu)體               
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO, ENABLE);
        GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable,ENABLE);    //把調(diào)試設(shè)置普通IO口
        GPIO_InitStructure.GPIO_Pin  = GPIO_Pin_4|GPIO_Pin_6|GPIO_Pin_5;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;  //推挽輸出   
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
        GPIO_Init( GPIOB , &GPIO_InitStructure);          //初始化IO口配置
}

void KEY_K()//按鍵使用的端口配置
{
                GPIO_InitTypeDef  GPIO_InitStructure;        //定義結(jié)構(gòu)體                        
        RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE);  //
        //GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable,ENABLE);    //把調(diào)試設(shè)置普通IO口
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_10|GPIO_Pin_12;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //上拉輸入
        GPIO_Init(GPIOB , &GPIO_InitStructure);

}

//LCD12864寫一個(gè)字節(jié)函數(shù)
void xiebye(u8 bye)
{
        u8 a;
        for(a=0;a<8;a++)
        {
                sck=1;
                if(bye&0x80)sda=1;
                        else sda=0;
                 bye=bye<<1;
                sck=0;
        delay_us(3);
        }
}
//LCD12864寫命令
void xiecom(u8 com)
{
                cs=1;
                xiebye(0xf8);
                xiebye(0xf0&com);
                xiebye(0xf0&com<<4);
                cs=0;
}
//寫數(shù)據(jù)
void xiedat(u8 dat)
{
        cs=1;
                xiebye(0xfa);
                xiebye(0xf0&dat);
                xiebye(0xf0&dat<<4);
                cs=0;
}
void init12864()
{
    delay_us(100);  xiecom(0x30);
        delay_us(20);  xiecom(0x02);
        delay_us(20);  xiecom(0x0c);
        delay_us(20);  xiecom(0x06);
        delay_us(20);  xiecom(0x80);
        delay_us(20);  xiecom(0x01);
}

//任意位置寫漢字
void xiezi(u8 x,u8 y,u8 *z)
{
        u8 poos;
        if(x==1)poos=0x80+y;
        if(x==2)poos=0x90+y;
        if(x==3)poos=0x88+y;
        if(x==4)poos=0x98+y;
        xiecom(poos);
        while(*z!='\0')
        {
          xiedat(*z);
                z++;
        
        }
}
void pos(u8 x,u8 y) //屏坐標(biāo)位置設(shè)定
{
        u8 poos;
   if (x==1)
     {x=0x80;}
   else if (x==2)
     {x=0x90;}
   else if (x==3)
     {x=0x88;}
   else if (x==4)
     {x=0x98;}
        poos=x+y;
        xiecom(poos);
}

void xieziz(u8 *s)//寫字符串
{
        while(*s!='\0')
        {
                xiedat(*s);
        s++;
                delayus(0);
        }
}

////////////////////////////////////////////////////////////////////////////////////
void xiez(u8 x,u8 y,u8 *z)
{
        u8 poos;
        if(x==1)poos=0x80+y;
        if(x==2)poos=0x90+y;
        if(x==3)poos=0x88+y;
        if(x==4)poos=0x98+y;
        xiecom(poos);
        while(*z!='\0')
        {
          xiedat(*z);
                z++;
                delay_ms(60);
        }
}

作者: yxt123    時(shí)間: 2021-3-7 13:47
樓主能否發(fā)個(gè)源碼,謝謝




歡迎光臨 (http://www.denmoz.com/bbs/) Powered by Discuz! X3.1