欢迎来到天天文库
浏览记录
ID:40489548
大小:21.68 KB
页数:17页
时间:2019-08-03
《oled初始化程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#include"io.h"#include"system.h"#include"oled.h"//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//Patterns//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=voidWrite_Command(unsignedcharCommand)//OLED_IPWRITECOMMAND
2、{IOWR(OLED_BASE,0,Command);}voidWrite_Data(unsignedchardata)//OLED_IPWRITEDATA{IOWR(OLED_BASE,1,data);}voiduDelay(unsignedcharl){while(l--)usleep(1);}voidDelay(unsignedcharn){unsignedchari,j,k;for(k=0;k3、=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//InstructionSetting//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=voidSet_Start_Column(unsignedchard){Write_Command(0x00+d%16);//SetLowerColumnStartAddressforPageAddressingMode//Default=>0x00Write_Command(0x10+d/16);//SetHigherColu4、mnStartAddressforPageAddressingMode//Default=>0x10}voidSet_Addressing_Mode(unsignedchard){Write_Command(0x20);//SetMemoryAddressingModeWrite_Command(d);//Default=>0x02//0x00=>HorizontalAddressingMode//0x01=>VerticalAddressingMode//0x02=>PageAddressingMode}voidSet_Column_Address(unsignedchara,uns5、ignedcharb){Write_Command(0x21);//SetColumnAddressWrite_Command(a);//Default=>0x00(ColumnStartAddress)Write_Command(b);//Default=>0x83(ColumnEndAddress)}voidSet_Page_Address(unsignedchara,unsignedcharb){Write_Command(0x22);//SetPageAddressWrite_Command(a);//Default=>0x00(PageStartAddress)Write_C6、ommand(b);//Default=>0x07(PageEndAddress)}voidSet_Start_Line(unsignedchard){Write_Command(0x407、d);//SetDisplayStartLine//Default=>0x40(0x00)}voidSet_Contrast_Control(unsignedchard){Write_Command(0x81);//SetContrastControlforBank0Write_Command(d);//Default=>0x80}voidSet_Area_Brightness(unsignedch8、ard){Write_Command(0x82);//SetBrightnessforAreaColorBanksWrite_Command(d);//Default=>0x80}voidSet_Segment_Remap(unsignedchard){Write_Command(0xA09、d);//SetSegmentRe-Map//Default=>0xA0//0xA0(0x00)=>ColumnAddress0MappedtoSEG0//
3、=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//InstructionSetting//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=voidSet_Start_Column(unsignedchard){Write_Command(0x00+d%16);//SetLowerColumnStartAddressforPageAddressingMode//Default=>0x00Write_Command(0x10+d/16);//SetHigherColu
4、mnStartAddressforPageAddressingMode//Default=>0x10}voidSet_Addressing_Mode(unsignedchard){Write_Command(0x20);//SetMemoryAddressingModeWrite_Command(d);//Default=>0x02//0x00=>HorizontalAddressingMode//0x01=>VerticalAddressingMode//0x02=>PageAddressingMode}voidSet_Column_Address(unsignedchara,uns
5、ignedcharb){Write_Command(0x21);//SetColumnAddressWrite_Command(a);//Default=>0x00(ColumnStartAddress)Write_Command(b);//Default=>0x83(ColumnEndAddress)}voidSet_Page_Address(unsignedchara,unsignedcharb){Write_Command(0x22);//SetPageAddressWrite_Command(a);//Default=>0x00(PageStartAddress)Write_C
6、ommand(b);//Default=>0x07(PageEndAddress)}voidSet_Start_Line(unsignedchard){Write_Command(0x40
7、d);//SetDisplayStartLine//Default=>0x40(0x00)}voidSet_Contrast_Control(unsignedchard){Write_Command(0x81);//SetContrastControlforBank0Write_Command(d);//Default=>0x80}voidSet_Area_Brightness(unsignedch
8、ard){Write_Command(0x82);//SetBrightnessforAreaColorBanksWrite_Command(d);//Default=>0x80}voidSet_Segment_Remap(unsignedchard){Write_Command(0xA0
9、d);//SetSegmentRe-Map//Default=>0xA0//0xA0(0x00)=>ColumnAddress0MappedtoSEG0//
此文档下载收益归作者所有