找回密码
 立即注册

QQ登录

只需一步,快速开始

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

stm32成功驱动lcd12864液晶屏显示电压电流

  [复制链接]
跳转到指定楼层
楼主
stm32_12864
单片机源程序如下:
  1. #include <stdio.h>
  2. #include "adc.h"
  3. #include "tim.h"
  4. #include "Systick.h"
  5. #include "lcd1602.h"
  6. #include "LCD12864.h"
  7. //
  8. /* Private function prototypes -----------------------------------------------*/

  9. #define  LED_GPIO   GPIOB
  10. #define  LED3  GPIO_Pin_8
  11. #define  LED4  GPIO_Pin_9
  12. #define  KEY_GPIO   GPIOB
  13. #define  KEY1  GPIO_Pin_5
  14. #define  KEY2  GPIO_Pin_6
  15. #define  KEY3  GPIO_Pin_7
  16. //
  17. //#define Ture  0x00;
  18. //#define False  0xFF;
  19. //#define No_Key_Press 0x00;
  20. //#define Key_Press 0xFF;

  21. char LCD12864_STR[] = "OUT 12V Time=   ";
  22. u8 LCD12864_DAT[] = {0x11,0x22};

  23. ///*
  24.         u8  Disp_Buf[] = {0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,\
  25.                                                                     0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,\
  26.                                                                     0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,\
  27.                                                                     0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f};

  28. void Delay(__IO uint32_t nCount);
  29. u16 ua = 0;
  30. u16 ub = 0;
  31. u16 uc = 0;
  32. u16 i = 678;
  33. u16 uab,ubb,ucb,ib;
  34. u16 T2_prescaler = 7200-1;
  35. u16 T2_time = 100-1;
  36. u8 time_sec;
  37. char Time2_Flg = 0x00;
  38. u32  Time_Cont ;        
  39. u8 Key_Code=0x00;
  40. u8 Fun_Code=0x00;
  41. char Run_Code = 0x00;                                                                                
  42. u8 Set_Val = 0x00;                                //电压或电流输出值
  43. char Key_Press = 0xFF;
  44. char No_Key_Press = 0x00;
  45. char Ture = 0x00;
  46. char False = 0xFF;
  47. char RUN = 0x00;
  48. char NO_RUN = 0xFF;
  49. char Key_Release = 0x00;
  50. //char LED3_Flg = 0x00;                                                                        
  51. //char LED4_Flg = 0x00;
  52. char Key_Flg  = 0x00;               

  53.                                                                                 
  54. /*
  55. u8 u1buffer[4]={0};   //存放u1值 用于显示的缓冲数组
  56. u8 u2buffer[4]={0};   //存放u2
  57. */
  58. //char u1buffer[4]={0};   //存放u1值 用于显示的缓冲数组
  59. //char u2buffer[4]={0};   //存放u2

  60. //static void SYS_init(void);
  61. static void user_init(void);
  62. void RCC_Config(void);
  63. void NVIC_Config(void);
  64. void GPIO_Config(void);
  65. void USART1_IRQHandler(void);
  66. void UART5_IRQHandler(void);
  67. void LCD12864_init(void);
  68. void Disp_Dat(u16 u1,u16 u2,u32 t);
  69. static u16 Calculat_U(int k,int nux);
  70. void Time2_config(u16 prescaler,u16 time);
  71. void Time2_IRQHandler(void);

  72. //按键状态处理函数
  73. void Key_Code00( void);
  74. void Key_Code01( void);
  75. void Key_Code02( void);
  76. void Key_Code03( void);
  77. void Key_Code04( void);
  78. void Key_Code05( void);
  79. void Key_Code06( void);
  80. void Key_Code07( void);
  81. //功能编码处理函数
  82. void Fun_Code00( void);
  83. void Fun_Code01( void);
  84. void Fun_Code02( void);
  85. void Fun_Code03( void);
  86. void Fun_Code04( void);
  87. void Fun_Code05( void);
  88. void Fun_Code06( void);
  89. void Fun_Code07( void);
  90. //************************************************************************************************
  91. //
  92. //
  93. //
  94. //************************************************************************************************
  95. int main( )
  96. {
  97. //
  98.   u8 j;
  99.         u8 Jmp_Code;
  100.         Run_Code = RUN;
  101. //        u8 LED_FLG=0;
  102.                
  103.         RCC_Config();
  104.         delay_us(10);        
  105.         GPIO_Config();
  106.         delay_us(10);        
  107. // NVIC_Config();

  108.         //UART1_Config(115200);
  109.   //UART5_Config(115200);        

  110.         for(j=0;j<6;j++)
  111.         {
  112.                 GPIO_SetBits(LED_GPIO, LED3);// LED3亮         
  113.                 GPIO_ResetBits(LED_GPIO, LED4);// LED4灭?
  114.                 delay_ms(100);
  115.                 GPIO_ResetBits(LED_GPIO, LED3);        //LED3灭
  116.                 GPIO_SetBits(LED_GPIO, LED4);        //LED4灭
  117.                 delay_ms(100);
  118.         }
  119.                 GPIO_ResetBits(LED_GPIO, LED3);        //LED3灭               
  120.                 GPIO_ResetBits(LED_GPIO, LED4);        //LED4灭        
  121.                
  122.          //gpio_config();
  123.         delay_us(10);
  124.         ADC_Config();
  125.         DMA_Config();
  126.         Tim2_Config(T2_prescaler,T2_time );
  127.         //Tim2_Config(TWENTYMS);
  128.         delay_us(10);
  129.                
  130.         LCD12864_Init();        
  131. //        LCD12864_ShowString(2,0,"ZIGBEE R 1C");
  132. //        LCD12864_ShowString(3,0,"LCD12864");
  133. //        user_init();
  134.         
  135.         while(1)
  136.         {
  137.                 u16 nad;
  138.                 delay_ms(100);        
  139.                 nad = read_adc(0);  //得到对应通道的adc值
  140.                 ua = Calculat_U(5,nad);//求出对应的实际电压值
  141.                 ua=(ua+uab)/2;
  142.                 uab=ua;
  143.                 nad = read_adc(1);//u2的ad值
  144.                 ub = Calculat_U(1,nad);//u2的实际值
  145.                 ub=(ub+ubb)/2;
  146.                 ubb=ub;
  147.                 uc=(uc+2)&0x0FFFF;
  148.     //Time_Cont = Time_Cont++;
  149.           Disp_Dat(ua,ub,Time_Cont);
  150.                 LCD12864_Disp( );//显示u1和u2
  151.           //如果有按键按下,依据按键组合编码转移到不同处理分支进行处理
  152. //                if (Run_Code == RUN)
  153. //                {
  154. //                  Disp_Buf[0x0C] = ' ';
  155. //                        Disp_Buf[0x0D] = 'R';
  156. //                        Disp_Buf[0x0E] = 'U';
  157. //                        Disp_Buf[0x0F] = 'N';
  158.                         //按照设定的功能编码转移到不同处理分支。
  159.                         switch(Fun_Code)
  160.                   {
  161.                         case 0x00:
  162.                                 Fun_Code00();                        
  163.                                 break;
  164.                         case 0x01:
  165.                                 Fun_Code01();
  166.                                 break;
  167.                         case 0x02:
  168.                                 Fun_Code02( );
  169.                                 break;
  170.                         case 0x03:
  171.                                 Fun_Code03( );
  172.                                 break;                                
  173.                         case 0x04:
  174.                                 Fun_Code04( );
  175.                                 break;
  176.                         case 0x05:
  177.                                 Fun_Code05( );
  178.                                 break;
  179.                         case 0x06:
  180.                                 Fun_Code06( );
  181.                                 break;
  182.                         case 0x07:
  183.                                 Fun_Code07( );
  184.                                 break;
  185.                         }
  186. /*    }
  187.     else
  188.           {
  189.             Disp_Buf[0x0C] = ' ';
  190.                         Disp_Buf[0x0D] = 'S';
  191.                         Disp_Buf[0x0E] = 'E';
  192.                         Disp_Buf[0x0F] = 'T';
  193.                 }
  194. */
  195. //*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^               
  196.                 if (Key_Flg == Key_Press)
  197.                 {
  198.                         Key_Flg = No_Key_Press;                //进入按键处理程序,清除按键标志。
  199.                         Jmp_Code = Key_Code;
  200.                         switch (Jmp_Code)
  201.                         {
  202.                                 case 0x00:
  203.                                         Key_Code00();                        
  204.                                         break;
  205.                                 case 0x01:
  206.                                         Key_Code01();
  207.                                         break;
  208.                                 case 0x02:
  209.                                         Key_Code02( );
  210.                                         break;
  211.                                 case 0x03:
  212.                                         Key_Code03( );
  213.                                         break;                                
  214.                                 case 0x04:
  215.                                         Key_Code04( );
  216.                                         break;
  217.                                 case 0x05:
  218.                                         Key_Code05( );
  219.                                         break;
  220.                                 case 0x06:
  221.                                         Key_Code06( );
  222.                                         break;
  223.                                 case 0x07:
  224.                                         Key_Code07( );
  225.                                         Key_Release = False;
  226.                                   break;
  227.                           }
  228.                   }        
  229. //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/                        
  230. //信号灯LED3闪烁。表明主函数运行               
  231.                 if (GPIO_ReadInputDataBit(LED_GPIO,LED3) == Bit_SET)
  232.                 {
  233.                         GPIO_ResetBits(LED_GPIO, LED3);// LED3亮
  234. //                        LED3_Flg = 0x55;
  235.                 }
  236.                 else
  237.                 {
  238.                                 GPIO_SetBits(LED_GPIO, LED3);        //LED3灭
  239. //        LED3_Flg = 0x00;                                
  240.                 }
  241. //                Disp_Buf[0x0A]=' ';
  242. //                Disp_Buf[0x0B]='F';
  243. //                Disp_Buf[0x0C]='_';
  244.                 Disp_Buf[0x0D]=' ';
  245.                 Disp_Buf[0x0E]=' ';        
  246.                 Disp_Buf[0x0F]=' ';               
  247. //                Disp_Buf[0x0E]='F';
  248. //                Disp_Buf[0x0F]=Fun_Code+0x30;
  249.           delay_ms(50);
  250.         }

  251. }        
  252. //************************************************************************************************
  253. //函数功能:开启显示
  254. //************************************************************************************************
  255. static void user_init(){
  256.         lcd_write_string(0,0,(u8*)"U1=");
  257.         lcd_write_string(7,0,(u8*)"mV");
  258.         lcd_write_string(0,1,(u8*)"U2=");
  259.         lcd_write_string(4,1,(u8*)".");
  260.         lcd_write_string(8,1,(u8*)"V");
  261.         
  262. }

  263. //************************************************************************************************
  264. //函数功能:计算对应通道的电压值
  265. //入口参数:k 放大倍数 nux 对应ADC通道的AD值
  266. //返回值:对应通道的实际电压值
  267. //************************************************************************************************
  268. static u16 Calculat_U(int k,int nux)
  269.         {
  270.         u32 temp;
  271.         u16 u;
  272.         temp = ((825*nux)*1/k)+1;
  273.         u = temp >>10;
  274.         return u;
  275.         
  276.   }
  277. //************************************************************************************************
  278. //
  279. //
  280. //************************************************************************************************
  281. void Disp_Dat(u16 u1,u16 u2,u32 t)
  282.         {
  283.         u16 ux,uy;
  284.         u32 tx;
  285.         ux = u1;
  286.         uy = u2;
  287.         tx = t;
  288.         Disp_Buf[0x20] = 'U';
  289.         Disp_Buf[0x21] = 'a';
  290.         Disp_Buf[0x22] = '=';
  291.         Disp_Buf[0x23] = (ux/1000)+0x30;
  292.         Disp_Buf[0x24] = (ux%1000/100)+0x30;
  293.   Disp_Buf[0x25] = (ux%100/10)+0x30;
  294.   Disp_Buf[0x26] = (ux%10)+0x30;
  295.         Disp_Buf[0x27] = ' ';
  296.         Disp_Buf[0x28] = 'm';
  297.         Disp_Buf[0x29] = 'V';
  298.         Disp_Buf[0x2A] = ' ';
  299.         Disp_Buf[0x2B] = ' ';
  300.         Disp_Buf[0x2C] = ' ';
  301.         Disp_Buf[0x2D] = ' ';
  302.         Disp_Buf[0x2E] = ' ';
  303.         Disp_Buf[0x2F] = ' ';
  304. /*
  305. Disp_Buf[0x2B]='K';
  306.         Disp_Buf[0x2C]='=';
  307.         if (Key_Release == Ture)
  308.         {
  309.                 Disp_Buf[0x2D]='Y';
  310.                 Disp_Buf[0x2E]='S';
  311.                 Disp_Buf[0x2F]='F';
  312.         }
  313.         else
  314.         {
  315.                 Disp_Buf[0x2D]='W';
  316.                 Disp_Buf[0x2E]='S';
  317.                 Disp_Buf[0x2F]='F';
  318.         }        
  319. */        
  320.         
  321.         Disp_Buf[0x10] = 'U';
  322.         Disp_Buf[0x11] = 'b';
  323.         Disp_Buf[0x12] = '=';
  324.         Disp_Buf[0x13] = (uy/1000)+0x30;
  325.         Disp_Buf[0x14] = '.';
  326.         Disp_Buf[0x15] = (uy%1000/100)+0x30;
  327.   Disp_Buf[0x16] = (uy%100/10)+0x30;
  328.   Disp_Buf[0x17] = (uy%10)+0x30;
  329.         Disp_Buf[0x18] = ' ';
  330.         Disp_Buf[0x19] = 'V';
  331.         Disp_Buf[0x1A] = ' ';
  332.         Disp_Buf[0x1B] = ' ';
  333.         Disp_Buf[0x1C] = ' ';
  334.         Disp_Buf[0x1D] = ' ';
  335.         Disp_Buf[0x1E] = ' ';
  336.         Disp_Buf[0x1F] = ' ';
  337. /*
  338.         Disp_Buf[0x1B]='K';
  339.         Disp_Buf[0x1C]='=';
  340.         if (Key_Flg == Key_Press)
  341.         {
  342.                 Disp_Buf[0x1D]='P';
  343.                 Disp_Buf[0x1E]='R';
  344.                 Disp_Buf[0x1F]='S';
  345.         }
  346.         else
  347.         {
  348.                 Disp_Buf[0x1D]='N';
  349.                 Disp_Buf[0x1E]='O';
  350.                 Disp_Buf[0x1F]='P';
  351.         }
  352. */
  353.         
  354. //        Disp_Buf[0x30] = ':';
  355.   //tx = tx /50;
  356.         Disp_Buf[0x30] = 'T';
  357.         Disp_Buf[0x31] = '=';
  358.         Disp_Buf[0x32] = (tx/360000)+0x30;        //时百位
  359.         tx=tx%360000;
  360.         Disp_Buf[0x33] = (tx/36000)+0x30;                //时十位
  361.         tx=tx%36000;
  362.         Disp_Buf[0x34] = (tx/3600)+0x30;                //时个位
  363.         tx=tx%3600;
  364.         Disp_Buf[0x35] = '-';
  365.         Disp_Buf[0x36] = (tx/600)+0x30;                        //分十位
  366.         tx=tx%600;
  367.         Disp_Buf[0x37] = (tx/60)+0x30;                  //分个位
  368.         tx=tx%60;
  369.         Disp_Buf[0x38] = '-';         
  370.   Disp_Buf[0x39] = (tx/10)+0x30;                        //秒十位
  371.         tx=tx%10;
  372.   Disp_Buf[0x3A] = tx+0x30;                                                //秒个位
  373.         Disp_Buf[0x3B] = ' ';
  374.         Disp_Buf[0x3C] = ' ';
  375. //        Disp_Buf[0x3D] = ' ';
  376. //        Disp_Buf[0x3E] = ' ';
  377. //        Disp_Buf[0x3F] = ' ';
  378.         Disp_Buf[0x3D]='F';
  379.         Disp_Buf[0x3E]='=';
  380.         Disp_Buf[0x3F]=Fun_Code+0x30;
  381. //                Disp_Buf[0x3D]='K';
  382. //                Disp_Buf[0x3E]='=';
  383. //                Disp_Buf[0x3F]=Key_Code+0x30;
  384. }

  385. //*/
  386. //************************************************************************************************
  387. //
  388. //
  389. //************************************************************************************************
  390. void RCC_Config(void)
  391.   {   
  392.   u8 HSE_StartUp;
  393.                 /* Setup the microcontroller system. Initialize the Embedded Flash Interface,  
  394.      initialize the PLL and update the SystemFrequency variable. */
  395. // SystemInit();
  396.                 RCC_DeInit();
  397. //                RCC_HSICmd(ENABLE);
  398. //                while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET){}  //等待
  399.                 HSE_StartUp = ERROR;
  400.                 RCC_HSEConfig(RCC_HSE_ON);
  401.                 while (HSE_StartUp == ERROR)
  402.                         {
  403.                         HSE_StartUp=RCC_WaitForHSEStartUp();
  404.                         };
  405.                         RCC_HSICmd(DISABLE);
  406.                 if(1)
  407.                   {
  408.                         FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
  409.                         FLASH_SetLatency(FLASH_Latency_2);
  410.                         RCC_HCLKConfig(RCC_SYSCLK_Div1);
  411.                         RCC_PCLK2Config(RCC_HCLK_Div1);
  412.                         RCC_PCLK1Config(RCC_HCLK_Div2);
  413.                         RCC_ADCCLKConfig(RCC_PCLK2_Div2);
  414.                         RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);  //PLL输入时钟=HSE,*9输出
  415.                         RCC_PLLCmd(ENABLE);
  416.                         while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET){}
  417.                         RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
  418.                         while(RCC_GetSYSCLKSource() != 0x08){}
  419.                         }
  420.         
  421.                         RCC_APB1PeriphClockCmd( RCC_APB1Periph_UART5,ENABLE);  
  422.                         RCC_APB2PeriphClockCmd( RCC_APB2Periph_USART1|RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |
  423.                          RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD |RCC_APB2Periph_GPIOE,
  424.                          ENABLE);        
  425.   }

  426. //************************************************************************************************
  427. //
  428. //
  429. //************************************************************************************************
  430. void GPIO_Config(void)
  431. {
  432.         GPIO_InitTypeDef GPIO_InitStructure;
  433.         RCC_APB1PeriphClockCmd( RCC_APB1Periph_UART4|RCC_APB1Periph_UART5,ENABLE);  
  434.   RCC_APB2PeriphClockCmd( RCC_APB2Periph_USART1|RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |
  435.                          RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD |
  436.                          RCC_APB2Periph_GPIOE|RCC_APB2Periph_AFIO, ENABLE);        
  437.   GPIO_InitStructure.GPIO_Pin = LED3|LED4;                                     //led3~led4
  438.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
  439.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  440.   GPIO_Init(LED_GPIO, &GPIO_InitStructure);        
  441.         
  442.   GPIO_InitStructure.GPIO_Pin = KEY1|KEY2|KEY3;                                     //KEY1,KEY2,KEY3
  443.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
  444.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  445.   GPIO_Init(KEY_GPIO, &GPIO_InitStructure);                                         
  446.         
  447.         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;  //CTRL口,PA5,PA6,PA7
  448.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  449.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  450.         GPIO_Init(GPIOA, &GPIO_InitStructure);        
  451.                                  
  452. }

  453. //************************************************************************************************
  454. //
  455. //************************************************************************************************
  456. void NVIC_Config(void)
  457. {
  458. //  NVIC_InitTypeDef NVIC_InitStructure;
  459. //  /* Configure the NVIC Preemption Priority Bits */  
  460. //  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
  461. //  
  462. //  /* Enable the UART5 Interrupt */
  463. //  NVIC_InitStructure.NVIC_IRQChannel = UART5_IRQn;
  464. //  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
  465. //  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  466. //  NVIC_Init(&NVIC_InitStructure);

  467. }
  468. //************************************************************************************************
  469. //
  470. //
  471. //************************************************************************************************
  472. void TIM2_IRQHandler(void)
  473.         {
  474.                 u8 Key_In;
  475.                 u8  Key_State = 0xFF;
  476.                 TIM_ClearITPendingBit(TIM2, TIM_IT_Update );
  477.     if (time_sec < 100)
  478.                 {
  479.                         time_sec++;
  480.                 }
  481.                 else
  482.                 {
  483.                         time_sec =0;
  484.                         Time_Cont++;
  485.             if (GPIO_ReadInputDataBit(LED_GPIO,LED4)== Bit_SET)
  486.                         {
  487.                         GPIO_ResetBits(LED_GPIO, LED4);// LED3亮
  488.                         }
  489.                   else
  490.                         {
  491.                                 GPIO_SetBits(LED_GPIO, LED4);        //LED3灭
  492.                         }                                
  493.                 }
  494.                 Key_In = GPIO_ReadInputDataBit(KEY_GPIO,KEY3);
  495.                 if (Key_In == Bit_RESET)
  496.                 {        
  497.                    Key_State =Key_State & 0xFB;  //D2=0,1111,1011,0xFB
  498.                          Disp_Buf[0x3F] = '0';
  499.                 }
  500.                 Key_In = GPIO_ReadInputDataBit(KEY_GPIO,KEY2);                        
  501.                 if (Key_In == Bit_RESET)
  502.                 {        
  503.                    Key_State =Key_State & 0xFD;    //D1=0, 1111,1101,0xFD
  504.                          Disp_Buf[0x1F] = '0';
  505.                 }        
  506.                 Key_In = GPIO_ReadInputDataBit(KEY_GPIO,KEY1);
  507.                 if (Key_In == Bit_RESET)
  508.                 {        
  509.                    Key_State =Key_State & 0xFE; //D0=0,1111,1110, 0xFE
  510.                          Disp_Buf[0x2F] = '0';
  511.                 }        
  512.     Key_State=Key_State & 0x07;
  513.                
  514.                 if (Key_State == Key_Code )
  515.                 {
  516.             if (Key_State == 0x07)
  517.                         {
  518.                                 Key_Release = Ture;        //无按键按下(按键释放)
  519.                                                                                                                 //维持原来的Key_Flg,等待主函数处理
  520.                                 
  521.                         }
  522.                         else
  523.                         {
  524.                                 if(Key_Release == Ture)  //原来按键是释放的
  525.                                 {
  526.                                         Key_Code = Key_State;
  527.                                         Key_Flg = Key_Press;
  528.                                         Key_Release = False;                                       
  529.                                 }
  530.                         }
  531.                 }
  532.                 else
  533.                 {
  534.                   Key_Code = Key_State;    //相邻两次扫描的键状态不一致,是抖动状态
  535.                                                  //        暂存当前键状态,等待下一次定时中断
  536.                 }
  537. //                Disp_Buf[0x3C]='K';
  538. //                Disp_Buf[0x3E]='=';
  539. //                Disp_Buf[0x3F]=Key_Code+0x30;
  540.                
  541. //                */
  542.   }

  543. //************************************************************************************************
  544. //
  545. //
  546. //************************************************************************************************
  547. void USART1_IRQHandler(void)
  548.         {

  549.         }
  550. //************************************************************************************************
  551. //串口5中断处理
  552. //************************************************************************************************
  553. void UART5_IRQHandler(void)
  554.         {
  555.                 ;//
  556.         }
  557.         
  558.         
  559. //*********************************************************************************************
  560. // 按键处理程序
  561. //*********************************************************************************************
  562.         void Key_Code00(void)     //000:三个按键全按下,第一行最右端显示E-K0
  563.         {
  564.                 Disp_Buf[0x0C] = 'E';
  565.                 Disp_Buf[0x0D] = '-';
  566.                 Disp_Buf[0x0E] = 'K';
  567.                 Disp_Buf[0x0F] = '0';
  568.         }
  569.         
  570. //*********************************************************************************************
  571. // 按键处理程序
  572. //*********************************************************************************************
  573.         void Key_Code01(void)     //001:K1,K2按下,第一行最右端显示E-K1
  574.         {
  575.                 Disp_Buf[0x0C] = 'E';
  576.                 Disp_Buf[0x0D] = '-';
  577.                 Disp_Buf[0x0E] = 'K';
  578.     Disp_Buf[0x0F] = '1';               
  579.         }        
  580. //*********************************************************************************************
  581. // 按键处理程序
  582. //*********************************************************************************************
  583.         void Key_Code02(void)     //010:K1,K3按下,在第一行最右端显示E-K2
  584.         {
  585.                 Disp_Buf[0x0C] = 'E';
  586.                 Disp_Buf[0x0D] = '-';
  587.                 Disp_Buf[0x0E] = 'K';
  588.     Disp_Buf[0x0F] = '2';               
  589.         }        
  590. //*********************************************************************************************
  591. // 按键处理程序,模式按键,每按一次,模式在 电压→电流→电压脉冲→电流脉冲→电压之间转换
  592. //     Fun_Code值在 0→1→2→3→4→5→6→7→0之间转换。
  593. //*********************************************************************************************
  594.         void Key_Code03(void)     //011:K1按下
  595.         {
  596.                 Fun_Code = (Fun_Code +1)&0x07;
  597.                 Disp_Buf[0x0C] = 'F';
  598.                 Disp_Buf[0x0D] = 'C';
  599.                 Disp_Buf[0x0E] = '=';
  600.                 Disp_Buf[0x0F] = Fun_Code+0x30;
  601. }        
  602. //*********************************************************************************************
  603. // 按键处理程序
  604. //*********************************************************************************************
  605.         void Key_Code04(void)     //100:K2,K3按下,在第一行最右端显示E-K4
  606.         {
  607.                 Disp_Buf[0x0C] = 'E';
  608.                 Disp_Buf[0x0D] = '-';
  609.                 Disp_Buf[0x0E] = 'K';
  610.     Disp_Buf[0x0F] = '4';
  611.         }        
  612. //*********************************************************************************************
  613. // 按键处理程序,设定值减小按键,每按一次,设定值Set_Val-1直到0
  614. //*********************************************************************************************
  615.         void Key_Code05(void)     //101:K2按下
  616.         {
  617.                 if(Set_Val != 0x00)
  618.                 {
  619.                         Set_Val = (Set_Val -1);
  620.                 }
  621.                 Disp_Buf[0x0A] = 'S';
  622.                 Disp_Buf[0x0B] = 'E';
  623.                 Disp_Buf[0x0C] = 'T';
  624.                 Disp_Buf[0x0D] = '=';
  625.     Disp_Buf[0x0E] = ' ';                                 
  626.                 Disp_Buf[0x0F] = Set_Val+0x30;
  627.         }        
  628. //*********************************************************************************************
  629. // 按键处理程序,设定增大按键,每按一次,设定值Set_Val+1直到7(档)
  630. //*********************************************************************************************
  631.         void Key_Code06(void)     //110:K3按下
  632.         {
  633.                 if(Set_Val < 0x07)
  634.                 {
  635.                         Set_Val = (Set_Val +1)&0x07;
  636.                 }
  637.                 Disp_Buf[0x0A] = 'S';
  638.                 Disp_Buf[0x0B] = 'E';
  639.                 Disp_Buf[0x0C] = 'T';
  640.                 Disp_Buf[0x0D] = '=';
  641.     Disp_Buf[0x0E] = ' ';                                 
  642.                 Disp_Buf[0x0F] = Set_Val+0x30;
  643.         }               
  644. //*********************************************************************************************
  645. // 按键处理程序,无按键按下,设置Key_on标识
  646. //*********************************************************************************************
  647.         void Key_Code07(void)     //111:无键按下
  648.         {
  649.                 Key_Release = Ture;
  650.                 Disp_Buf[0x0E] = 'K';
  651.     Disp_Buf[0x0F] = 'O';                                 
  652.         }               
  653. //--------------------------------------------------------------------------------------------
  654. //********************************************************************************************
  655. //--------------------------------------------------------------------------------------------
  656.         //功能函数0: 直流电压输出,在第一行左边显示 DC,U=xx.yV
  657. //           依据设定值Set_Val控制直流输出电压(PA7,PA6,PA5)三位控制DC-DC输出电压,
  658. //
  659. //********************************************************************************************        
  660. //............................................................................................
  661. void Fun_Code00(void)     //000:
  662.         {
  663.                 u8 Voltage;
  664.                 Disp_Buf[0x00] = 'D';
  665.                 Disp_Buf[0x01] = 'C';
  666.                 Disp_Buf[0x02] = ':';
  667.                 Disp_Buf[0x03] = 'U';
  668.     Disp_Buf[0x04] = 's';                                 
  669.                 Disp_Buf[0x05] = '=';
  670.                 switch (Set_Val)
  671.                 {                        
  672.                         case 0x00:
  673.                                 Voltage = 6;
  674.                           GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  675.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  676.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);                        
  677.                 //  DA_OUT(60};                                                                                                        //DA输出60。
  678.                                 break;
  679.                         case 0x01:
  680.                                 Voltage = 9;
  681.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  682.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  683.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);        
  684.                 //  DA_OUT(90};                                                                                                        //DA输出60。                        
  685.                           break;
  686.                         case 0x02:
  687.                                 Voltage = 12;
  688.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  689.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  690.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);        
  691.                 //  DA_OUT(120};                                                                                                        //DA输出60。                        
  692.                           break;
  693.                         case 0x03:
  694.                                 Voltage = 15;
  695.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  696.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  697.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);        
  698.                 //  DA_OUT(15};                                                                                                        //DA输出60。                        
  699.                           break;
  700.                         case 0x04:
  701.                                 Voltage = 18;
  702.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  703.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  704.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);               
  705.                 //  DA_OUT(180};                                                                                                        //DA输出60。                        
  706.                           break;
  707.                         case 0x05:
  708.                                 Voltage = 20;
  709.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  710.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  711.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);                        
  712.                                         //  DA_OUT(200};                                                                                                        //DA输出60。
  713.                           break;        
  714.                         case 0x06:
  715.                                 Voltage = 22;
  716.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  717.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  718.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);               
  719.                 //  DA_OUT(220};                                                                                                        //DA输出60。                        
  720.                           break;        
  721.                         case 0x07:
  722.                                 Voltage = 25;
  723.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  724.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  725.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);
  726.                 //  DA_OUT(250};                                                                                                        //DA输出60。                        
  727.                           break;                        
  728.                 }        
  729.                 Disp_Buf[0x06] = Set_Val+0x30;
  730.                 Disp_Buf[0x07] = ' ';
  731.                 Disp_Buf[0x08] = 'L';
  732.                 Disp_Buf[0x09] = 'e';
  733.                 Disp_Buf[0x0A] = 'v';
  734.                 Disp_Buf[0x0B] = 'e';
  735.                 Disp_Buf[0x0C] = 'l';
  736.                 Disp_Buf[0x0D] = ' ';
  737.                 Disp_Buf[0x0E] = ' ';
  738.                 Disp_Buf[0x0F] = ' ';
  739.         
  740. /*               
  741.                 Disp_Buf[0x06] = Voltage/10+0x30;
  742.                 Disp_Buf[0x07] = Voltage%10+0x30;
  743.                 Disp_Buf[0x08] = '.';
  744.                 Disp_Buf[0x09] = '0';
  745. */
  746.         }               
  747. //--------------------------------------------------------------------------------------------
  748. //********************************************************************************************
  749. //--------------------------------------------------------------------------------------------
  750.         //功能函数0: 直流电压输出,在第一行左边显示 DC,U=xx.yV
  751. //           依据设定值Set_Val控制直流输出电压(PA7,PA6,PA5)三位控制DC-DC输出电压,
  752. //
  753. //********************************************************************************************        
  754. //............................................................................................
  755. void Fun_Code01(void)     //000:
  756.         {
  757.                 u8 Voltage;
  758.                 Disp_Buf[0x00] = 'D';
  759.                 Disp_Buf[0x01] = 'C';
  760.                 Disp_Buf[0x02] = ':';
  761.                 Disp_Buf[0x03] = 'I';
  762.     Disp_Buf[0x04] = 's';                                 
  763.                 Disp_Buf[0x05] = '=';
  764.                 switch (Set_Val)
  765.                 {                        
  766.                         case 0x00:
  767.                                 Voltage = 6;
  768.                           GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  769.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  770.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);        
  771.                 //  DA_OUT(60};                                                                                                        //DA输出60。                        
  772.                                 break;
  773.                         case 0x01:
  774.                                 Voltage = 9;
  775.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  776.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  777.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);               
  778.                 //  DA_OUT(90};                                                                                                        //DA输出90。                        
  779.                           break;
  780.                         case 0x02:
  781.                                 Voltage = 12;
  782.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  783.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  784.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);                        
  785.                 //  DA_OUT(120};                                                                                                        //DA输出120。
  786.                           break;
  787.                         case 0x03:
  788.                                 Voltage = 15;
  789.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  790.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  791.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);        
  792.                 //  DA_OUT(150};                                                                                                        //DA输出150。                        
  793.                           break;
  794.                         case 0x04:
  795.                                 Voltage = 18;
  796.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  797.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  798.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);               
  799.                 //  DA_OUT(180};                                                                                                        //DA输出180。                        
  800.                           break;
  801.                         case 0x05:
  802.                                 Voltage = 20;
  803.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  804.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  805.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);               
  806.                 //  DA_OUT(200};                                                                                                        //DA输出200。                        
  807.                           break;        
  808.                         case 0x06:
  809.                                 Voltage = 22;
  810.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  811.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  812.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);               
  813.                 //  DA_OUT(220};                                                                                                        //DA输出220。                        
  814.                           break;        
  815.                         case 0x07:
  816.                                 Voltage = 25;
  817.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  818.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  819.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);        
  820.                 //  DA_OUT(250};                                                                                                        //DA输出250。                        
  821.                           break;                        
  822.                 }        
  823.                 Disp_Buf[0x06] = Set_Val+0x30;
  824.                 Disp_Buf[0x07] = ' ';
  825.                 Disp_Buf[0x08] = 'L';
  826.                 Disp_Buf[0x09] = 'e';
  827.                 Disp_Buf[0x0A] = 'v';
  828.                 Disp_Buf[0x0B] = 'e';
  829.                 Disp_Buf[0x0C] = 'l';
  830.                 Disp_Buf[0x0D] = ' ';
  831.                 Disp_Buf[0x0E] = ' ';
  832.                 Disp_Buf[0x0F] = ' ';
  833. /*               
  834.                 Disp_Buf[0x06] = Voltage/10+0x30;
  835.                 Disp_Buf[0x07] = Voltage%10+0x30;
  836.                 Disp_Buf[0x08] = '.';
  837.                 Disp_Buf[0x09] = '0';
  838. */
  839.         }        
  840. //--------------------------------------------------------------------------------------------
  841. //********************************************************************************************
  842. //--------------------------------------------------------------------------------------------
  843.         //功能函数0: 直流电压输出,在第一行左边显示 DC,U=xx.yV
  844. //           依据设定值Set_Val控制直流输出电压(PA7,PA6,PA5)三位控制DC-DC输出电压,
  845. //
  846. //********************************************************************************************        
  847. //............................................................................................
  848. void Fun_Code02(void)     //010:
  849.         {
  850.                 u8 Voltage;
  851.                 Disp_Buf[0x00] = 'P';
  852.                 Disp_Buf[0x01] = 'V';
  853.                 Disp_Buf[0x02] = ':';
  854.                 Disp_Buf[0x03] = 'U';
  855.     Disp_Buf[0x04] = 's';                                 
  856.                 Disp_Buf[0x05] = '=';
  857.                 switch (Set_Val)
  858.                 {                        
  859.                         case 0x00:
  860.                                 Voltage = 6;
  861.                           GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  862.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  863.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);               
  864.                 //  DA_OUT(60};                                                                                                        //DA输出60。                                                
  865.                                 break;
  866.                         case 0x01:
  867.                                 Voltage = 9;
  868.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  869.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  870.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);               
  871.                 //  DA_OUT(90};                                                                                                        //DA输出90。                                                
  872.                           break;
  873.                         case 0x02:
  874.                                 Voltage = 12;
  875.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  876.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  877.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);               
  878.                 //  DA_OUT(120};                                                                                                        //DA输出120。                                                
  879.                           break;
  880.                         case 0x03:
  881.                                 Voltage = 15;
  882.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  883.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  884.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);        
  885.                 //  DA_OUT(150};                                                                                                        //DA输出150。                                                
  886.                           break;
  887.                         case 0x04:
  888.                                 Voltage = 18;
  889.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  890.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  891.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);               
  892.                 //  DA_OUT(180};                                                                                                        //DA输出180。                                                
  893.                           break;
  894.                         case 0x05:
  895.                                 Voltage = 20;
  896.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  897.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  898.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);               
  899.                 //  DA_OUT(200};                                                                                                        //DA输出200。                                                
  900.                           break;        
  901.                         case 0x06:
  902.                                 Voltage = 22;
  903.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  904.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  905.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);                        
  906.                 //  DA_OUT(220};                                                                                                        //DA输出220。                        
  907.                           break;        
  908.                         case 0x07:
  909.                                 Voltage = 25;
  910.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  911.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  912.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);                        
  913.                 //  DA_OUT(250};                                                                                                        //DA输出250。                        
  914.                           break;                        
  915.                 }        
  916.                 Disp_Buf[0x06] = Set_Val+0x30;
  917.                 Disp_Buf[0x07] = ' ';
  918.                 Disp_Buf[0x08] = 'L';
  919.                 Disp_Buf[0x09] = 'e';
  920.                 Disp_Buf[0x0A] = 'v';
  921.                 Disp_Buf[0x0B] = 'e';
  922.                 Disp_Buf[0x0C] = 'l';
  923.                 Disp_Buf[0x0D] = ' ';
  924.                 Disp_Buf[0x0E] = ' ';
  925.                 Disp_Buf[0x0F] = ' ';
  926. /*               
  927.                 Disp_Buf[0x06] = Voltage/10+0x30;
  928.                 Disp_Buf[0x07] = Voltage%10+0x30;
  929.                 Disp_Buf[0x08] = '.';
  930.                 Disp_Buf[0x09] = '0';
  931. */
  932.         }                        
  933. //--------------------------------------------------------------------------------------------
  934. //********************************************************************************************
  935. //--------------------------------------------------------------------------------------------
  936.         //功能函数0: 直流电压输出,在第一行左边显示 DC,U=xx.yV
  937. //           依据设定值Set_Val控制直流输出电压(PA7,PA6,PA5)三位控制DC-DC输出电压,
  938. //
  939. //********************************************************************************************        
  940. //............................................................................................
  941. void Fun_Code03(void)     //011:
  942.         {
  943.                 u8 Voltage;
  944.                 Disp_Buf[0x00] = 'P';
  945.                 Disp_Buf[0x01] = 'C';
  946.                 Disp_Buf[0x02] = ':';
  947.                 Disp_Buf[0x03] = 'I';
  948.     Disp_Buf[0x04] = 's';                                 
  949.                 Disp_Buf[0x05] = '=';
  950.                 switch (Set_Val)
  951.                 {                        
  952.                         case 0x00:
  953.                                 Voltage = 6;
  954.                           GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  955.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  956.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);        
  957.                 //  DA_OUT(60};                                                                                                        //DA输出60。                                                
  958.                                 break;
  959.                         case 0x01:
  960.                                 Voltage = 9;
  961.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  962.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  963.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);               
  964.                 //  DA_OUT(90};                                                                                                        //DA输出90。                                                
  965.                           break;
  966.                         case 0x02:
  967.                                 Voltage = 12;
  968.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  969.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  970.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);        
  971.                 //  DA_OUT(120};                                                                                                        //DA输出120。                                                
  972.                           break;
  973.                         case 0x03:
  974.                                 Voltage = 15;
  975.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_5);
  976.                           GPIO_SetBits(GPIOA,GPIO_Pin_6);
  977.                           GPIO_SetBits(GPIOA,GPIO_Pin_7);                        
  978.                 //  DA_OUT(150};                                                                                                        //DA输出150。                        
  979.                           break;
  980.                         case 0x04:
  981.                                 Voltage = 18;
  982.                                 GPIO_SetBits(GPIOA,GPIO_Pin_5);
  983.                           GPIO_ResetBits(GPIOA,GPIO_Pin_6);
  984.                           GPIO_ResetBits(GPIOA,GPIO_Pin_7);               
  985.                 //  DA_OUT(180};                                                                                                        //DA输出180。                                                
  986.                           break;
  987.                         case 0x05:
  988.                                 Voltage = 20;
  989. ……………………

  990. …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码

