|
單片機(jī)流水燈控制器設(shè)計仿真
0.png (68.3 KB, 下載次數(shù): 57)
下載附件
2017-5-23 21:53 上傳
0.png (67.72 KB, 下載次數(shù): 60)
下載附件
2017-5-23 21:54 上傳
單片機(jī)代碼:
- #include <REGX52.H>
- void Delay1ms(unsigned int count)
- {
- unsigned int i,j;
- for(i=0;i<count;i++)
- for(j=0;j<120;j++);
- }
- main()
- {
- unsigned char LEDIndex = 0;
- bit LEDDirection = 1;
- while(1)
- {
- if(LEDDirection)
- P1 = ~(0x01<<LEDIndex);
- else
- P1 = ~(0x80>>LEDIndex);
- if(LEDIndex==7)
- LEDDirection = !LEDDirection;
- LEDIndex = (LEDIndex+1)%8;
- Delay1ms(100);
- }
- }
復(fù)制代碼
下載:
4e46dc67290d10bad76915cacf2700e4.rar
(61.07 KB, 下載次數(shù): 9)
2017-5-23 21:28 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
評分
-
查看全部評分
|