找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5535|回复: 1
打印 上一主题 下一主题
收起左侧

STM32驱动GDEW042Z15电子墨水屏源程序

[复制链接]
跳转到指定楼层
楼主
ID:353710 发表于 2018-6-18 15:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
因为项目需求,最近一直在研究GDEW042Z15电子墨水屏幕。
电子墨水屏即为使用电子墨水的屏幕。电子墨水屏又被称为电子纸显示技术。
电子墨水是一种革新信息显示的新方法和技术。像多数传统墨水一样,电子墨水和改变它颜色的线路是可以打印到许多表面的,从弯曲塑料、聚脂膜、纸到布。和传统纸差异是电子墨水在通电时改变颜色,并且可以显示变化的图象,像计算器或手机那样的显示。
再驱动屏幕时使用了STM32芯片,可以驱动屏幕进行切换图片,高速刷新等功能。

单片机源程序如下:

  1. /*******************************************************************************/

  2. /* Includes ------------------------------------------------------------------*/
  3. #include "stm32f10x.h"
  4. #include "24cxx.h"
  5. #include "sys.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. void uart_init(u32 bound);
  16. void LED_Init(void);


  17. void EEPROM_PLAY(void);
  18. void EEPROM_Display(void);
  19. void EPPROM_READ(void);

  20. #define SDA_H  GPIO_SetBits(GPIOD, GPIO_Pin_10);          //PD.10
  21. #define SDA_L  GPIO_ResetBits(GPIOD, GPIO_Pin_10);          //PD.10

  22. #define SCLK_H GPIO_SetBits(GPIOD, GPIO_Pin_9);          //PD.9
  23. #define SCLK_L GPIO_ResetBits(GPIOD, GPIO_Pin_9);

  24. #define nCS_H  GPIO_SetBits(GPIOD, GPIO_Pin_8);          //PD.8
  25. #define nCS_L  GPIO_ResetBits(GPIOD, GPIO_Pin_8);

  26. #define nDC_H  GPIO_SetBits(GPIOE, GPIO_Pin_15); //PE.15
  27. #define nDC_L  GPIO_ResetBits(GPIOE, GPIO_Pin_15);

  28. #define nRST_H GPIO_SetBits(GPIOE, GPIO_Pin_14);   //PE.14
  29. #define nRST_L GPIO_ResetBits(GPIOE, GPIO_Pin_14);

  30. #define nBUSY  GPIO_ReadInputDataBit(GPIOE, GPIO_Pin_13) //PE.13

  31. #define nBS_H  GPIO_SetBits(GPIOE, GPIO_Pin_11);                 //PE.11
  32. #define nBS_L  GPIO_ResetBits(GPIOE, GPIO_Pin_11);

  33. #define VPP_H         GPIO_SetBits(GPIOA, GPIO_Pin_4);                        //PA4
  34. #define VPP_L         GPIO_ResetBits(GPIOA, GPIO_Pin_4);                        //PA4

  35. #define LED_1  GPIO_ResetBits(GPIOE, GPIO_Pin_12);
  36. #define LED_0  GPIO_SetBits(GPIOE, GPIO_Pin_12);

  37. void SPI4W_WRITECOM(unsigned char INIT_COM);
  38. void SPI4W_WRITEDATA(unsigned char INIT_DATA);
  39. void SPI4W_WRITE(unsigned char INIT_COM,unsigned char INIT_DATA);
  40. void MYRESET(void);
  41. void DELAY_100nS(unsigned int delaytime);
  42. void DELAY_mS(unsigned int delaytime);
  43. void DELAY_S(unsigned int delaytime);
  44. void DELAY_M(unsigned int delaytime);
  45. void READBUSY(void);

  46. int k=0;
  47. //unsigned char RECEIVE[15000];
  48. int RxCounter;
  49. unsigned int ReceiveState;


  50. unsigned char ZW[]=
  51. {
  52. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  53. …………
  54. …………
  55. …………限于本文篇幅 余下代码请从51黑下载附件…………
  56. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  57. };*/
  58.        
  59.        
  60.        
  61. void DELAY_100nS(unsigned int delaytime)   // 30us
  62. {
  63.         int i,j;
  64.         for(i=0;i<delaytime;i++)
  65.                 for(j=0;j<1;j++);
  66. }

  67. void DELAY_mS(unsigned int delaytime)            // 1ms
  68. {
  69.         int i,j;
  70.         for(i=0;i<delaytime;i++)
  71.                 {for(j=0;j<200;j++);}
  72. }
  73. void DELAY_S(unsigned int delaytime)     //  1s
  74. {
  75.         int i,j,k;
  76.         for(i=0;i<delaytime;i++)
  77.   {
  78.                 for(j=0;j<4000;j++)           
  79.                 {
  80.                         for(k=0;k<222;k++);
  81.                
  82.                 }
  83.         }
  84. }
  85. void DELAY_M(unsigned int delaytime)     //  1M
  86. {
  87.         int i;
  88.         for(i=0;i<delaytime;i++)
  89.                 DELAY_S(60);
  90. }

  91. void lcd_chkstatus(void)
  92. {
  93.         unsigned char busy;
  94.         do
  95.         {
  96.                 SPI4W_WRITECOM(0x71);
  97.                 busy = nBUSY;
  98.                 busy =!(busy & 0x01);        
  99.         }
  100.         while(busy);   
  101.         DELAY_mS(200);                       
  102. }


  103. void EPD_W21_Init(void)
  104. {
  105.         nBS_L;                                //4 wire spi mode selected
  106.        
  107.         nRST_L;                                //module reset       
  108.         DELAY_mS(1000);
  109.         nRST_H;
  110.         DELAY_mS(1000);       

  111. }



  112. void Ultrachip1(void)
  113. {
  114.         unsigned int i;
  115.         for(i=0;i<15000;i++)             
  116.         {
  117.                 SPI4W_WRITEDATA(G_Ultrachip1[i]);  
  118.         }  
  119.         DELAY_mS(2);                      
  120. }

  121. void Ultrachip_red1(void)
  122. {
  123.         unsigned int i;
  124.         for(i=0;i<15000;i++)             
  125.         {
  126.                 SPI4W_WRITEDATA(G_Ultrachip_red1[i]);  
  127.         }  
  128.         DELAY_mS(2);                      
  129. }


  130. /*void Ultrachip2(void)
  131. {
  132.         unsigned int i;
  133.         for(i=0;i<15000;i++)             
  134.         {
  135.                 SPI4W_WRITEDATA(G_Ultrachip2[i]);  
  136.         }  
  137.         DELAY_mS(2);                      
  138. }*/

  139. void Ultrachip_red2(void)
  140. {
  141.         unsigned int i;
  142.         for(i=0;i<15000;i++)             
  143.         {
  144.                 SPI4W_WRITEDATA(G_Ultrachip_red2[i]);  
  145.         }  
  146.         DELAY_mS(2);                      
  147. }

  148. void EPPROM_READ(void)
  149. {
  150.         unsigned int i,b;
  151.         unsigned char c;
  152.         b =100 ;
  153.         for(i=0;i<15000;i++)             
  154.         {
  155.                 c=AT24CXX_ReadOneByte(b);
  156.                 SPI4W_WRITEDATA(c);
  157.                 b++;
  158.         }  
  159.         DELAY_mS(2);                      
  160. }


  161. void pic_display(void)
  162. {
  163.                 SPI4W_WRITECOM(0x10);                 
  164.                 Ultrachip1();
  165.                 SPI4W_WRITECOM(0x13);
  166.                 Ultrachip_red1();

  167. }


  168. void Display(void)
  169. {
  170.                 EPD_W21_Init();
  171.        
  172.                 SPI4W_WRITECOM(0x06);         //boost设定
  173.                 SPI4W_WRITEDATA (0x17);
  174.                 SPI4W_WRITEDATA (0x17);
  175.                 SPI4W_WRITEDATA (0x17);       //07 0f 17 1f 27 2F 37 2f

  176.                 SPI4W_WRITECOM(0x04);  
  177.                 lcd_chkstatus();
  178.                 SPI4W_WRITECOM(0x00);
  179.                 SPI4W_WRITEDATA(0x0f);                // LUT from OTP


  180.                 pic_display();

  181.                 SPI4W_WRITECOM(0x12);
  182.                 DELAY_mS(100);                      
  183.                 lcd_chkstatus();

  184.        
  185.                 SPI4W_WRITECOM(0X50);
  186.                 SPI4W_WRITEDATA(0xf7);                //border floating       

  187.                 SPI4W_WRITECOM(0X02);                  //power off
  188.                 lcd_chkstatus();
  189.                 SPI4W_WRITECOM(0X07);                          //deep sleep
  190.                 SPI4W_WRITEDATA(0xA5);




  191.                 DELAY_mS(100);       
  192.                        
  193. }

  194. void EEPROM_Display(void)
  195. {
  196.                 EPD_W21_Init();
  197.        
  198.                 SPI4W_WRITECOM(0x06);         //boost设定
  199.                 SPI4W_WRITEDATA (0x17);
  200.                 SPI4W_WRITEDATA (0x17);
  201.                 SPI4W_WRITEDATA (0x17);       //07 0f 17 1f 27 2F 37 2f

  202.                 SPI4W_WRITECOM(0x04);  
  203.                 lcd_chkstatus();
  204.                 SPI4W_WRITECOM(0x00);
  205.                 SPI4W_WRITEDATA(0x0f);                // LUT from OTP


  206.                 EEPROM_PLAY();

  207.                 SPI4W_WRITECOM(0x12);
  208.                 DELAY_mS(100);                      
  209.                 lcd_chkstatus();

  210.                 /************************power off Sequence************************/
  211.                 SPI4W_WRITECOM(0X50);
  212.                 SPI4W_WRITEDATA(0xf7);                //border floating       

  213.                 SPI4W_WRITECOM(0X02);                  //power off
  214.                 lcd_chkstatus();
  215.                 SPI4W_WRITECOM(0X07);                          //deep sleep
  216.                 SPI4W_WRITEDATA(0xA5);
  217. /************************power off Sequence************************/


  218.                 DELAY_mS(100);       
  219.                        
  220. }

  221. void EEPROM_PLAY(void)
  222. {
  223.         SPI4W_WRITECOM(0x10);                 
  224.         EPPROM_READ();
  225.         SPI4W_WRITECOM(0x13);
  226.         Ultrachip_red2();
  227. }


  228. /*****************************************************************************************************/


  229. void SPI4W_WRITECOM(unsigned char INIT_COM)
  230. {
  231.         unsigned char TEMPCOM;
  232.         unsigned char scnt;
  233.         TEMPCOM=INIT_COM;
  234.         nCS_H
  235.         nCS_L
  236.         SCLK_L
  237.         nDC_L
  238.         for(scnt=0;scnt<8;scnt++)
  239.         {
  240.                 if(TEMPCOM&0x80)
  241.                         SDA_H
  242.                 else
  243.                         SDA_L
  244.                 DELAY_100nS(10);
  245.                 SCLK_H  
  246.                 DELAY_100nS(10);
  247.                 SCLK_L   
  248.                 TEMPCOM=TEMPCOM<<1;
  249.                 DELAY_100nS(10);
  250.         }
  251.         nCS_H  
  252. }
  253. void SPI4W_WRITEDATA(unsigned char INIT_DATA)
  254. {
  255.         unsigned char TEMPCOM;
  256.         unsigned char scnt;
  257.         TEMPCOM=INIT_DATA;
  258.         nCS_H
  259.         nCS_L
  260.         SCLK_L
  261.         nDC_H
  262.         for(scnt=0;scnt<8;scnt++)
  263.         {
  264.                 if(TEMPCOM&0x80)
  265.                         SDA_H
  266.                 else
  267.                         SDA_L
  268.                 DELAY_100nS(10);
  269.                 SCLK_H  
  270.                 DELAY_100nS(10);
  271.                 SCLK_L     
  272.                 TEMPCOM=TEMPCOM<<1;
  273.                 DELAY_100nS(10);
  274.         }
  275.         nCS_H
  276. }

  277. /*******************************************************************************
  278. * Function Name  : main
  279. * Description    : Main program
  280. * Input          : None
  281. * Output         : None
  282. * Return         : None
  283. #define NVIC_VectTab_FLASH  misc.h
  284. *******************************************************************************/
  285. /*int main(void)
  286. {
  287. #ifdef DEBUG
  288.   debug();
  289. #endif
  290.         int v,q,s;
  291.         char c;
  292.         DELAY_S(1);
  293.         // 系统时钟设置
  294.         RCC_Configuration();
  295.         //GPIO参数设置
  296.         GPIO_Configuration();
  297.         uart_init(115200);
  298.         AT24CXX_Init();
  299.         LED_Init();
  300.         //EPD_W21_Init();
  301.         AT24CXX_Init();
  302. //        VPP_H;
  303.         k=0;
  304.         v=100;
  305.         //EEPROM_Display();
  306.         Display();
  307.         while(1)
  308.         {
  309.         if(ReceiveState==1)
  310.         {
  311.                 ReceiveState=0;
  312.                 while(RxCounter--)
  313.                 {
  314.                         AT24CXX_WriteOneByte(v,RECEIVE[k]);
  315.                         v++;
  316.                         k++;
  317.                         //DELAY_mS(5);
  318.                 }
  319.                 LED_0;
  320.                 //c=AT24CXX_ReadOneByte(107);
  321.                 //USART_SendData(USART1,c);
  322.                 //while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
  323.                 EEPROM_Display();
  324.                 RxCounter=0;
  325.                 v=100;
  326.                 k=0;
  327.         }
  328.         }
  329. }*/
  330.        
  331. int main(void)
  332. {
  333. #ifdef DEBUG
  334.   debug();
  335. #endif
  336.         int i;
  337.         char c;
  338.         DELAY_S(1);
  339.         // 系统时钟设置
  340.         RCC_Configuration();
  341.         //GPIO参数设置
  342.         GPIO_Configuration();
  343.         uart_init(115200);
  344.         AT24CXX_Init();
  345.         LED_Init();
  346.         //EPD_W21_Init();
  347.         AT24CXX_Init();
  348.         DELAY_mS(5000);
  349.         for(i=1;i<30000;i++)
  350.         {
  351.                 //c=ZW[i];
  352.                 //USART_SendData(USART1,c);
  353.                 //while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
  354.                 AT24CXX_WriteOneByte(i,0x1c);
  355.         }
  356.         for(i=1;i<30000;i++)
  357.         {
  358.                 c=AT24CXX_ReadOneByte(i);        ;
  359.                 USART_SendData(USART1,c);
  360.                 while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
  361.         }
  362.         LED_1;
  363.         while(1);
  364. }


  365. /*******************************************************************************
  366. * Function Name  : RCC_Configuration
  367. * Description    : Configures the different system clocks.
  368. * Input          : None
  369. * Output         : None
  370. * Return         : None
  371. *******************************************************************************/
  372. void RCC_Configuration(void)
  373. {

  374.   // 复位RCC时钟配置(用于调试模式)
  375.   RCC_DeInit();

  376.   // 使能外部晶振
  377.   RCC_HSEConfig(RCC_HSE_ON);
  378.   
  379.   // 等待外部晶振稳定
  380.   HSEStartUpStatus = RCC_WaitForHSEStartUp();
  381.   if(HSEStartUpStatus == SUCCESS)
  382.   {
  383.     // 设置锁相环频率PLLCLK = 8MHz * 9 = 72 MHz
  384.     RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
  385.   }
  386.   else {
  387.     // 使能内部晶振
  388.     RCC_HSICmd(ENABLE);
  389.     // 等待内置振荡器稳定
  390.     while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);

  391.     // 设置锁相环频率PLLCLK = 8MHz/2 * 16 = 64 MHz
  392.     RCC_PLLConfig(RCC_PLLSource_HSI_Div2,RCC_PLLMul_16);
  393.   }

  394.     // 使能FLASH的预取缓冲
  395.   FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);

  396.   //设置代码延时值,FLASH_Latency_2为两个延时周期
  397.   FLASH_SetLatency(FLASH_Latency_2);
  398.        
  399.   //设置系统总线时钟
  400.   RCC_HCLKConfig(RCC_SYSCLK_Div1);

  401.   //设置高速设备总线时钟,RCC_HCLK_Div1为系统时钟除以1
  402.   RCC_PCLK2Config(RCC_HCLK_Div1);

  403.   //设置低速设备总线时钟,RCC_HCLK_Div2为系统时钟除以2
  404.   RCC_PCLK1Config(RCC_HCLK_Div2);
  405.   
  406.   //使能锁相环倍频
  407.   RCC_PLLCmd(ENABLE);
  408.   
  409.   // 等待锁相环倍频后的频率稳定
  410.   while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
  411.   
  412.   // 选择锁相环时钟为系统时钟源
  413.   RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
  414.   
  415.   // 等待设置完成
  416.   while(RCC_GetSYSCLKSource() != 0x08);
  417.    
  418.   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |
  419.             RCC_APB2Periph_USART1|RCC_APB2Periph_AFIO,
  420.             ENABLE);

  421. }

  422. /*******************************************************************************
  423. * 函数名   : GPIO_Configuration
  424. * 描述         : 设置设置串口所用GPIO引脚的参数
  425. * 输入         : None
  426. * 输出         : None
  427. * 返回         : None
  428. *******************************************************************************/
  429. void GPIO_Configuration(void)
  430. {
  431.   GPIO_InitTypeDef GPIO_InitStructure;

  432.   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
  433.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 |GPIO_Pin_10;    //abcd OE ST LT0输出
  434.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  435.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  436.   GPIO_Init(GPIOD, &GPIO_InitStructure);

  437.   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE, ENABLE);
  438.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_14 |GPIO_Pin_15;    //abcd OE ST LT0输出
  439.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  440.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  441.   GPIO_Init(GPIOE, &GPIO_InitStructure);

  442.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;    //abcd OE ST LT0输出
  443.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  444.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  445.   GPIO_Init(GPIOE, &GPIO_InitStructure);
  446.        
  447.   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
  448.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;    //VPP
  449.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  450.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  451.   GPIO_Init(GPIOA, &GPIO_InitStructure);
  452. }

  453. void uart_init(u32 bound)
  454. {
  455.   //GPIO端口设置
  456.   GPIO_InitTypeDef GPIO_InitStructure;
  457.         USART_InitTypeDef USART_InitStructure;
  458.         NVIC_InitTypeDef NVIC_InitStructure;
  459.          
  460.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1|RCC_APB2Periph_GPIOA, ENABLE);        //使能USART1,GPIOA时钟
  461.   
  462.         //USART1_TX   GPIOA.9
  463.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; //PA.9
  464.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  465.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;        //复用推挽输出
  466.   GPIO_Init(GPIOA, &GPIO_InitStructure);//初始化GPIOA.9
  467.    
  468.   //USART1_RX          GPIOA.10初始化
  469.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;//PA10
  470.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;//浮空输入
  471.   GPIO_Init(GPIOA, &GPIO_InitStructure);//初始化GPIOA.10  

  472.   //Usart1 NVIC 配置
  473.   NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
  474.         NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=3 ;//抢占优先级3
  475.         NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;                //子优先级3
  476.         NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;                        //IRQ通道使能
  477.         NVIC_Init(&NVIC_InitStructure);        //根据指定的参数初始化VIC寄存器
  478.   
  479.    //USART 初始化设置

  480.         USART_InitStructure.USART_BaudRate = bound;//串口波特率
  481.         USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
  482.         USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
  483.         USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
  484.         USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
  485.         USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;        //收发模式

  486.   USART_Init(USART1, &USART_InitStructure); //初始化串口1
  487.   USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);//开启串口接受中断
  488.   USART_Cmd(USART1, ENABLE);                    //使能串口1

  489. }

  490. void LED_Init(void)
  491. {

  492. GPIO_InitTypeDef  GPIO_InitStructure;
  493.        
  494. RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE, ENABLE);
  495.        
  496. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;                               
  497. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;                  
  498. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;               
  499. GPIO_Init(GPIOE, &GPIO_InitStructure);                                         
  500. GPIO_SetBits(GPIOE,GPIO_Pin_12);                                                 
  501. }

  502. /*******************************************************************************
  503. * Function Name  : NVIC_Configuration
  504. * Description    : Configures Vector Table base location.
  505. * Input          : None
  506. * Output         : None
  507. * Return         : None
  508. *******************************************************************************/
  509. void NVIC_Configuration(void)
  510. {
  511. // NVIC_InitTypeDef NVIC_InitStructure;
  512.   ;
  513. }


  514. #ifdef  DEBUG
  515. /*******************************************************************************
  516. * Function Name  : assert_failed
  517. * Description    : Reports the name of the source file and the source line number
  518. *                  where the assert_param error has occurred.
  519. * Input          : - file: pointer to the source file name
  520. *                  - line: assert_param error line source number
  521. * Output         : None
  522. * Return         : None
  523. *******************************************************************************/
  524. void assert_failed(u8* file, u32 line)
  525. {
  526.   /* User can add his own implementation to report the file name and line number,
  527.      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  528.   /* Infinite loop */
  529.   while (1)
  530.   {
  531.   }
  532. }
  533. #endif

  534. /*void USART1_IRQHandler(void)
  535. {
  536.         unsigned char num;
  537.         if (USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
  538.                 {  
  539.                                 USART_ClearITPendingBit(USART1, USART_IT_RXNE);
  540.                                 num=USART_ReceiveData(USART1);
  541.                                 LED_1;
  542.                                 if(num==0XDD)
  543.                                 {
  544.                                         ReceiveState=1;                               
  545.                                 }
  546.                                 else
  547.                                 {
  548.                                         RECEIVE[RxCounter++]=num;
  549.                                 }
  550.                                 //USART_SendData(USART1,RECEIVE[2]);
  551.     }  
  552. }*/

复制代码

所有资料51hei提供下载:
GDEW042Z15程序示例-OTP.rar (225.26 KB, 下载次数: 58)



分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:366839 发表于 2018-11-5 08:51 | 只看该作者
好资源
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表