所有资料51hei提供下载:
STM32_12864(ok).rar (390.64 KB, 下载次数: 206)


评分

参与人数 1黑币 +1 收起 理由
红心拾箭 + 1

查看全部评分

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

使用道具 举报

沙发
ID:287925 发表于 2018-8-5 15:46 | 只看该作者
代码很好,给楼主赞一个
回复

使用道具 举报

板凳
ID:438517 发表于 2018-12-13 17:38 | 只看该作者
谢谢楼主
回复

使用道具 举报

地板
ID:220748 发表于 2018-12-13 19:24 | 只看该作者
用KEIL运行“ET_PRG”时,怎么头文件都没有装进去?
要自己装入么,怎么装?
回复

使用道具 举报

5#
ID:220748 发表于 2018-12-13 21:30 | 只看该作者


编译时出错:
请帮解决!
谢谢!!

















回复

使用道具 举报

6#
ID:220748 发表于 2018-12-13 21:45 | 只看该作者


用KEIL运行“ET_PRG”时,怎么头文件都没有装进去?
要自己装入么,怎么装?



回复

使用道具 举报

7#
ID:446687 发表于 2018-12-15 11:41 | 只看该作者
学习一下
回复

使用道具 举报

8#
ID:245110 发表于 2019-2-9 11:02 | 只看该作者
谢谢楼主
回复

使用道具 举报

9#
ID:508042 发表于 2019-4-9 16:49 | 只看该作者

代码很好,给楼主赞一个
回复

使用道具 举报

10#
ID:96552 发表于 2019-9-25 12:59 | 只看该作者
有人验证过吗?PSB是决定使用并行还是串行通信吧,这样能行吗?
#define LCD12864_PSB_1  GPIO_SetBits(LCD12864_GPIO_PSB, LCD12864_GPIO_PSB_PIN)        //PBS Ö¸áî êä3ö1
#define LCD12864_PSB_0  GPIO_ResetBits(LCD12864_GPIO_PSB, LCD12864_GPIO_PSB_PIN)//         êä3ö0
回复

使用道具 举报

11#
ID:676553 发表于 2019-12-29 12:50 | 只看该作者
头文件问题怎么解决楼主
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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