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

正文內(nèi)容

單片機(jī)c語言程序設(shè)計(jì)實(shí)訓(xùn)100例基于proteus仿真-在線瀏覽

2025-08-13 05:56本頁面
  

【正文】 DoorBell=~DoorBell。 if(p400) //若需要拖長聲音,可以調(diào)整400和800 { TH0=(8192700)/32。 } else if(p800) { TH0=(81921000)/32。 } else { TR0=0。 }}39 演奏音階/* 名稱:演奏音階 說明:本例使用定時(shí)器演奏一段音階,播放由K1控制。sbit SPK=P3^4。 //音符索引//14個(gè)音符放在方式2下的定時(shí)寄存器(TH0,TL0)uchar code HI_LIST[]={0,226,229,232,233,236,238,240,241,242,244,245,246,247,248}。//定時(shí)器0中斷函數(shù)void T0_INT() interrupt 1{ TL0=LO_LIST[i]。 SPK=~SPK。 while(ms) for(t=0。t++)。 //T0方式0 IE=0x82。 while(1) { while(K1==1)。 //等待釋放 for(i=1。i++) { TR0=1。 //播放延時(shí) TR0=0。 } }}40 按鍵控制定時(shí)器選播多段音樂/* 名稱:按鍵控制定時(shí)器選播多段音樂 說明:本例內(nèi)置3段音樂,K1可啟動(dòng)停止音樂播放,K2用于選擇音樂段。 //播放和停止鍵sbit SPK=P3^7。 //當(dāng)前音樂段索引,音符索引//數(shù)碼管段碼表uchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}。uchar code LO_LIST[]={0,4,13,10,20,3,8,6,2,23,5,26,1,4,3}。//三段音樂的節(jié)拍uchar code Len[][50]={ {1,1,1,1,1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1}, {1,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2,2,1}, {1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1,2,1,1,2,2,1}}。 //播放結(jié)束或者播放中途切換歌曲時(shí)停止播放 Song_Index=(Song_Index+1)%3。 P2=DSY_CODE[Song_Index]。 TH0=HI_LIST[Song[Song_Index][Tone_Index]]。}//延時(shí)void DelayMS(uint ms){ uchar t。t120。}//主程序void main(){ P2=0xc0。 TMOD=0x00。 IT0=1。 while(1) { while(K1==1)。 //等待釋放 TR0=1。 //從第0個(gè)音符開始 //播放過程中按下K1可提前停止播放(K1=0)。amp。amp。 //播放延時(shí)(節(jié)拍) Tone_Index++。 //停止播放 while(K1==0)。*/includedefine uchar unsigned chardefine uint unsigned intsbit RED_A=P0^0。sbit GREEN_A=P0^2。 //南北向指示燈sbit YELLOW_B=P0^4。//延時(shí)倍數(shù),閃爍次數(shù),操作類型變量uchar Time_Count=0,Flash_Count=0,Operation_Type=1。 TH0=50000%256。YELLOW_A=0。 RED_B=1。GREEN_B=0。 //5s(100*50ms)切換 Time_Count=0。 break。 Time_Count=0。GREEN_A=0。 //閃爍 Flash_Count=0。 break。YELLOW_A=0。 RED_B=0。GREEN_B=1。 //5s(100*50ms)切換 Time_Count=0。 break。 Time_Count=0。GREEN_A=0。 //閃爍 Flash_Count=0。 break。 //T0方式1 IE=0x82。 while(1)。*/includeincludedefine uchar unsigned chardefine uint unsigned intsbit SPK=P3^7。//延時(shí)void DelayMS(uint ms){ uchar i。i120。}//INT0中斷函數(shù)void EX0_INT() interrupt 0{ TR0=~TR0。 if(P2==0x00) P2=0xe0。 //關(guān)閉所有LED }//定時(shí)器0中斷void T0_INT() interrupt 1{ TH0=0xfe。 SPK=~SPK。 TL1=45000%256。}//主程序void main(){ P2=0x00。 TMOD=0x11。 TL0=0xff。 IE=0x8b。 //INT0設(shè)為最高優(yōu)先 TR0=0。 //定時(shí)器啟停由INT0控制,初始關(guān)閉 while(1) { FRQ++。 }}43 串行數(shù)據(jù)轉(zhuǎn)換為并行數(shù)據(jù)/* 名稱:串行數(shù)據(jù)轉(zhuǎn)換為并行數(shù)據(jù) 說明:串行數(shù)據(jù)由RXD發(fā)送給串并轉(zhuǎn)換芯片74164,TXD則用于輸出移位時(shí)鐘脈沖,74164將串行輸入的1字節(jié)轉(zhuǎn)換為并行數(shù)據(jù),并將轉(zhuǎn)換的數(shù)據(jù)通過8只LED顯示出來。*/includeincludedefine uchar unsigned chardefine uint unsigned intsbit SPK=P3^7。//延時(shí)void DelayMS(uint ms){ uchar i。i120。}//主程序void main(){ uchar c=0x80。 //串口模式0,即移位寄存器輸入/輸出方式 TI=1。 SBUF=c。 //等待發(fā)送結(jié)束 TI=0。 }} 44 并行數(shù)據(jù)轉(zhuǎn)換為串行數(shù)據(jù)/* 名稱:并行數(shù)據(jù)轉(zhuǎn)換為串行數(shù)據(jù) 說明:切換連接到并串轉(zhuǎn)換芯片74LS165的撥碼開關(guān),該芯片將并行數(shù)據(jù)以串行方式發(fā)送到8051的RXD引腳,移位脈沖由TXD提供,顯示在P0口。 //shift/load//延時(shí)void DelayMS(uint ms){ uchar i。i120。}//主程序void main(){ SCON=0x10。 //置數(shù)(load),讀入并行輸入口的8位數(shù)據(jù) SPL=1。 //未接收1字節(jié)時(shí)等待 RI=0。 //接收到的數(shù)據(jù)顯示在P0口,顯示撥碼開關(guān)的值 DelayMS(20)。*/includedefine uchar unsigned chardefine uint unsigned intsbit LED1=P0^0。sbit K1=P1^0。 while(ms) for(i=0。i++)。 while(TI==0)。}//主程序void main(){ uchar Operation_No=0。 //串口模式1 TMOD=0x20。 //波特率不倍增 TH1=0xfd。 TI=0。 while(1) { if(K1==0) //按下K1時(shí)選擇操作代碼0,1,2,3 { while(K1==0)。 } switch(Operation_No) //根據(jù)操作代碼發(fā)送A/B/C或停止發(fā)送 { case 0: LED1=LED2=1。 case 1: Putc_to_SerialPort(39。)。LED2=1。 case 2: Putc_to_SerialPort(39。)。LED1=1。 case 3: Putc_to_SerialPort(39。)。LED2=LED1。 } DelayMS(100)。*/includedefine uchar unsigned chardefine uint unsigned intsbit LED1=P0^0。//延時(shí)void DelayMS(uint ms){ uchar i。i120。}//主程序void main(){ SCON=0x50。 //T1工作模式2 PCON=0x00。 //波特率9600 TL1=0xfd。 TR1=1。 while(1) { if(RI) //如收到則LED閃爍 { RI=0。A39。LED2=1。 //LED1閃爍 case 39。: LED2=~LED2。break。C39。LED2=LED1。 //關(guān)閉LED DelayMS(100)。*/includedefine uchar unsigned chardefine uint unsigned intsbit LED1=P1^0。sbit K1=P1^7。 //操作代碼//數(shù)碼管代碼uchar code DSY_CODE[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}。 while(ms) for(i=0。i++)。 while(TI==0)。}//主程序void main(){ LED1=LED2=1。 SCON=0x50。 //T1工作模式2 PCON=0x00。 TL1=0xfd。 TR1=1。 //允許串口中斷 while(1) { DelayMS(100)。 Operation_No=(Operation_No+1)%4。X39。 LED1=LED2=1。 case 1: Putc_to_SerialPort(39。)。LED2=1。 case 2: Putc_to_SerialPort(39。)。LED1=1。 case 3: Putc_to_SerialPort(39。)。LED2=LED1。 } } }}//甲機(jī)串口接收中斷函數(shù)void Serial_INT() interrupt 4{ if(RI) { RI=0。amp。 else P0=0x00。*/includedefine uchar unsigned chardefine uint unsigned intsbit LED1=P1^0。sbit K2=P1^7。//延時(shí)void DelayMS(uint ms){ uchar i。i120。}//主程序void main(){ LED1=LED2=1。 //串口模式1,允許接收 TMOD=0x20。 //波特率9600 TL1=0xfd。 //波特率不倍增 RI=TI=0。 IE=0x90。 if(K2==0) { while(K2==0)。 //產(chǎn)生0~10范圍內(nèi)的數(shù)字,其中10表示關(guān)閉 SBUF=NumX。 TI=0。 switch(SBUF) //根據(jù)所收到的不同命令字符完成不同動(dòng)作 { case 39。: LED1=LED2=1。 //全滅 case 39。: LED1=0。break。B39。LED1=1。 //LED2亮 case 39。: LED1=LED2=0。*/includedefine uchar unsigned chardefine uint unsigned int//延時(shí)void DelayMS(uint ms){ uchar i。i120。}//向串口發(fā)送字符void Putc_to_SerialPort(uchar c){ SBUF=c。 TI=0。\039。 s++。 }}//主程序void main(){ uchar c=0。 //串口模式1 TMOD=0x20。 //波特率9600 TL1=0xfd。 //波特率不倍增 TI=0。 DelayMS(200)。 Puts_to_SerialPort(\r\n)。 while(1) { Putc_to_SerialPort(c+39。)。 Putc_to_SerialPort(39。)。 if(c==25) //每輸出一遍后加橫線 { Puts_to_SerialPort(\r\n\r\n)。 } c=(c+1)%26。 DelayMS(100)。在Proteus環(huán)境下完成本實(shí)驗(yàn)時(shí),需要安裝Virtual Serial Port Driver和串口調(diào)試助手。*
點(diǎn)擊復(fù)制文檔內(nèi)容
醫(yī)療健康相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1