找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 3562|回復(fù): 0
收起左側(cè)

IL0371 SSD1608 1.54inch墨水屏程序資料下載

[復(fù)制鏈接]
ID:442993 發(fā)表于 2019-7-28 17:02 | 顯示全部樓層 |閱讀模式
E-Ink_1.54.7z (148.96 KB, 下載次數(shù): 27)
1.54寸墨水屏模塊 黑白屏模塊.7z (2.71 MB, 下載次數(shù): 28)
IL0373.pdf (854.43 KB, 下載次數(shù): 17)
IL0371數(shù)據(jù)手冊(cè).pdf (889.91 KB, 下載次數(shù): 22)

單片機(jī)源程序如下:
  1. /*******************************************************************************/
  2. /* Includes ------------------------------------------------------------------*/
  3. #include "stm32f10x.h"
  4. #include "Display_EPD_W21_spi.h"
  5. #include "Display_EPD_W21.h"

  6. /* Private typedef -----------------------------------------------------------*/
  7. /* Private define ------------------------------------------------------------*/
  8. /* Private macro -------------------------------------------------------------*/
  9. /* Private variables ---------------------------------------------------------*/

  10. ErrorStatus HSEStartUpStatus;


  11. /* Private function prototypes -----------------------------------------------*/
  12. void RCC_Configuration(void);
  13. void NVIC_Configuration(void);
  14. void GPIO_Configuration(void);



  15. const unsigned char logo[] = {
  16. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  17. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  18. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  19. ^^^^^^^^^^^^^^^^^^
  20. ^^^^^^^^^中間省略
  21. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  22. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  23. };

  24. const unsigned char LUTDefault_part[31] = {
  25.         0x32,        // command

  26. /*        0x00,0x00,0x00,0x18,       
  27.         0x18,0x18,0x18,0x00,
  28.         0x00,0x00,0x00,0x00,
  29.         0x00,0x00,0x00,0x00,
  30.         0x00,0x00,0x00,0x00,
  31.         0x40,0x14,0x34,0x01,
  32.         0x00,0x00,0x00,0x00,
  33.         0x00,0x00,
  34. */
  35. 0x10 //C221 25C partial update waveform
  36. ,0x18
  37. ,0x18
  38. ,0x08
  39. ,0x18
  40. ,0x18
  41. ,0x08
  42. ,0x00
  43. ,0x00
  44. ,0x00
  45. ,0x00
  46. ,0x00
  47. ,0x00
  48. ,0x00
  49. ,0x00
  50. ,0x00
  51. ,0x00
  52. ,0x00
  53. ,0x00
  54. ,0x00
  55. ,0x13
  56. ,0x14
  57. ,0x44
  58. ,0x12
  59. ,0x00
  60. ,0x00
  61. ,0x00
  62. ,0x00
  63. ,0x00
  64. ,0x00

  65.         };

  66. const unsigned char LUTDefault_full[31] = {
  67.         0x32,        // command
  68. /*        0x11,0x11,0x10,0x02,        // full
  69.         0x02,0x22,0x22,0x22,
  70.         0x22,0x22,0x51,0x51,
  71.         0x55,0x88,0x08,0x08,
  72.     0x88,0x88,0x00,0x00,
  73.         0x34,0x23,0x12,0x21,
  74.         0x24,0x28,0x22,0x21,
  75.         0xA1,0x01
  76. */
  77. 0x02 //C221 25C Full update waveform
  78. ,0x02
  79. ,0x01
  80. ,0x11
  81. ,0x12
  82. ,0x12
  83. ,0x22
  84. ,0x22
  85. ,0x66
  86. ,0x69
  87. ,0x69
  88. ,0x59
  89. ,0x58
  90. ,0x99
  91. ,0x99
  92. ,0x88
  93. ,0x00
  94. ,0x00
  95. ,0x00
  96. ,0x00
  97. ,0xF8
  98. ,0xB4
  99. ,0x13
  100. ,0x51
  101. ,0x35
  102. ,0x51
  103. ,0x51
  104. ,0x19
  105. ,0x01
  106. ,0x00
  107.         };


  108. //unsigned int IC_SWITCH;
  109. //unsigned char vcom;
  110. void lcd_chkstatus(void);
  111. void lut_red(void);
  112. void lut_bw(void);
  113. void Ultrachip_red(void);
  114. void Ultrachip(void);
  115. void master_uc8154_init(void);
  116. void Ultrachip_red1(void);
  117. void Ultrachip1(void);
  118. void pic_display(void);
  119. unsigned char  EPD_W21_ReadDATA(void);
  120. void driver_delay_us(unsigned int xus)
  121. {
  122.         for(;xus>1;xus--);
  123. }

  124. void driver_delay_xms(unsigned long xms)       
  125. {       
  126.     unsigned long i = 0 , j=0;

  127.     for(j=0;j<xms;j++)
  128.         {
  129.         for(i=0; i<256; i++);
  130.     }
  131. }

  132. void parttest()
  133. {
  134.    unsigned int i,j,k;

  135.    EPD_W21_WirteLUT((unsigned char *)LUTDefault_part);
  136.    EPD_W21_POWERON();

  137.                 part_display(0x00,0x18,0xc7,0x00,0x00,0x00);        // set ram       
  138.                 EPD_W21_UpdataDisplay((unsigned char *)logo,200,200);
  139.                 EPD_W21_Update1();
  140.                 driver_delay_xms(100000);
  141.                 part_display(0x00,0x18,0xc7,0x00,0x00,0x00);        // set ram
  142.                 EPD_W21_UpdataDisplay((unsigned char *)logo,200,200);
  143.                 driver_delay_xms(10000);

  144.                 for(i=0;i<6;i++)
  145.                 {
  146.                     k=200-i*32-4;
  147.                         j=k-32;
  148.                         part_display(0x12,0x12,k%256,k/256,j%256,j/256);        // set ram       
  149.                         EPD_W21_WriteDispRamMono(8, 32, 0x00);        // white
  150.                          EPD_W21_Update1();
  151.                         driver_delay_xms(20000);
  152.                         part_display(0x12,0x12,k%256,k/256,j%256,j/256);        // set ram       
  153.                         EPD_W21_WriteDispRamMono(8, 32, 0x00);        // white
  154.                         driver_delay_xms(10000);       
  155.                 }       
  156. }       

  157. void EPD_init(void)
  158. {               
  159.                 EPD_W21_Init();                        // display
  160.                 EPD_W21_WirteLUT((unsigned char *)LUTDefault_full);
  161.             EPD_W21_POWERON();
  162.         driver_delay_xms(30000);

  163.                 EPD_W21_SetRamPointer(0x00,0xC7,0x00);        // set ram
  164.                 EPD_W21_WriteDispRam(200, 200, (unsigned char *)second);        // white       
  165.                 EPD_W21_Update();       
  166.                 driver_delay_xms(300000);

  167.                 EPD_W21_SetRamPointer(0x00,0xC7,0x00);        // set ram
  168.                 EPD_W21_WriteDispRam(200, 200, (unsigned char *)third);        // white       
  169.                 EPD_W21_Update();       
  170.                 driver_delay_xms(200000);

  171.                 EPD_W21_SetRamPointer(0x00,0xC7,0x00);        // set ram
  172.                 EPD_W21_WriteDispRam(200, 200, (unsigned char *)forth);        // white       
  173.                 EPD_W21_Update();       
  174.                 driver_delay_xms(200000);
  175.        
  176.                         EPD_W21_SetRamPointer(0x00,0xC7,0x00);        // set ram
  177.                 EPD_W21_WriteDispRam(200, 200, (unsigned char *)five);        // white       
  178.                 EPD_W21_Update();       
  179.                 driver_delay_xms(200000);
  180.        
  181.                 EPD_W21_SetRamPointer(0x00,0xC7,0x00);        // set ram
  182.                 EPD_W21_WriteDispRam(200, 200, (unsigned char *)logo);        // white       
  183.                 EPD_W21_Update();       
  184.                 driver_delay_xms(100000);

  185.                 EPD_W21_SetRamPointer(0x00,0xC7,0x00);        // set ram
  186.                 EPD_W21_WriteDispRam(200, 200, (unsigned char *)logo);        // white       
  187.                 EPD_W21_Update();       
  188.                 driver_delay_xms(100000);
  189.                 parttest();

  190. }


  191. /*******************************************************************************
  192. * Function Name  : main
  193. * Description    : Main program
  194. * Input          : None
  195. * Output         : None
  196. * Return         : None
  197. #define NVIC_VectTab_FLASH  misc.h
  198. *******************************************************************************/
  199. int main(void)
  200. {
  201.   

  202. #ifdef DEBUG
  203.   debug();
  204. #endif
  205.   // 系統(tǒng)時(shí)鐘設(shè)置
  206.    RCC_Configuration();
  207.   //GPIO參數(shù)設(shè)置
  208.    GPIO_Configuration();
  209.        
  210.    EPD_init();

  211. }


  212. /***********************************************************
  213.                                                 end file
  214. ***********************************************************/

  215. /*******************************************************************************
  216. * Function Name  : RCC_Configuration
  217. * Description    : Configures the different system clocks.
  218. * Input          : None
  219. * Output         : None
  220. * Return         : None
  221. *******************************************************************************/
  222. void RCC_Configuration(void)
  223. {

  224.   // 復(fù)位RCC時(shí)鐘配置(用于調(diào)試模式)
  225.   RCC_DeInit();

  226.   // 使能外部晶振
  227.   RCC_HSEConfig(RCC_HSE_ON);
  228.   
  229.   // 等待外部晶振穩(wěn)定
  230.   HSEStartUpStatus = RCC_WaitForHSEStartUp();
  231.   if(HSEStartUpStatus == SUCCESS)
  232.   {
  233.     // 設(shè)置鎖相環(huán)頻率PLLCLK = 8MHz * 9 = 72 MHz
  234.     RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
  235.   }
  236.   else {
  237.     // 使能內(nèi)部晶振
  238.     RCC_HSICmd(ENABLE);
  239.     // 等待內(nèi)置振蕩器穩(wěn)定
  240.     while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);

  241.     // 設(shè)置鎖相環(huán)頻率PLLCLK = 8MHz/2 * 16 = 64 MHz
  242.     RCC_PLLConfig(RCC_PLLSource_HSI_Div2,RCC_PLLMul_16);
  243.   }

  244.     // 使能FLASH的預(yù)取緩沖
  245.   FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);

  246.   //設(shè)置代碼延時(shí)值,FLASH_Latency_2為兩個(gè)延時(shí)周期
  247.   FLASH_SetLatency(FLASH_Latency_2);
  248.        
  249.   //設(shè)置系統(tǒng)總線(xiàn)時(shí)鐘
  250.   RCC_HCLKConfig(RCC_SYSCLK_Div1);

  251.   //設(shè)置高速設(shè)備總線(xiàn)時(shí)鐘,RCC_HCLK_Div1為系統(tǒng)時(shí)鐘除以1
  252.   RCC_PCLK2Config(RCC_HCLK_Div1);

  253.   //設(shè)置低速設(shè)備總線(xiàn)時(shí)鐘,RCC_HCLK_Div2為系統(tǒng)時(shí)鐘除以2
  254.   RCC_PCLK1Config(RCC_HCLK_Div2);
  255.   
  256.   //使能鎖相環(huán)倍頻
  257.   RCC_PLLCmd(ENABLE);
  258.   
  259.   // 等待鎖相環(huán)倍頻后的頻率穩(wěn)定
  260.   while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
  261.   
  262.   // 選擇鎖相環(huán)時(shí)鐘為系統(tǒng)時(shí)鐘源
  263.   RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
  264.   
  265.   // 等待設(shè)置完成
  266.   while(RCC_GetSYSCLKSource() != 0x08);
  267.    
  268.   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |
  269.             RCC_APB2Periph_USART1|RCC_APB2Periph_AFIO,
  270.             ENABLE);

  271. }

  272. /*******************************************************************************
  273. * 函數(shù)名   : GPIO_Configuration
  274. * 描述         : 設(shè)置設(shè)置串口所用GPIO引腳的參數(shù)
  275. * 輸入         : None
  276. * 輸出         : None
  277. * 返回         : None
  278. *******************************************************************************/
  279. void GPIO_Configuration(void)
  280. {
  281.   GPIO_InitTypeDef GPIO_InitStructure;

  282.   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
  283.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 |GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5;    //abcd OE ST LT0輸出
  284.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  285.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  286.   GPIO_Init(GPIOA, &GPIO_InitStructure);


  287. }

  288. /*******************************************************************************
  289. * Function Name  : NVIC_Configuration
  290. * Description    : Configures Vector Table base location.
  291. * Input          : None
  292. * Output         : None
  293. * Return         : None
  294. *******************************************************************************/
  295. void NVIC_Configuration(void)
  296. {
  297.   //NVIC_InitTypeDef NVIC_InitStructure;
  298.   ;
  299. }


  300. #ifdef  DEBUG
  301. /*******************************************************************************
  302. * Function Name  : assert_failed
  303. * Description    : Reports the name of the source file and the source line number
  304. *                  where the assert_param error has occurred.
  305. * Input          : - file: pointer to the source file name
  306. *                  - line: assert_param error line source number
  307. * Output         : None
  308. * Return         : None
  309. *******************************************************************************/
  310. void assert_failed(u8* file, u32 line)
  311. {
  312.   /* User can add his own implementation to report the file name and line number,
  313.      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  314.   /* Infinite loop */
  315.   while (1)
  316.   {
  317.   }
  318. }
  319. #endif
復(fù)制代碼



評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表