标题: Stm32f103c8t6+freertos+0.96OLED通过串口发送字符显示 [打印本页]

作者: zhanglijin    时间: 2019-6-8 20:36
标题: Stm32f103c8t6+freertos+0.96OLED通过串口发送字符显示
Stm32f103c8t6+freertos+0.96OLED通过串口发送字符到显示,由于没有字库,所以不能显示汉字
制作出来的实物图如下:


单片机源程序如下:
  1. /**
  2.   ******************************************************************************
  3.   * @file    FreeRTOS+0.96OLED显示
  4.   * @author  ZLJ
  5.   * @version V1.0
  6.   * @date    2019-06-8
  7.   * @brief   通过串口助手发送字符到OLED显示,因为没有字库不能显示中文
  8.   ******************************************************************************
  9.   * @attention                                                                 *
  10.         *       ----------------------------------------------------------------
  11. //              GND    电源地
  12. //              VCC  接5V或3.3v电源
  13. //              D0   接PA5(SCL)
  14. //              D1   接PA7(SDA)
  15. //              RES  接PB0
  16. //              DC   接PB1
  17. //              CS   接PA4               
  18. //        ----------------------------------------------------------------                                              *
  19.   ******************************************************************************
  20.   */
  21. #include "delay.h"
  22. #include "stm32f10x.h"
  23. #include "FreeRTOS.h"
  24. #include "task.h"
  25. #include "bsp_usart.h"
  26. #include "oled.h"
  27. #include "queue.h"
  28. //#include "bmp.h"

  29. #define task1_STK_SIZE  100
  30. #define task1_STK_PRIO   4
  31. TaskHandle_t task1_Handler;
  32. void vtask1(void * pvParameters);

  33. xQueueHandle x;
  34. int Pos_x=0;
  35. int Pos_y=0;

  36. int main(void)
  37. {
  38.          delay_init();           //延时函数初始化         
  39.          OLED_Init();                        //初始化OLED  
  40.                 OLED_Clear();
  41.          x=xQueueCreate(5,1);
  42.          
  43.          
  44.         taskENTER_CRITICAL();
  45.         NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
  46.          USART_Config();
  47.            xTaskCreate( (TaskFunction_t)                  vtask1,
  48.                                                                         (char*)                                                    "vtask1",
  49.                                                                         (uint16_t)                                    task1_STK_SIZE,
  50.                                                                         (void*)               NULL,
  51.                                                                         (UBaseType_t)         task1_STK_PRIO ,
  52.                                                                         (TaskHandle_t)        &task1_Handler );
  53.                         taskEXIT_CRITICAL();
  54.                 vTaskStartScheduler();                                                       
  55. }



  56. void vtask1(void * pvParameters)
  57. {
  58.         char n;
  59.                 while(1)
  60.                 {
  61.         xQueueReceive(x,&n,portMAX_DELAY);
  62.                        
  63.                 OLED_ShowChar(Pos_x,Pos_y,n);//显示ASCII字符       
  64.                 Pos_x+=8;       
  65.                 if(Pos_x>=128)        {Pos_x=0;Pos_y+=2;
  66.                 if(Pos_y>6) Pos_y=0;
  67.                 }
  68.                
  69.                 //vTaskDelay(1000);        
  70.                 //OLED_ShowChar(48,6,'d');//显示ASCII字符               
  71.                 //vTaskDelay(1000);        
  72.                 //OLED_DrawBMP(0,0,128,8,BMP3);       
  73.                
  74.                 }
  75. }
复制代码

所有资料51hei提供下载:
FreeRTOS+OLED显示.7z (320.81 KB, 下载次数: 241)




作者: Andy-Yeung    时间: 2019-9-7 09:36
好东西,准备下载学习学习
作者: 有心插花花木兰    时间: 2019-10-17 19:55
有没有freertos有什么区别没呢?
作者: (xiaobai)    时间: 2020-2-10 11:01
正好想研究一下谢谢
作者: HWL0541    时间: 2020-2-15 12:53
下载了,谢谢楼主
作者: chensiyu    时间: 2020-4-17 01:23
想研究一下谢谢
作者: billtest36    时间: 2020-5-23 22:27
太好了  學習學習




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1