标题:
自己整理的OLED STM32 spi方式代码
[打印本页]
作者:
songyuan
时间:
2019-3-11 20:44
标题:
自己整理的OLED STM32 spi方式代码
STM32 OLED12864 spi方式
单片机源程序如下:
#include "sys.h"
#include "delay.h"
#include "usart.h"
#include "led.h"
#include "OLED.h"
/***********************iBoxV300*********************************
\\\|///
\\ - - //
( @ @ )
+---------------------oOOo-(_)-oOOo-------------------------+
| |
| Oooo |
+-----------------------oooO--( )-------------------------+
( ) ) /
\ ( (_/
\_)
****************************************************************/
/*
stm32与OLED屏接口的引脚介绍:
CS——---——GPIOD3;
RST——--——GPIOD4;
DC———-——GPIOD5;
D0———-——GPIOD6;
D1———-——GPIOD7;
*/
const unsigned char xing[]=
{ 0x10,0x40,0x10,0x22,0xF0,0x15,0x1F,0x08,
0x10,0x16,0xF0,0x21,0x40,0x40,0x3C,0x42,
0x10,0x42,0x10,0x42,0xFF,0x7F,0x10,0x42,
0x10,0x42,0x10,0x42,0x00,0x40,0x00,0x00};/*"姓",0*/
const unsigned char A[]=
{ 0x00,0x20,0x00,0x3C,0xC0,0x23,0x38,0x02,
0xE0,0x02,0x00,0x27,0x00,0x38,0x00,0x20};/*"A",0*/
const unsigned char ming[]=
{ 0x00,0x04,0x20,0x04,0x20,0x04,0x10,0x02,
0x08,0xFE,0x14,0x43,0x67,0x43,0x84,0x42,
0x44,0x42,0x24,0x42,0x14,0x42,0x0C,0x42,
0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00};/*"名",0*/
const unsigned char ASCII_Colon[]=
{ 0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,
0xC0,0x30,0x00,0x00,0x00,0x00,0x00,0x00};/*":",0*/
const unsigned char xue[]=
{ 0x40,0x04,0x30,0x04,0x11,0x04,0x96,0x04,
0x90,0x04,0x90,0x44,0x91,0x84,0x96,0x7E,
0x90,0x06,0x90,0x05,0x98,0x04,0x14,0x04,
0x13,0x04,0x50,0x04,0x30,0x04,0x00,0x00};/*"学",0*/
const unsigned char hao[]=
{ 0x80,0x00,0x80,0x00,0x80,0x00,0xBE,0x06,
0xA2,0x05,0xA2,0x04,0xA2,0x04,0xA2,0x04,
0xA2,0x44,0xA2,0x84,0xA2,0x44,0xBE,0x3C,
0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00};/*"号",0*/
/*********************************************************/
int main(void)
{
// SysTick_Init();
OLED_Init();
OLED_ShowChinese(0, 0, xing);//‘姓’
OLED_ShowChinese(18, 0, ming);//‘名’
OLED_ShowChar(36, 0, ASCII_Colon);//‘:’
OLED_ShowChinese(0, 2, xue);//‘学’
OLED_ShowChinese(18, 2, hao);//‘号’
OLED_ShowChar(36, 2, ASCII_Colon);//‘:’
// SPI_Write(0x2F, OLED_Order); //0x2F:激活滚动 0x2E:关闭滚动
// //设置滚动方式:
// // 0x26/0x27 :水平滚动(右向/左向)
// // 0x29/0x2A :水平和垂直滚动(右向/左向)
// // 0xA3 :垂直滚动
// SPI_Write(0x27, OLED_Order);
// SPI_Write(0x00, OLED_Order);
// SPI_Write(0x00, OLED_Order);
// SPI_Write(0x00, OLED_Order);
// SPI_Write(0x03, OLED_Order);
// SPI_Write(0x30, OLED_Order);
while(1);
}
/**************************************************************/
复制代码
所有资料51hei提供下载:
OLED.7z
(180.79 KB, 下载次数: 71)
2019-3-12 01:10 上传
点击文件名下载附件
下载积分: 黑币 -5
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1