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

正文內(nèi)容

單片機(jī)三相單三拍步進(jìn)電機(jī)(編輯修改稿)

2024-07-23 12:56 本頁面
 

【文章內(nèi)容簡介】 。sbit s2 = P0^2。//按鍵定義,s1正轉(zhuǎn),s2反轉(zhuǎn)sbit s3 = P0^3。//按鍵定義,停止sbit speaker = P0^4。sbit LED1 = P0^5。sbit LED2 = P0^6。sbit LED3 = P0^7。sbit a = P2^3。sbit b = P2^2。sbit c = P2^1。sbit d = P2^0。//脈沖信號輸入端定義sbit _key3 =P1^0。 //3步sbit _key6 =P1^1。 //6步sbit _key9 =P1^2。 //9步sbit _key12 =P1^3。 //12步sbit _key15 =P1^4。 //15步sbit _key18 =P1^5。 //18步sbit _key21 =P1^6。 //21步sbit _key24 =P1^7。 //24步sbit _key27 =P0^0。 //27步unsigned char code dofly_DuanMa[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}。// 顯示段碼值0~9unsigned char code dofly_WeiMa[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}。//分別對應(yīng)相應(yīng)的數(shù)碼管點(diǎn)亮,即位碼unsigned char TempData[8]。 //存儲顯示值的全局變量/*DS18B20 端口定義*/sbit DQ=P2^7。//ds18b20 端口bit ReadTempFlag。//定義讀時間標(biāo)志/* 函數(shù)聲明*/unsigned int ReadTemperature(void)。bit Init_DS18B20(void)。unsigned char ReadOneChar(void)。void WriteOneChar(unsigned char dat)。void DelayUs2x(unsigned char t)。void DelayMs(unsigned char t)。void _18b20(void)。//DS18B20定義/**/uchar code display[11]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff}。//共陽數(shù)碼管驅(qū)動信號09,不顯示uchar code time_counter[10][2]={{0xda,0x1c},{0xde,0xe4},{0xe1,0xec},{0xe5,0xd4},{0xe9,0xbc}, // 1ms {0xed,0xa4},{0xf1,0x8c},{0xf5,0x74},{0xf9,0x5c},{0xfc,0x18}}。 uchar num1 = 0。//控制取勵磁信號變量 uchar num2 = 8。uchar bushu = 0。uchar k=1。//加減檔位控制,1為最小檔bit flag1 = 0。//初始正轉(zhuǎn),正反轉(zhuǎn)標(biāo)志uchar buf[4]={0,10,10,1}。//數(shù)碼管顯示緩存,正轉(zhuǎn),不顯示,不顯示,顯示1檔位,高低(不能去掉) void key(void)。 void keyscan(void)。//================================定時器0/1初始化函數(shù)================================void T0_T1_init(){ TMOD = 0x11。//定時器0/1均工作于方式1,16位計時方式 TH0 = (65536 4000)/256。 TL0 = (65536 4000)%256。//定時器0,定時4ms用于數(shù)碼管掃描顯示 TH1 = time_counter[k1][0]。 TL1 = time_counter[k1][1]。//定時器1,定時10ms用于步進(jìn)電機(jī)轉(zhuǎn)速控制 TR0 = 1。 TR1 = 1。 ET0 = 1。 ET1= 1。//開定時器中斷 EA = 1。//開總中斷}//================================ms級延時函數(shù)=======================================void delay1m(uint x){ uint i,j。 for(i=0。ix。i++) //連數(shù)x次,約 x ms for(j=0。j120。j++)。 //數(shù)120 次,約1 ms} //================================主函數(shù)=============================================void main(){ T0_T1_init()。 Init_DS18B20()。 //buf[1] = 10。//不顯示 LED3 = 1。 speaker =1。 while(1) { if(s1 == 0) { delay1m(3)。 if(s1 == 0) { flag1 = 0。//正轉(zhuǎn) haha = 0x00。//停止 } while(!s1)。 } if(s2 == 0) { delay
點(diǎn)擊復(fù)制文檔內(nèi)容
范文總結(jié)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1