首页
/
每日頭條
/
科技
/
AT89C51驅動OLED液晶屏的應用代碼
AT89C51驅動OLED液晶屏的應用代碼
更新时间:2025-11-29 14:20:32

AT89C51驅動OLED液晶屏的應用代碼?#include <reg51.h>#include <stdio.h>,我來為大家講解一下關于AT89C51驅動OLED液晶屏的應用代碼?跟着小編一起來看一看吧!

AT89C51驅動OLED液晶屏的應用代碼(AT89C51驅動OLED液晶屏的應用代碼)1

AT89C51驅動OLED液晶屏的應用代碼

#include <reg51.h>

#include <stdio.h>

sbit OLED_SCL = P1^0;

sbit OLED_SDA = P1^1;

void OLED_IIC_Start()

{

OLED_SDA = 1;

OLED_SCL = 1;

OLED_SDA = 0;

OLED_SCL = 0;

}

void OLED_IIC_Stop()

{

OLED_SDA = 0;

OLED_SCL = 1;

OLED_SDA = 1;

OLED_SCL = 0;

}

void OLED_IIC_Write_Byte(unsigned char IIC_Byte)

{

unsigned char i;

for (i=0;i<8;i )

{

OLED_SCL = 0;

if (IIC_Byte & 0x80) OLED_SDA = 1;

else OLED_SDA = 0;

OLED_SCL = 1;

IIC_Byte <<= 1;

}

OLED_SCL = 0;

OLED_SDA = 1;

OLED_SCL = 1;

OLED_SDA = 1;

}

void OLED_Init()

{

OLED_IIC_Start();

OLED_IIC_Write_Byte(0x78);

OLED_IIC_Write_Byte(0x00);

OLED_IIC_Write_Byte(0xD5);

OLED_IIC_Write_Byte(0x80);

OLED_IIC_Write_Byte(0xA8);

OLED_IIC_Write_Byte(0x3F);

OLED_IIC_Write_Byte(0xD3);

OLED_IIC_Write_Byte(0x00);

OLED_IIC_Write_Byte(0x40);

OLED_IIC_Write_Byte(0x8D);

OLED_IIC_Write_Byte(0x14);

OLED_IIC_Write_Byte(0x20);

OLED_IIC_Write_Byte(0x00);

OLED_IIC_Write_Byte(0xA1);

OLED_IIC_Write_Byte(0xC8);

OLED_IIC_Write_Byte(0xDA);

OLED_IIC_Write_Byte(0x12);

OLED_IIC_Write_Byte(0x81);

OLED_IIC_Write_Byte(0xCF);

OLED_IIC_Write_Byte(0xD9);

OLED_IIC_Write_Byte(0xF1);

OLED_IIC_Write_Byte(0xDB);

OLED_IIC_Write_Byte(0x40);

OLED_IIC_Write_Byte(0xA4);

OLED_IIC_Write_Byte(0xA6);

OLED_IIC_Write_Byte(0xAF);

OLED_IIC_Stop();

}

void OLED_Set_Pos(unsigned char x, unsigned char y)

{

OLED_IIC_Start();

OLED_IIC_Write_Byte(0x78);

OLED_IIC_Write_Byte(0x00);

OLED_IIC_Write_Byte(0xB0 y);

OLED_IIC_Write_Byte(((x&0xF0)>>4)|0x10);

OLED_IIC_Write_Byte((x&0x0F)|0x01);

OLED_IIC_Stop();

}

void OLED_Show_Str(unsigned char x,unsigned char y,char *chr)

{

unsigned char c=0,l=0;

while (chr[c]!='\0')

{

l=chr[c];

OLED_Set_Pos(x,y);

,
Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
推荐阅读
手機号碼暫停服務怎麼恢複
手機号碼暫停服務怎麼恢複
手機号碼暫停服務怎麼恢複?如果是自己的手機提示暫停服務了,那麼帶着身份證直接去營業廳就可以了,我來為大家講解一下關于手機号碼暫停服務怎麼恢複?跟着小編一起來看一看吧!手機号碼暫停服務怎麼恢複如果是自己的手機提示暫停服務了,那麼帶着身份證直接...
2025-11-29
陳情令手機壁紙
陳情令手機壁紙
,
2025-11-29
ps的shift快捷鍵
ps的shift快捷鍵
對于經常使用的Photoshop的人來說,在用PS進行設計或者修圖時,左手最好的朋友就是Shift鍵了!Shift鍵這個小按鍵對于PS老手來說用起來可謂是得心應手,但對于許多剛接觸Photoshop的人而言卻顯得很神秘,今天就和大家介紹幾個...
2025-11-29
英語單詞中的字母記憶方法
英語單詞中的字母記憶方法
英語單詞速記—關于“交通工具”的單詞記憶方法(六)boat[bəʊt]n.小船聯想法→bo(=box盒子)at(在...地方)講解:在水上飄着一個盒子形狀的小船。ship[ʃɪp]n.船;艦聯想法→shi(讀:“細”)p講解:細長細長的船。...
2025-11-29
筆記本散熱不好怎麼解決
筆記本散熱不好怎麼解決
筆記本散熱不好怎麼解決?首先增加外置散熱設備筆記本内部雖然不能增加散熱風扇,但是可以買一個散熱底座或者抽風式散熱器,以增加散熱能力,現在小編就來說說關于筆記本散熱不好怎麼解決?下面内容希望能幫助到你,我們來一起看看吧!筆記本散熱不好怎麼解決...
2025-11-29
Copyright 2023-2025 - www.tftnews.com All Rights Reserved