迪文屏控制例子
单片机源程序如下:
- #include "stm32f10x.h"
- #include "stm32f10x_it.h"
- #include "led1.h"
- #include "USART.h"
- //#include "stm32f10x_it.h"
- #define LED_1 GPIO_Pin_6 /*DS1使用的GPIO管脚*/
- #define LED_2 GPIO_Pin_7 /*DS2使用的GPIO管脚*/
- extern unsigned char KeyStop_Flag;
- unsigned char ii;
- extern unsigned int RxBuffer1[8];
- //unsigned char rec[10];
- unsigned char pic[3]={0xAA,0x70,0x00}; //图片显示
- unsigned char end[4]={0xCC,0x33,0xC3,0x3C}; //结束标志
- //unsigned char color[6]={0xAA,0x40,0xF8,0x00,0x00,0x1F}; //设置当前调色板
- //unsigned char qiewb[15]={0xAA,0x71,0,0x00,0x00,0x01,0xB5,0x02,0x80,0x01,0xE0,0x00,0x00,0x01,0xB5}; //剪切图片显示
- void Delay(vu32 nCount);
- void en(void)
- {
- USART1WriteDat(end,4);
- }
- int main(void)
- {
- BSP_LED_Init();
- USART_Configuration();
- NVIC_Configuration();
- ii=0;
- // BSP_LED_On();
- // BSP_LED_Init(LED_2);
- while(1)
- {
- // USART1_Putc(0x06);
- // USART1_Puts("yanghai haha\n");
- if(KeyStop_Flag==0)
- {
- pic[2]=ii;
- USART1WriteDat(pic,3);
- en();
- ii++;
- if(ii==13)
- {
- ii=0;
- }
- }
- //while(KeyStop_Flag);
- BSP_LED_Off();
- Delay(0x4FFFFF);
- BSP_LED_On();
- Delay(0x4FFFFF);
-
- }
- }
- /*******************************************************************************
- * Function Name : Delay
- ……………………
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
stm32 control deven LCD.rar
(28.39 KB, 下载次数: 131)
|