迪文串口屏
stm32f103
单片机源程序如下:
- #include "stm32f10x.h"
- #include "sys.h"
- #include "delay.h"
- #include "usart.h"
- #include "beep.h"
- #include "led.h"
- #include "diwen.h"
- u8 pic[3]={0xaa,0x70,0x08}; //显示第8幅图片
- u8 wenben1[20]={0xaa,0x6f,0x00,0x08,0x00,0x0a,0x31,0x30,0x30,0x20,0x6d,0x6d,0x2f,0xb7,0xd6,0xd6,0xd3,0x20,0x20,0x20};
- //在x,y处显示24*24汉字100 mm/分钟 ;坐标8,10;
- u8 wenben2[20]={0xaa,0x6f,0x00,0x08,0x00,0x0a,0x20,0x39,0x30,0x30,0x20,0x6d,0x6d,0x2f,0xb7,0xd6,0xd6,0xd3,0x20,0x20};
- //在x,y处显示24*24汉字 900 mm/分钟 ;
- u8 color[6]={0xaa,0x40,0xf8,0x00,0x00,0x1f}; //设置当前调色板前景(红)后景(蓝)
- u8 clr[2]={0xaa,0x52}; //清屏
- u8 clr1[15]={0xaa,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0xef,0x00,0x00,0x00,0x00};
- //把第0幅图的x,y、到x1,y1处粘贴到当前图的x,y处
- u8 shuaxin[10]={0xaa,0x54,0x00,0x4b,0x00,0x7f,0x31,0x32,0x2e,0x34};
- int main(void)
- {
- //u8 i,j;
- delay_init();
- BEEP_Init();
- LED_Init();
- beep_set(1);
- uart_init(115200);
- acklcd(); //发送握手指令,等待LCD就绪
- color[5]=0x00; //背景色设置为 黑 色;
- send_str(color,6);
- en(); //发送设置调色板指令前景 红,背景 黑;
- delay_ms(500);
- send_str(clr,2); //清屏
- en();
-
- delay_ms(500);
- pic[1]=0x70;
- pic[2]=18;
- send_str(pic,3);
- en();
- color[2]=0x00;
- color[3]=0x1f;
- color[4]=0xff;
- color[5]=0xff;
- send_str(color,6);
- en();
- color[2]=0xf8;
- color[3]=0x00;
- color[4]=0x00;
- color[5]=0x1f;
- while(1)
- {
- gongkong(0x4b,0x7f,1,2,3); //(75,127)显示
- gongkong(0xf5,0x7f,2,3,1); //(245,127)显示
- gongkong(0x4b,0xb9,3,2,1); //(75,185)显示
- gongkong(0xf5,0xb9,1,1,1); //(245,185)显示
- delay_ms(500);
- delay_ms(500);
-
- }
- }
复制代码
所有资料51hei提供下载:
迪文试验-工控.7z
(185.41 KB, 下载次数: 142)
|