|
- #include "stm32f10x.h" //STM32头文件
- #include "sys.h"
- #include "delay.h"
- #include "lm75a.h"
- #include "oled0561.h"
- int main (void){//主程序
- u8 buffer[3];
- delay_ms(100); //上电时等待其他器件就绪
- RCC_Configuration(); //系统时钟初始化
- I2C_Configuration();//I2C初始化
- LM75A_GetTemp(buffer); //读取LM75A的温度数据
- OLED0561_Init(); //OLED初始化
- OLED_DISPLAY_LIT(100);//亮度设置
- OLED_DISPLAY_PIC1();//显示全屏图片
- delay_ms(1000); //延时
- OLED_DISPLAY_CLEAR();
- OLED_DISPLAY_8x16_BUFFER(0," YoungTalk "); //显示字符串
- OLED_DISPLAY_8x16_BUFFER(6," Temp:"); //显示字符串
- OLED_DISPLAY_16x16(2,2*16,0);//汉字显示 测试成功
- OLED_DISPLAY_16x16(2,3*16,1);
- OLED_DISPLAY_16x16(2,4*16,2);
- OLED_DISPLAY_16x16(2,5*16,3);
- /*while(1){
- LM75A_GetTemp(buffer); //读取LM75A的温度数据
-
- if(buffer[0])OLED_DISPLAY_8x16(6,7*8,'-'); //如果第1组为1即是负温度
- OLED_DISPLAY_8x16(6,8*8,buffer[1]/10+0x30);//显示温度值
- OLED_DISPLAY_8x16(6,9*8,buffer[1]%10+0x30);//
- OLED_DISPLAY_8x16(6,10*8,'.');//
- OLED_DISPLAY_8x16(6,11*8,buffer[2]/10+0x30);//
- OLED_DISPLAY_8x16(6,12*8,buffer[2]%10+0x30);//
- OLED_DISPLAY_8x16(6,13*8,'C');//
- delay_ms(200); //延时
- }*/
- }
复制代码
|
|