STM32F03C8T6+ADC信号采集+OLED波形显示
✨本项目来源于开源项目,可以自行准备一块STM32F03C8T6和一块OLED屏幕就可以验证并演示出效果。 ?通过手指皮肤接触探测输入引脚:PA7
?
PA8
引脚上的方波输出?
PB13
引脚上的方波输出PB13和PA8:互补型方波输出引脚
?硬件搭建
?OLED屏幕:可以是0.96寸屏幕或者是1.3寸 IIC接口的OLED屏幕 ?STM32F103C8T6
最新系统板一块
?若干导线
?工程架构
?接线说明
ADC检测引脚:PA7,相关定义在BSP_ADC.h
OLED IIC引脚定义:bsp_i2c_gpio.h
SDA --- PA3
SCL --- PA2
PWM方波输出引脚:BSP_ADVANCED_TIMER.h
PB13和PA8:互补型方波输出引脚,
PB12:低电平
⛳0.96寸屏幕和1.3寸屏幕驱动细节差异说明
在OLED_I2C.c
文件中
void OLED_CLS(void)//清屏
{
uint8_t i,j;
for(i=0;i<8;i++)
{
WriteCmd(0xb0+i); //page0-page8
WriteCmd(0x02); //low column start address1.3寸屏幕发送地址是从0x02开始的,0.96屏幕是从0x00地址开始的特别注意个地方!!!!
WriteCmd(0x10); //high column start address
for(j=0;j<128;j++)
{
DataBuffer[i][j]=0x00;
}
}
Write_DataBuffer();
}
初始化函数
void OLED_Init(void)
{
i2c_CfgGpio(); /*I2C总线的GPIO初始化*/
Delay_ms(1000); // 1s,这里的延时很重要,上电后延时,没有错误的冗余设计
WriteCmd(0xAE); //display off
WriteCmd(0x20); //Set Memory Addressing Mode
WriteCmd(0x10); //00,Horizontal Addressing Mode;01,Vertical Addressing Mode;10,Page Addressing Mode (RESET);11,Invalid
WriteCmd(0xb0); //Set Page Start Address for Page Addressing Mode,0-7
WriteCmd(0xc8); //Set COM Output Scan Direction
WriteCmd(0x02); //---set low column address1.3寸屏幕发送地址是从0x02开始的,0.96屏幕是从0x00地址开始的
WriteCmd(0x10); //---set high column address
WriteCmd(0x40); //--set start line address
WriteCmd(0x81); //--set contrast control register
WriteCmd(0xff); //亮度调节 0x00~0xff
WriteCmd(0xa1); //--set segment re-map 0 to 127
WriteCmd(0xa6); //--set normal display
WriteCmd(0xa8); //--set multiplex ratio(1 to 64)
WriteCmd(0x3F); //
WriteCmd(0xa4); //0xa4,Output follows RAM content;0xa5,Output ignores RAM content
WriteCmd(0xd3); //-set display offset
WriteCmd(0x00); //-not offset
WriteCmd(0xd5); //--set display clock divide ratio/oscillator frequency
WriteCmd(0xf0); //--set divide ratio
WriteCmd(0xd9); //--set pre-charge period
WriteCmd(0x22); //
WriteCmd(0xda); //--set com pins hardware configuration
WriteCmd(0x12);
WriteCmd(0xdb); //--set vcomh
WriteCmd(0x20); //0x20,0.77xVcc
WriteCmd(0x8d); //--set DC-DC enable
WriteCmd(0x14); //
WriteCmd(0xaf); //--turn on oled panel
}
本代码默认采用的是1.3寸的屏幕驱动显示
?资源链接
?带引脚说明注释版链接:https://pan.baidu.com/s/1uGAJVJs7Z1E4Mb2FSrRGFw
提取码:mrdp