E-Ink_1.54.7z
(148.96 KB, 下载次数: 27)
1.54寸墨水屏模块 黑白屏模块.7z
(2.71 MB, 下载次数: 28)
IL0373.pdf
(854.43 KB, 下载次数: 17)
IL0371数据手册.pdf
(889.91 KB, 下载次数: 22)
单片机源程序如下:
- /*******************************************************************************/
- /* Includes ------------------------------------------------------------------*/
- #include "stm32f10x.h"
- #include "Display_EPD_W21_spi.h"
- #include "Display_EPD_W21.h"
- /* Private typedef -----------------------------------------------------------*/
- /* Private define ------------------------------------------------------------*/
- /* Private macro -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- ErrorStatus HSEStartUpStatus;
- /* Private function prototypes -----------------------------------------------*/
- void RCC_Configuration(void);
- void NVIC_Configuration(void);
- void GPIO_Configuration(void);
- const unsigned char logo[] = {
- 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
- 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
- 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
- ^^^^^^^^^^^^^^^^^^
- ^^^^^^^^^中间省略
- 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
- 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
- };
- const unsigned char LUTDefault_part[31] = {
- 0x32, // command
- /* 0x00,0x00,0x00,0x18,
- 0x18,0x18,0x18,0x00,
- 0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,
- 0x40,0x14,0x34,0x01,
- 0x00,0x00,0x00,0x00,
- 0x00,0x00,
- */
- 0x10 //C221 25C partial update waveform
- ,0x18
- ,0x18
- ,0x08
- ,0x18
- ,0x18
- ,0x08
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x13
- ,0x14
- ,0x44
- ,0x12
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- };
- const unsigned char LUTDefault_full[31] = {
- 0x32, // command
- /* 0x11,0x11,0x10,0x02, // full
- 0x02,0x22,0x22,0x22,
- 0x22,0x22,0x51,0x51,
- 0x55,0x88,0x08,0x08,
- 0x88,0x88,0x00,0x00,
- 0x34,0x23,0x12,0x21,
- 0x24,0x28,0x22,0x21,
- 0xA1,0x01
- */
- 0x02 //C221 25C Full update waveform
- ,0x02
- ,0x01
- ,0x11
- ,0x12
- ,0x12
- ,0x22
- ,0x22
- ,0x66
- ,0x69
- ,0x69
- ,0x59
- ,0x58
- ,0x99
- ,0x99
- ,0x88
- ,0x00
- ,0x00
- ,0x00
- ,0x00
- ,0xF8
- ,0xB4
- ,0x13
- ,0x51
- ,0x35
- ,0x51
- ,0x51
- ,0x19
- ,0x01
- ,0x00
- };
- //unsigned int IC_SWITCH;
- //unsigned char vcom;
- void lcd_chkstatus(void);
- void lut_red(void);
- void lut_bw(void);
- void Ultrachip_red(void);
- void Ultrachip(void);
- void master_uc8154_init(void);
- void Ultrachip_red1(void);
- void Ultrachip1(void);
- void pic_display(void);
- unsigned char EPD_W21_ReadDATA(void);
- void driver_delay_us(unsigned int xus)
- {
- for(;xus>1;xus--);
- }
- void driver_delay_xms(unsigned long xms)
- {
- unsigned long i = 0 , j=0;
- for(j=0;j<xms;j++)
- {
- for(i=0; i<256; i++);
- }
- }
- void parttest()
- {
- unsigned int i,j,k;
- EPD_W21_WirteLUT((unsigned char *)LUTDefault_part);
- EPD_W21_POWERON();
- part_display(0x00,0x18,0xc7,0x00,0x00,0x00); // set ram
- EPD_W21_UpdataDisplay((unsigned char *)logo,200,200);
- EPD_W21_Update1();
- driver_delay_xms(100000);
- part_display(0x00,0x18,0xc7,0x00,0x00,0x00); // set ram
- EPD_W21_UpdataDisplay((unsigned char *)logo,200,200);
- driver_delay_xms(10000);
- for(i=0;i<6;i++)
- {
- k=200-i*32-4;
- j=k-32;
- part_display(0x12,0x12,k%256,k/256,j%256,j/256); // set ram
- EPD_W21_WriteDispRamMono(8, 32, 0x00); // white
- EPD_W21_Update1();
- driver_delay_xms(20000);
- part_display(0x12,0x12,k%256,k/256,j%256,j/256); // set ram
- EPD_W21_WriteDispRamMono(8, 32, 0x00); // white
- driver_delay_xms(10000);
- }
- }
- void EPD_init(void)
- {
- EPD_W21_Init(); // display
- EPD_W21_WirteLUT((unsigned char *)LUTDefault_full);
- EPD_W21_POWERON();
- driver_delay_xms(30000);
- EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
- EPD_W21_WriteDispRam(200, 200, (unsigned char *)second); // white
- EPD_W21_Update();
- driver_delay_xms(300000);
- EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
- EPD_W21_WriteDispRam(200, 200, (unsigned char *)third); // white
- EPD_W21_Update();
- driver_delay_xms(200000);
- EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
- EPD_W21_WriteDispRam(200, 200, (unsigned char *)forth); // white
- EPD_W21_Update();
- driver_delay_xms(200000);
-
- EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
- EPD_W21_WriteDispRam(200, 200, (unsigned char *)five); // white
- EPD_W21_Update();
- driver_delay_xms(200000);
-
- EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
- EPD_W21_WriteDispRam(200, 200, (unsigned char *)logo); // white
- EPD_W21_Update();
- driver_delay_xms(100000);
- EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
- EPD_W21_WriteDispRam(200, 200, (unsigned char *)logo); // white
- EPD_W21_Update();
- driver_delay_xms(100000);
- parttest();
- }
- /*******************************************************************************
- * Function Name : main
- * Description : Main program
- * Input : None
- * Output : None
- * Return : None
- #define NVIC_VectTab_FLASH misc.h
- *******************************************************************************/
- int main(void)
- {
-
- #ifdef DEBUG
- debug();
- #endif
- // 系统时钟设置
- RCC_Configuration();
- //GPIO参数设置
- GPIO_Configuration();
-
- EPD_init();
- }
- /***********************************************************
- end file
- ***********************************************************/
- /*******************************************************************************
- * Function Name : RCC_Configuration
- * Description : Configures the different system clocks.
- * Input : None
- * Output : None
- * Return : None
- *******************************************************************************/
- void RCC_Configuration(void)
- {
-
- // 复位RCC时钟配置(用于调试模式)
- RCC_DeInit();
-
- // 使能外部晶振
- RCC_HSEConfig(RCC_HSE_ON);
-
- // 等待外部晶振稳定
- HSEStartUpStatus = RCC_WaitForHSEStartUp();
- if(HSEStartUpStatus == SUCCESS)
- {
- // 设置锁相环频率PLLCLK = 8MHz * 9 = 72 MHz
- RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
- }
- else {
- // 使能内部晶振
- RCC_HSICmd(ENABLE);
- // 等待内置振荡器稳定
- while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);
- // 设置锁相环频率PLLCLK = 8MHz/2 * 16 = 64 MHz
- RCC_PLLConfig(RCC_PLLSource_HSI_Div2,RCC_PLLMul_16);
- }
- // 使能FLASH的预取缓冲
- FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
- //设置代码延时值,FLASH_Latency_2为两个延时周期
- FLASH_SetLatency(FLASH_Latency_2);
-
- //设置系统总线时钟
- RCC_HCLKConfig(RCC_SYSCLK_Div1);
- //设置高速设备总线时钟,RCC_HCLK_Div1为系统时钟除以1
- RCC_PCLK2Config(RCC_HCLK_Div1);
- //设置低速设备总线时钟,RCC_HCLK_Div2为系统时钟除以2
- RCC_PCLK1Config(RCC_HCLK_Div2);
-
- //使能锁相环倍频
- RCC_PLLCmd(ENABLE);
-
- // 等待锁相环倍频后的频率稳定
- while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
-
- // 选择锁相环时钟为系统时钟源
- RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
-
- // 等待设置完成
- while(RCC_GetSYSCLKSource() != 0x08);
-
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |
- RCC_APB2Periph_USART1|RCC_APB2Periph_AFIO,
- ENABLE);
- }
- /*******************************************************************************
- * 函数名 : GPIO_Configuration
- * 描述 : 设置设置串口所用GPIO引脚的参数
- * 输入 : None
- * 输出 : None
- * 返回 : None
- *******************************************************************************/
- void GPIO_Configuration(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 |GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5; //abcd OE ST LT0输出
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- }
- /*******************************************************************************
- * Function Name : NVIC_Configuration
- * Description : Configures Vector Table base location.
- * Input : None
- * Output : None
- * Return : None
- *******************************************************************************/
- void NVIC_Configuration(void)
- {
- //NVIC_InitTypeDef NVIC_InitStructure;
- ;
- }
- #ifdef DEBUG
- /*******************************************************************************
- * Function Name : assert_failed
- * Description : Reports the name of the source file and the source line number
- * where the assert_param error has occurred.
- * Input : - file: pointer to the source file name
- * - line: assert_param error line source number
- * Output : None
- * Return : None
- *******************************************************************************/
- void assert_failed(u8* file, u32 line)
- {
- /* User can add his own implementation to report the file name and line number,
- ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
- /* Infinite loop */
- while (1)
- {
- }
- }
- #endif
复制代码
|