找回密码
 立即注册

QQ登录

只需一步,快速开始

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

Keil stm32的12864液晶显示程序

[复制链接]
跳转到指定楼层
楼主
ID:249298 发表于 2018-7-25 14:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
分享一个基于Keil STM32的12864液晶模块显示程序。

单片机源程序如下:
  1. #include "stm32f10x.h"
  2. #include "integer.h"
  3. #include "lcd12864_chuan.H"


  4. //12864 STM32驱动程序

  5. void delay(u32 delaytime);
  6. void NVIC_Configuration(void);
  7. void RCC_Configuration(void);
  8. void GPIO_init(void);



  9. void delay(u32 delaytime){
  10.         while(delaytime>1)delaytime--;
  11. }
  12. void NVIC_Configuration(void){
  13.         #ifdef  VECT_TAB_RAM  
  14.           /* Set the Vector Table base location at 0x20000000 */
  15.           NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
  16.         #else  /* VECT_TAB_FLASH  */
  17.           /* Set the Vector Table base location at 0x08000000 */
  18.           NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);   
  19.         #endif
  20.           /* Configure one bit for preemption priority */
  21. }
  22. //配置系统时钟,使能各外设时钟
  23. void RCC_Configuration(void){
  24.         SystemInit();        
  25.         RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA
  26.                            |RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC
  27.                            |RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE
  28.                                                    | RCC_APB2Periph_AFIO |RCC_APB2Periph_SPI1         
  29.                             , ENABLE );           
  30. }



  31. void GPIO_init(void){
  32.         GPIO_InitTypeDef GPIO_InitStructure;
  33.         /* Configure PC13 as input floating (EXTI Line0) */
  34. //        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12;
  35. //        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  36. //        GPIO_Init(GPIOA, &GPIO_InitStructure);

  37. //        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1;
  38. //        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  39. //        GPIO_Init(GPIOB, &GPIO_InitStructure);

  40.         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2|GPIO_Pin_3;
  41.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  42.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  43.         GPIO_Init(GPIOA, &GPIO_InitStructure);        

  44.         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2;  //12864控制脚 OD输出
  45.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  46.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
  47.         GPIO_Init(GPIOB, &GPIO_InitStructure);
  48. }

  49. void Init_All_Periph(void){
  50.         RCC_Configuration();        
  51.         NVIC_Configuration();
  52.         GPIO_init();        
  53. //        SPI_Configuration();
  54. //    SD_Init();
  55.         lcd_init();
  56. }



  57. int main(void){
  58.                 Init_All_Periph();
  59.         while(1)
  60.         {        

  61. Chshow(2,2,"xxxxxx aa");
  62. delay(10000000);
  63. Chshow(2,2,"feasfas");
  64. delay(10000000);

  65. //Draw_circle(64,32,30)
  66. //            f_mount(0,&fs);  //开辟一个新的工作区
  67. //                window();
  68. //                f_mount(0,NULL);  //注销工作区                                          
  69.         }
  70. }
复制代码

所有资料51hei提供下载:
STM32_12864_原创显示程序.rar (327.87 KB, 下载次数: 57)


评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

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

使用道具 举报

沙发
ID:416242 发表于 2018-10-27 12:30 | 只看该作者
没黑币下载
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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