|
8255與LED修改地址
0.png (27.02 KB, 下載次數(shù): 29)
下載附件
2018-7-4 19:56 上傳
單片機(jī)源程序如下:
- #include <reg51.h>
- #include<absacc.h>
- #define PA XBYTE[0xff00]
- #define com XBYTE[0xff03]
- unsigned char code tab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
- unsigned char temp=9;
- sbit key0=P3^2;
- sbit key1=P3^3;
- sbit c1=P3^4;
- sbit c2=P3^5;
- delay(unsigned int t)
- {
- unsigned char k;
- while(t--) for(k=0;k<120;k++);
- }
- key_scan()
- {
- key1=1;
- key0=1;
- if(!key0) {delay(10);if(!key0){if(temp==9) temp=0;else temp++;while(!key0);}}
- if(key1==0) {delay(10);if(key1==0){if(temp==0)temp=9;else temp--;while(!key1);}}
- }
- disp()
- {
- PA=tab[temp];
- c1=0;
- delay(1);
- }
- main()
- {
- com=0x80;
- while(1)
- {
- disp();
- key_scan();
- }
- }
復(fù)制代碼
0.png (50 KB, 下載次數(shù): 24)
下載附件
2018-7-4 19:57 上傳
所有資料51hei提供下載:
8255與LED 修改地址.zip
(43.51 KB, 下載次數(shù): 18)
2018-7-4 13:08 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
|