freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于單片機(jī)的身高體重測量儀畢業(yè)論文-資料下載頁

2025-06-27 21:16本頁面
  

【正文】 0。 //設(shè)置串口工作模式SM1=1。TMOD = 0x21。 //設(shè)置定時(shí)器工作模式TH1=0xfd。 //設(shè)置波特率為9600TR1=1。 //開定時(shí)器1}:ifndef _INIT_H_define _INIT_H_ include void system_init(void)。endif:include void delay_ms(unsigned int z) //延時(shí)函數(shù){unsigned int x,y。for(x=z。x0。x)for(y=110。y0。y)。}unsigned char Key_Scan(unsigned char key_num){switch(key_num) //key_num為要檢測的按鍵{case 1: //第一個(gè)按鍵為低電平if(key1==0){ //延時(shí)去抖 濾除雜波delay_ms(5)。 //濾波后再次檢測if(key1==0){while(!key1)。 //松手檢測return 1。 //返回值為1}else{return 0。 //濾波后按鍵沒有按下 返回0}}else //按鍵沒有按下 返回0{return 0。}break。case 2: //第二個(gè)按鍵if(key2==0){delay_ms(5)。if(key2==0){while(!key2)。return 1。}else{return 0。}}else{return 0。}break。case 3: //第三個(gè)按鍵if(key3==0){delay_ms(5)。if(key3==0){while(!key3)。return 1。}else{return 0。}}else{return 0。}break。case 4: //第四個(gè)按鍵if(key4==0){delay_ms(5)。if(key4==0){while(!key4)。return 1。}else{return 0。}}else{return 0。}break。case 5: //第五個(gè)按鍵按下if(key5==0){delay_ms(5)。if(key5==0){while(!key5)。return 1。}else{return 0。}}else{return 0。}break。default:break。}}:ifndef _KEY_H_define _KEY_H_include sbit key1=P2^0。sbit key2=P2^1。sbit key3=P2^2。sbit key4=P2^3。sbit key5=P3^7。unsigned char Key_Scan(unsigned char key_num)。void delay_ms(unsigned int z)。endif:include static void Pulse(void) //產(chǎn)生超聲波脈沖激勵(lì)信號{unsigned char i。for (i=0。i10。++i) //循環(huán)十次{_nop_()。 //延時(shí)_nop_()。_nop_()。_nop_()。_nop_()。_nop_()。_nop_()。_nop_()。_nop_()。TX = ~TX。 //TX引腳輸出電平翻轉(zhuǎn)}}int sonic(void){unsigned int n。RX=1。 //接收引腳置為高電平TR0=0。 //關(guān)定時(shí)器0TH0=TL0=0。 //計(jì)數(shù)值清零Pulse()。 //發(fā)射超神波脈沖信號TR0=1。 //定時(shí)器0打開 開始計(jì)時(shí)TF0=0。 //定時(shí)器溢出標(biāo)志位清零for(n=0。n70。n++)。 //延時(shí)以排出相鄰干擾while( RX ==1 amp。amp。 TF0 == 0 ) 。 //等待收到回波信號或定時(shí)器溢出TR0=0。 //停止計(jì)時(shí)if ( TF0 ) //定時(shí)器溢出 認(rèn)為無回波返回{n=999。 //無信號返回時(shí)把距離值賦999cm}else //若定時(shí)器沒有溢出 計(jì)算傳播距離{n=(TH08)+TL0。 //定時(shí)時(shí)間整合n=(unsigned int) ( n*)。 //將定時(shí)時(shí)間轉(zhuǎn)換成傳播距離n=n3。 //減去承重板到地面的高度}return n。 //將高度值返回}:ifndef _ULTRASONIC_H_define _ULTRASONIC_H_include include sbit TX = P1^3。sbit RX = P1^4。int sonic(void)。endif:include unsigned char code BMP[]。 //開機(jī)圖像/*檢查忙位*/void chk_busy(void){RS=0。 //RS為指令/數(shù)據(jù)選擇信號 寫命令RS=0RW=1。 //RW為讀寫選擇信號 讀狀態(tài)RW=1E=1。 //E為使能引腳 E=1液晶使能Lcd_Bus=0xff。 //液晶數(shù)據(jù)總線全部拉高while((Lcd_Busamp。0x80)==0x80)。 //當(dāng)最高位為0時(shí)可以接受新的指令E=0。 //禁止使能}/*延時(shí)子程序*/void delay(unsigned int t){unsigned int i,j。for(i=0。it。i++)for(j=0。j10。j++)。}/*寫命令到LCD*/void write_(unsigned char cmdcode){chk_busy()。 //忙位檢查 檢查是否可以接收指令RS=0。 //RS為指令/數(shù)據(jù)選擇信號 寫命令RS=0RW=0。 //RW為讀寫選擇信號 寫命令RW=0E=1。 //液晶使能Lcd_Bus=cmdcode。 //將命令送到數(shù)據(jù)總線delay(5)。 //在數(shù)據(jù)寫入后加入適當(dāng)?shù)难訒r(shí)E=0。 //禁止使能delay(5)。 //延時(shí)}/*寫數(shù)據(jù)到LCD*/void write_data(unsigned char Dispdata){chk_busy()。 //忙位檢查RS=1。 //RS為指令/數(shù)據(jù)選擇信號 寫數(shù)據(jù)RS=1RW=0。 //RW為讀寫選擇信號 寫數(shù)據(jù)RW=0E=1。 //液晶使能Lcd_Bus=Dispdata。 //將數(shù)據(jù)送到數(shù)據(jù)總線delay(5)。 //在數(shù)據(jù)寫入后候加入適當(dāng)?shù)难訒r(shí)E=0。 //禁止使能delay(5)。 //延時(shí)}/*初始化LCD屏*/void lcdreset(void){delay(2000)。 //延時(shí)write_(0x30)。 //8位控制方式delay(10)。write_(0x30)。 //選擇8bit數(shù)據(jù)流delay(5)。write_(0x0c)。 //開顯示(無游標(biāo)、不反白)delay(10)。write_(0x01)。 //清屏幕delay(500)。write_(0x06)。 //設(shè)定游標(biāo)的移動(dòng)方向及指定顯示的移位delay(0)。}/*顯示字符串*/void hzkdis(unsigned char *s){while(*s0) //判斷字符串是否都寫入液晶中{write_data(*s)。 //寫字符s++。 //指針指向的地址加1delay(50)。 //延時(shí)}}/*清屏命令*/void clrscreen(void){write_(0x01)。 //寫命令0x01清屏命令delay(10)。 //延時(shí)}/*顯示圖片*/void Disp_Img(unsigned char code *img){unsigned int j=0。unsigned char x,y,i。for(i=0。i9。i+=8)for(y=0。y32。y++) for(x=0。x8。x++){write_(0x36)。 write_(y+0x80)。 write_(x+0x80+i)。 write_(0x30)。write_data(img[j++])。write_data(img[j++])。}}:ifndef _LCD_12864_H_define _LCD_12864_H_include sbit RS = P1^0。sbit RW = P1^1。sbit E = P1^2。sbit RES = P2^6。sbit PSB = P2^7。define Lcd_Bus P0void lcdreset(void)。void hzkdis(unsigned char *s)。void delay(unsigned int t)。void write_(unsigned char cmdcode)。void write_data(unsigned char Dispdata)。void clrscreen(void)。void Disp_Img(unsigned char code *img)。endif3
點(diǎn)擊復(fù)制文檔內(nèi)容
醫(yī)療健康相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1