|
STM32+BMP180+DS18b20+0.96液晶+1.9寸TFT
單片機(jī)源程序如下:
- //=============================================================================
- //文件名稱:main.h
- //功能概要:STM32F103C8核心檢測(cè)
- //調(diào)試方式:J-Link OB ARM SW方式 5MHz
- //=============================================================================
- //頭文件
- #include "headfile.h"
- float tem;
- unsigned int tempr,tempL=0,tempH=0;//設(shè)全局變量
- unsigned int bmp,bmt,bm_ph,bm_pl,bm_th,bm_tl;//設(shè)全局變量
- unsigned int sm_sc;
- unsigned int tt1=0;
- //=============================================================================
- //文件名稱:main
- //功能概要:主函數(shù)
- //參數(shù)說明:無
- //函數(shù)返回:int
- //=============================================================================
- void display(void)
- {
- int i;
- for(i=0;i<6;i++)
- {
- OLED_ShowCN(i*16,0,i);//測(cè)試顯示中文
- }
- for(i=0;i<3;i++)
- {
- OLED_ShowCN1(i*16,2,i);//測(cè)試顯示中文
- }
- disp_uint(40,2,tempH);
- OLED_ShowStr(65,2,".",2);
- disp_uint(70,2,tempL);
- OLED_ShowStr(95,2,"C",2);
- for(i=4;i<7;i++)
- {
- OLED_ShowCN3((i-4)*16,4,i);//測(cè)試顯示中文
- }
- disp_uint(40,4,bm_th);
- OLED_ShowStr(65,4,".",2);
- disp_uint(70,4,bm_tl*100);
- OLED_ShowStr(95,4,"C",2);
- for(i=0;i<4;i++)
- {
- OLED_ShowCN3(i*16,6,i);//測(cè)試顯示中文
- }
- disp_uint(55,6,bm_ph);
- OLED_ShowStr(80,6,".",2);
- disp_uint(84,6,bm_pl);
- OLED_ShowStr(109,6,"KP",2);
- }
- void usart_data()
- {
- UART_PutStr (USART2, "溫度:");
- UART_PutChar(USART2,tempH/10+'0');
- UART_PutChar(USART2,tempH%10+'0');
- UART_PutChar(USART2,'.');
- UART_PutChar(USART2,tempL/10/10+'0');
- UART_PutChar(USART2,tempL/10%10+'0');
- }
- int main(void)
- {
- DelayInit();
- I2C_Configuration();
- OLED_Init();
- //Lcd_Init();
- Adc_Init();
- Init_BMP085();
- uart_init(9600);
- Timerx_Init(50000,7200);// 設(shè)定5分鐘 //10Khz的計(jì)數(shù)頻率,計(jì)數(shù)到5000為500ms
- // while(DS18B20_Init());
- SysTick_Init();
- OLED_CLS();//清屏
- while(1)
- {
- // tem=DS18B20_Get_Temp();
- // bmp085Convert();
- tempr=(unsigned int)(tem*100);
- tempH=tempr/100;
- tempL=tempr%100*10;
- display();
- tt1++;
- bmp= (unsigned int)result_UP;
- ……………………
- …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
BMP180+DS18b20+0.96液晶+1.9寸TFT.rar
(398.91 KB, 下載次數(shù): 74)
2018-4-17 17:03 上傳
點(diǎn)擊文件名下載附件
BMP180+DS18b20+0.96液晶+1.9寸TFT 下載積分: 黑幣 -5
|
評(píng)分
-
查看全部評(píng)分
|