基于stmss實(shí)現(xiàn)液晶顯示熱敏電阻mf阻值(StmssLCD display based on mf thermistor resistance)_第1頁
基于stmss實(shí)現(xiàn)液晶顯示熱敏電阻mf阻值(StmssLCD display based on mf thermistor resistance)_第2頁
基于stmss實(shí)現(xiàn)液晶顯示熱敏電阻mf阻值(StmssLCD display based on mf thermistor resistance)_第3頁
基于stmss實(shí)現(xiàn)液晶顯示熱敏電阻mf阻值(StmssLCD display based on mf thermistor resistance)_第4頁
基于stmss實(shí)現(xiàn)液晶顯示熱敏電阻mf阻值(StmssLCD display based on mf thermistor resistance)_第5頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、基于stm8s105s4實(shí)現(xiàn)1602液晶顯示熱敏電阻mf25阻值(Stm8s105s4 1602 LCD display based on mf25 thermistor resistance)*1602 liquid crystal display thermistor MF25 resistance valueMF25-PE6GND-GNDVCC-VDD* /#include stm8s.h#include stm8s_adc1.h#include stm8s_gpio.h#include stm8s_tim2.h#include lcd162a.hU16 r;U8 i=10;U16, T

2、1, T2, f;U16 t=0;1ms delay under /2m main frequencyVoid, main ()1602 / / liquid crystal used to PD and PCU8, Wan, Qian, Bai, Shi, Ge, x;U8, wan2, QIAN2, Bai2, shi2, ge2;U16 Conversion_Value = 0;U16 Conversion_Value2 = 0;Int zuzhi=16600, 16500164001630016200161001600015900, 15800157001560015500154001

3、5300, 152001510015000149001480014700, 146001450014400143001420014100, 1400013900138001370013600, 1350013400133001320013100, 1300012900128001270012600, 1250012400123001220012100, 120001190011800117001160011500114001130011200, 1110011000109001080010700, 10600105001040010300, 102001010010000, 990098009

4、7009600, 950094009300, 9200910090008900, 88008700860085008400830082008100800079007800770076007500740073007200710070006900680067006600650064006300620061006000590058005700560055005400530052005100500049004800470046004500440043004200;Int wendu=12,12,12,13,13,13,13,13,13,13,14,14,14,14,14,14,15,15,15,15,

5、15,15,16,16,16,16,16,16,17,17,17,17,17,18,18,18,18,18,19,19,19,19,19,20,20,20,20,20,21,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,27,27,27,28,28,28,28,29,29,29,30,30,30, 31,31,31,32,32,32,33,33,34,34,34,35,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,43,44,44,45,45,46,47

6、,47,48,48,49,50;Int y=0;U8 *p1= youyahui;U8 *p2= 101203021013;TIM2_ICInit (TIM2_CHANNEL_1, TIM2_ICPOLARITY_RISING, TIM2_ICSELECTION_DIRECTTI, TIM2_ICPSC_DIV1, 0);TIM2_Cmd (ENABLE); / / enable TIM2 countTIM2_ClearFlag (TIM2_FLAG_CC1);GPIO_Init (GPIOC, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, GPIO_MODE_OUT_P

7、P_LOW_FAST);GPIO_Init (GPIOB,(GPIO _ pin _ 1 | GPIO _ pin _ 2 | GPIO _ pin _ 3 | GPIO _ pin _ 4 | GPIO _ pin _ 5 | GPIO _ pin _ 6 | GPIO _ pin _ 7 | GPIO _ pin _ 0), GPIO _ mode _ out _ PP _ low _ fast);While (TIM2 - Sr1 & TIM2 _ flag _ CC1). = TIM2 _ flag _ CC1);/ * get CCR1 value * /T1 = TIM2 _ ge

