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

正文內(nèi)容

智能儀表論文基于單片機(jī)的電機(jī)控制-資料下載頁

2025-06-28 05:10本頁面
  

【正文】 }void init(){ TMOD=0x22。 SCON=0x58。 PCON=0x00。 ES=1。 ET0=1。 PS=1。 TH0=0。 TL0=0。 TR0=0。 TH1=0xFD。 TL1=0xFD。 TR1=1。 EA=1。 P1=0xff??梢匀サ魙void main(){ init()。 show()。 while(1) { if(key1==0) { delay(8)。去抖動延時 if(key1==0) time++。 if(time==21) time=0。 showbuf[0]=led_tab[time/10]。取整(十位) showbuf[1]=led_tab[time%10]。取余(個位) show()。 key1=1。 while(key1==0)。 } if(key2==0) { delay(8)。 if(key2==0) step++。 if(step==21) step=0。 showbuf[2]=led_tab[step/10]。 showbuf[3]=led_tab[step%10]。 show()。 key2=1。 while(key2==0)。 } if(key3==0) { delay(8)。 if(key3==0) { SBUF=time。等候時間按鍵釋放 while(TI==0)。 (//||serial_buf==0 可去掉) TI=0。不發(fā)送數(shù)據(jù) serial_buf=0。//串行恢復(fù)初值 SBUF=step。//等候步數(shù)按鍵釋放 while(TI==0)。 (//||serial_buf==0 可去掉) TI=0。 serial_buf=0。//串行恢復(fù)初值 } while(key3==0)。 } }}void timer0() interrupt 1{ show()。定時器0,//用的是定時方式一16位}void serial_r() interrupt 4串行通訊{ if(RI) { RI=0。 serial_buf=SBUF。 }}附錄C下位機(jī)程序:include define uchar unsigned chardefine uint unsigned intuchar showbuf[4]={0x3f,0x3f,0x3f,0x3f}。//顯示控制字uchar addr=0,time=0,step=0,run=0。//定義時間,步數(shù),運(yùn)行,uchar ctrl[]={0xe,0xd,0xb,7}。 //步進(jìn)電機(jī)控制字uchar con。//一個循環(huán)累計的步數(shù)()void delay(uint j){ uint i=j+1。//給i賦值 for(。j0。j) for(。i0。i)。}void motor(uchar time,uchar step)//步進(jìn)電機(jī){ uchar temp,j=0。 con=(time*)*20。 temp=con。//原始數(shù)據(jù)存儲 if(con=2 amp。amp。 con=200)//步數(shù)控制范圍 { while(step0)//步數(shù)走了 { if(j==4) j=0。//等于4的時候執(zhí)行j=0//四相四拍 P2=ctrl[j]。//控制相數(shù) TR0=1。//計時器開始計時 while(TR0==1)。//循環(huán) con=temp。 j++。 step。 } }}void sys_init(){ TMOD=0x21。//中斷T0工作方式 //T0工作方式16位定時器/計數(shù)器 T1工作方式自動重載8位定時器/計數(shù)器 SCON=0x58。//串口工作方式1 允許接收 接收數(shù)據(jù)位8 PCON=0x00。 ES=1。//允許串行口中斷 ET0=1。//允許定時器T0中斷 PS=1。 EA=1。//總中斷準(zhǔn)許 TH0=0x3C。 TL0=0xAF。//計數(shù)器初值 TH1=0xFD。 TL1=0xFD。 TR0=0。 TR1=1。}void main() //主函數(shù){ uchar i,j。 sys_init()。 while(1) { if(run==1) { motor(time,step)。//顯示,(可去掉) run=0。 } }}void timer0() interrupt 1//中斷函數(shù){ TH0=0x3c。 TL0=0xaf。 con。 if(con==0) { TR0=0。//20 步一個循環(huán) }}void serial_r() interrupt 4//串行中斷p3,0:{ if(RI)//接受 { RI=0。 if(addr==2) {addr=0。run=1。} if(addr==0) time=SBUF。 if(addr==1) step=SBUF。 addr++。 } if(TI)發(fā)送(如果上面程序?qū)崿F(xiàn)就發(fā)送) TI=0。}31
點擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1