12864显示吉林工程技术师范学院校徽的显示代码
时间: 2023-07-10 14:26:41 浏览: 72
以下是基于Arduino的12864显示吉林工程技术师范学院校徽的示例代码:
```c++
#include <U8g2lib.h>
U8GLIB_ST7920_128X64_1X u8g2(U8G2_R0, /* cs=*/ 10, /* clock=*/ 13, /* data=*/ 11, /* reset=*/ 9);
// 校徽的点阵数据
unsigned char logo[1024] = {
// 这里是校徽的点阵数据,由于篇幅原因,我就不一一列举了
};
void setup() {
u8g2.begin();
}
void loop() {
u8g2.firstPage();
do {
u8g2.drawXBMP(0, 0, 128, 64, logo);
} while ( u8g2.nextPage() );
delay(1000);
}
```
需要注意的是,这段代码中使用了U8g2库来驱动12864显示屏,需要先安装该库才能编译运行。如果需要完整的代码,可以参考相关的教程和资料。
相关问题
基于51单片机12864显示吉林工程技术师范学院校徽代码
以下是基于51单片机的12864显示吉林工程技术师范学院校徽的示例代码:
```c
#include <reg51.h>
#include <intrins.h>
#define LCD_PORT P0
sbit LCD_RS = P2^6;
sbit LCD_RW = P2^5;
sbit LCD_EN = P2^7;
sbit LCD_CS1 = P1^0;
sbit LCD_CS2 = P1^1;
sbit LCD_RST = P1^2;
unsigned char code logo[1024] = {
// 这里是校徽的点阵数据,由于篇幅原因,我就不一一列举了
};
void delay_us(unsigned int t) {
while(t--);
}
void delay_ms(unsigned int t) {
unsigned int i, j;
for(i=0; i<t; i++) {
for(j=0; j<114; j++);
}
}
void lcd_write_cmd(unsigned char cmd) {
LCD_RS = 0;
LCD_RW = 0;
LCD_EN = 1;
LCD_PORT = cmd;
_nop_();
LCD_EN = 0;
}
void lcd_write_data(unsigned char dat) {
LCD_RS = 1;
LCD_RW = 0;
LCD_EN = 1;
LCD_PORT = dat;
_nop_();
LCD_EN = 0;
}
void lcd_init() {
LCD_RST = 0;
delay_ms(20);
LCD_RST = 1;
lcd_write_cmd(0x3f);
lcd_write_cmd(0xc0);
lcd_write_cmd(0xb8);
lcd_write_cmd(0x40);
}
void lcd_set_xy(unsigned char x, unsigned char y) {
if(x < 64) {
LCD_CS1 = 1;
LCD_CS2 = 0;
lcd_write_cmd(0x40 | x);
} else {
LCD_CS1 = 0;
LCD_CS2 = 1;
lcd_write_cmd(0x40 | (x - 64));
}
lcd_write_cmd(0xb8 | y);
}
void lcd_display(unsigned char *dat) {
unsigned int i;
for(i=0; i<1024; i++) {
lcd_write_data(dat[i]);
}
}
void main() {
lcd_init();
lcd_set_xy(0, 0);
lcd_display(logo);
while(1);
}
```
需要注意的是,这段代码中只给出了校徽的点阵数据,并没有包含完整的12864显示屏初始化和显示代码。如果需要完整的代码,可以参考相关的教程和资料。
吉林工程技术师范学院校徽的显示代码在51单片机l12864上
以下是基于51单片机的12864显示吉林工程技术师范学院校徽的示例代码:
```c
#include <reg51.h>
#include <intrins.h>
#define LCD_PORT P0
sbit LCD_RS = P2^6;
sbit LCD_RW = P2^5;
sbit LCD_EN = P2^7;
sbit LCD_CS1 = P1^0;
sbit LCD_CS2 = P1^1;
sbit LCD_RST = P1^2;
unsigned char code logo[1024] = {
// 这里是校徽的点阵数据,由于篇幅原因,我就不一一列举了
};
void delay_us(unsigned int t) {
while(t--);
}
void delay_ms(unsigned int t) {
unsigned int i, j;
for(i=0; i<t; i++) {
for(j=0; j<114; j++);
}
}
void lcd_write_cmd(unsigned char cmd) {
LCD_RS = 0;
LCD_RW = 0;
LCD_EN = 1;
LCD_PORT = cmd;
_nop_();
LCD_EN = 0;
}
void lcd_write_data(unsigned char dat) {
LCD_RS = 1;
LCD_RW = 0;
LCD_EN = 1;
LCD_PORT = dat;
_nop_();
LCD_EN = 0;
}
void lcd_init() {
LCD_RST = 0;
delay_ms(20);
LCD_RST = 1;
lcd_write_cmd(0x3f);
lcd_write_cmd(0xc0);
lcd_write_cmd(0xb8);
lcd_write_cmd(0x40);
}
void lcd_set_xy(unsigned char x, unsigned char y) {
if(x < 64) {
LCD_CS1 = 1;
LCD_CS2 = 0;
lcd_write_cmd(0x40 | x);
} else {
LCD_CS1 = 0;
LCD_CS2 = 1;
lcd_write_cmd(0x40 | (x - 64));
}
lcd_write_cmd(0xb8 | y);
}
void lcd_display(unsigned char *dat) {
unsigned int i;
for(i=0; i<1024; i++) {
lcd_write_data(dat[i]);
}
}
void main() {
lcd_init();
lcd_set_xy(0, 0);
lcd_display(logo);
while(1);
}
```
需要注意的是,这段代码中只给出了校徽的点阵数据,并没有包含完整的12864显示屏初始化和显示代码。如果需要完整的代码,可以参考相关的教程和资料。
阅读全文