8、tcapture1 ();TIM2 _ clearflag (TIM2 _ flag _ CC1);While (TIM2 - Sr1 & TIM2 _ flag _ CC1). = TIM2 _ flag _ CC1);/ * get CCR1 value * /T2 = TIM2 _ getcapture1 ();TIM2 _ clearflag (TIM2 _ flag _ CC1);T = T2 - T1;Conversion _ Value2 = 2000000 / T;Wan = (conversion _ Value2 / 10000);Qian = (conversion _

9、Value2% 10000) / 1000;Bai = (conversion _ Value2% 1000) / 100;Shi = (conversion _ Value2% 100) / 10;Ge = (conversion _ Value2% 10);Lcd162a _ disponechar (2,1, Wan + 48);Lcd162a _ disponechar (2,2, Qian + 48);Lcd162a _ disponechar (2,3, Bai + 48);Lcd162a _ disponechar (2,4, Shi + 48);Lcd162a _ dispon

10、echar (2.5, Ge + 48);Lcd162a _ disponechar (2,6,72);Lcd162a _ disponechar (2,7,90);ADC1 _ deinit ();/ / 初始化adc, 連續(xù)轉(zhuǎn)換模式ADC1 _ init (ADC1 _ conversionmode _ continuous, ADC1 _ channel _ 9, ADC1 _ Pressel _ fcpu _ D18, ADC1 _ exttrig _ Tim, disable, ADC1 _ align _ right, ADC1 _ schmitttrig _ channel9,

11、disable);/ / 開始轉(zhuǎn)換ADC1 _ startconversion ();/ / T = ADC1 _ getconversionvalue ();Lcd162a _ reset ();Lcd162a _ CLS ();Lcd162a _ eputstr (1,1, P1);Lcd162a _ eputstr (2,1, P2);/ *Putint (10240000 / T - 10000);Putchr ( R);Putchr ( n);Putintline (T);* /Delay _ MS (2000); / / lcd162c中有定義, 延遲2sLcd162a _ CLS

12、 ();/ / LCD _ Bianliang _ 128 (5, 3, R);While (1)Lcd162a _ CLS ();TIM2 _ clearflag (TIM2 _ flag _ CC1);While (TIM2 - Sr1 & TIM2 _ flag _ CC1). = TIM2 _ flag _ CC1);/ * get CCR1 value * /T1 = TIM2 _ getcapture1 ();TIM2 _ clearflag (TIM2 _ flag _ CC1);While (TIM2 - Sr1 & TIM2 _ flag _ CC1). = TIM2 _ f

13、lag _ CC1);/ * get CCR1 value * /T2 = TIM2 _ getcapture1 ();TIM2 _ clearflag (TIM2 _ flag _ CC1);T = T2 - T1;Conversion _ Value2 = 2000000 / T;萬=(conversion_value2 / 10000);錢=(conversion_value2 % 10000)/ 1000;白=(conversion_value2 % 1000)/ 100;石=(conversion_value2 % 100)/ 10;GE =(conversion_value2 %

14、10);lcd162a_disponechar(2,1,萬+ 48);lcd162a_disponechar(2,2,前+ 48);lcd162a_disponechar(2,白+ 48);lcd162a_disponechar(2,4,石+ 48);lcd162a_disponechar(2,5,葛+ 48);lcd162a_disponechar(2,6,72);lcd162a_disponechar(2,7,90);conversion_value = adc1_getconversionvalue();conversion_value =(U32)1024(U32)10000)/ co

15、nversion_value-10000);/ /十位四舍五入conversion_value =(conversion_value / 10000)* 10000 +(conversion_value % 10000)/ 1000)* 1000 +(conversion_value % 1000)/ 100)* 100 +(conversion_value % 100)/ 10;x =(conversion_value % 100)/ 10;如果(x = 5) + +;conversion_value =(conversion_value / 10000)* 10000 +(conversion_value % 10000)/ 1000)* 1000 +(conversion_value % 1000)/ 100)+ 1)* 100;如果(x5) conversion_value =(conversion_value / 10000)* 10000 +(conversion_value % 10000)/ 1000)* 1000 +(conversion_value % 1000)/ 100)* 100;/ /電阻溫度為(y = 0;conversion_value!=組織年;Y + +);convers

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論