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

正文內容

基于單片機的出租車計價器設計-資料下載頁

2025-06-19 12:51本頁面
  

【正文】 y0。y)。 } /***初始化程序***/ void init(void) { TMOD=0x10。 //定時器1初始化 TL1=0x00。 TH1=0x4c。 EA=1。 //開總中斷 ET1=1。 //開定時器1 第55頁 /共66頁 TR1=0。 //定時器1不工作 id=0。 sec=0。 min=0。 stopFlag=0。 hour=0。 stopsec=0。 stopmin=0。 stophour=0。 road =0 。 perMile =0。 total = 0。 dayPerMile=15。nightPerMile=18。 stopMoney=0。}/***按鍵檢測***/ void keyscan(void) { /*單價開始操作開始*/ if(swtich==0) delay(20)。 if(swtich==0) //松手檢測 { Beep()。 dayAndNight = ~dayAndNight。 } while(swtich==0)。 if(perUp==0) delay(20)。 if(perUp==0) //松手檢測 { Beep()。 if(dayAndNight) { nightPerMile++。 WriteCurrent(nightPerMile,3)。 } else { dayPerMile++。 WriteCurrent(dayPerMile,1)。 } } while(perUp==0)。 第56頁 /共66頁 if(perDown==0) delay(20)。 if(perDown==0) //松手檢測 { Beep()。 if(dayAndNight) { nightPerMile。 WriteCurrent(nightPerMile,3)。 } else { dayPerMile。 WriteCurrent(dayPerMile,1)。 } } while(perDown==0)。 if(maichong==0) delay(20)。 if(maichong==0) //松手檢測 { Beep()。 road += 5。 } while(maichong==0)。 if(startStop==0) delay(20)。 if(startStop==0) //松手檢測 { Beep()。 Beep()。 TR1=1。 id++。 if(id==2) { stopFlag=1。 id=0。 } if(id==1) { stopFlag=0。 } } while(startStop==0)。第57頁 /共66頁 if(clc==0) delay(20)。 if(clc==0) //松手檢測 { Beep()。 Beep()。 Beep()。 init()。 i=0。 } while(clc==0)。} void counter_time(void) { if(time=20) //每1s倒計時做減一操作 { sec++。 if(sec==59) //開始計時 { sec=0。 min++。 if(min==59) { min=0。 hour++。 if(hour==23) { hour=0。 } } } time=0。 if(stopFlag==1) { stopsec++。 if(stopsec==59) { stopsec=0。 stopmin++。 if(stopmin==59) { stopmin=0。 stophour++。 if(stophour==23) {第58頁 /共66頁 stophour=0。 } } } } }} void countStopMoney() //計算價錢{int time=0。 time = stophour*60+stopmin。 if(time=5) { stopMoney = 0。 } else { stopMoney = (time5)*8。 } //}/*計算價錢*/void countMoney(){ countStopMoney()。 if(dayAndNight) { perMile = nightPerMile = ReadCurrent(3)。 } else { perMile = dayPerMile = ReadCurrent(1)。 } if(road30) total=startMoney+((road30)*perMile)/10+stopMoney。 //金額計算 else total=startMoney+stopMoney。 //起步公里內金額計算 }/***主程序***/ /*初始化 24c02*/void init24c02(){第59頁 /共66頁 flagat = ReadCurrent(0)。 if(flagat) { } else { WriteCurrent(15,1)。 WriteCurrent(18,3)。 WriteCurrent(1,0)。 }}void main() { Beep()。 init()。 LCMInit()。init24c02()。 while(1) { display()。 keyscan()。 //分數(shù)按鍵檢測 } } /***定時器1中斷***/ void timer1() interrupt 3 //定時器1中斷20次為1s { time++。 TL1=0x00。 TH1=0x4c。 counter_time()。 //倒計時 }/*外部中斷void EX_INT0(void) interrupt 0 //外部中斷0函數(shù) { uchar num。 num++。 //一個計數(shù)器自增1 IT0=1。 //邊沿觸發(fā)方式 if(num==10 ) //判斷是否有10個脈沖 { num=0。 //清零 road += 。// } }掉電存儲程序:第60頁 /共66頁ifndef __at24c02_hdefine __at24c02_hdefine uchar unsigned chardefine uint unsigned intvoid DelayMs(uchar number)。void delay1(unsigned char x)。void Start(void)。 // 開始總線函數(shù)void Stop(void)。 // 結束總線函數(shù)uchar Read(void)。 // 讀一字節(jié)數(shù)據(jù)bit Send(uchar Data)。// 發(fā)送一字節(jié)數(shù)據(jù)uchar ReadCurrent(uchar Address)。// 從指定處讀出一字節(jié)void WriteCurrent(uchar Data,uchar Address)。// 在指定地址處寫入一字節(jié)void ReadFromROM(uchar Data[],uchar Address,uchar Num)。// 從指定地址讀出Num個數(shù)據(jù)void WriteToROM(uchar Data[],uchar Address,uchar Num)。 // 從指定地址寫入Num個數(shù)據(jù)endif1602LCD液晶顯示程序:include include include define LCM_Data P0define Busy 0x80 //用于檢測LCM狀態(tài)字中的Busy標識extern char hour,sec,min,stophour,stopsec,stopmin。 extern uint hpoint,rpoint。 extern int dayPerMile,nightPerMile。extern uchar dayAndNight。extern uint road,perMile,total。sbit Bp=P1^3。 //蜂鳴器接口 sbit Led = P1^4。extern char stopFlag。void Delay5Ms(void){unsigned int TempCyc = 5552。while(TempCyc)。}unsigned char rolmove(unsigned char m) { unsigned char a,b,c,d,e,f,g,h。 a=(mamp。0x01)7。b=(mamp。0x02)5。c=(mamp。0x04)3。 d=(mamp。0x08)1。e=(mamp。0x10)1。f=(mamp。0x20)3。g=(mamp。0x40)5。第61頁 /共66頁h=(mamp。0x80)7。m=a|b|c|d|e|f|g|h。 return m。 }void LCD_check_busy(void) //檢測LCD狀態(tài),看它是不是還在忙呢{ while(1) { LCD_EN=0。 LCD_RS=0。 LCD_RW=1。 LCD_DATA=rolmove(0xff)。 LCD_EN=1。 if(!rolmove(LCD_BUSY))break。 } LCD_EN=0。}void LCD_cls(void) //LCD清屏{// LCD_check_busy()。 LCD_RS=0。 LCD_RW=0。 LCD_DATA=rolmove(1)。 LCD_EN=1。 LCD_EN=0。}void LCD_write_instruction(unsigned char LCD_instruction) //寫指令到LCD{ //LCD_check_busy()。 LCD_RS=0。 LCD_RW=0。 LCD_DATA=rolmove(LCD_instruction)。 LCD_EN=1。 LCD_EN=0。 }void LCD_write_data(unsigned char LCD_data) //輸出一個字節(jié)數(shù)據(jù)到LCD{ // LCD_check_busy()。 LCD_RS=1。 LCD_RW=0。 LCD_DATA=rolmove(LCD_data)。 LCD_EN=1。 LCD_EN=0。第62頁 /共66頁} /*void LCD_set_position(unsigned char x) //LCD光標定位到x處{ LCD_write_instruction(0x80+x)。}void LCD_go_home(void) //LCD光標歸位{ LCD_write_instruction(LCD_GO_HOME)。}void LCD_printc(unsigned char lcd_data) //輸出一個字符到LCD{ LCD_write_data(lcd_data)。}void LCD_prints(unsigned char *lcd_string) //輸出一個字符串到LCD{ unsigned char i=0。 while(lcd_string[i]!=0x00) { LCD_write_data(lcd_string[i])。 i++。
點擊復制文檔內容
物理相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1