标题:
Stm32f103c8t6+freertos+0.96OLED通过串口发送字符显示
[打印本页]
作者:
zhanglijin
时间:
2019-6-8 20:36
标题:
Stm32f103c8t6+freertos+0.96OLED通过串口发送字符显示
Stm32f103c8t6+freertos+0.96OLED通过串口发送字符到显示,由于没有字库,所以不能显示汉字
制作出来的实物图如下:
0.png
(434.83 KB, 下载次数: 60)
下载附件
2019-6-10 04:21 上传
单片机源程序如下:
/**
******************************************************************************
* @file FreeRTOS+0.96OLED显示
* @author ZLJ
* @version V1.0
* @date 2019-06-8
* @brief 通过串口助手发送字符到OLED显示,因为没有字库不能显示中文
******************************************************************************
* @attention *
* ----------------------------------------------------------------
// GND 电源地
// VCC 接5V或3.3v电源
// D0 接PA5(SCL)
// D1 接PA7(SDA)
// RES 接PB0
// DC 接PB1
// CS 接PA4
// ---------------------------------------------------------------- *
******************************************************************************
*/
#include "delay.h"
#include "stm32f10x.h"
#include "FreeRTOS.h"
#include "task.h"
#include "bsp_usart.h"
#include "oled.h"
#include "queue.h"
//#include "bmp.h"
#define task1_STK_SIZE 100
#define task1_STK_PRIO 4
TaskHandle_t task1_Handler;
void vtask1(void * pvParameters);
xQueueHandle x;
int Pos_x=0;
int Pos_y=0;
int main(void)
{
delay_init(); //延时函数初始化
OLED_Init(); //初始化OLED
OLED_Clear();
x=xQueueCreate(5,1);
taskENTER_CRITICAL();
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
USART_Config();
xTaskCreate( (TaskFunction_t) vtask1,
(char*) "vtask1",
(uint16_t) task1_STK_SIZE,
(void*) NULL,
(UBaseType_t) task1_STK_PRIO ,
(TaskHandle_t) &task1_Handler );
taskEXIT_CRITICAL();
vTaskStartScheduler();
}
void vtask1(void * pvParameters)
{
char n;
while(1)
{
xQueueReceive(x,&n,portMAX_DELAY);
OLED_ShowChar(Pos_x,Pos_y,n);//显示ASCII字符
Pos_x+=8;
if(Pos_x>=128) {Pos_x=0;Pos_y+=2;
if(Pos_y>6) Pos_y=0;
}
//vTaskDelay(1000);
//OLED_ShowChar(48,6,'d');//显示ASCII字符
//vTaskDelay(1000);
//OLED_DrawBMP(0,0,128,8,BMP3);
}
}
复制代码
所有资料51hei提供下载:
FreeRTOS+OLED显示.7z
(320.81 KB, 下载次数: 241)
2019-6-10 04:24 上传
点击文件名下载附件
下载积分: 黑币 -5
作者:
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