1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
#include
#define uchar unsigned char #define uint unsigned int ***it COM3=P2^3; ***it COM2=P2^2; ***it COM1=P2^1; ***it COM0=P2^0; ***it key1=P2^7; uchar i; unsigned char ScanCoun=0; unsigned char C0[10]={0x01,0x00,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01}; unsigned char C1[10]={0x03,0x02,0x02,0x02,0x03,0x01,0x01,0x02,0x03,0x03}; unsigned char C2[10]={0x01,0x00,0x03,0x02,0x02,0x02,0x03,0x00,0x03,0x02}; unsigned char C3[10]={0x03,0x02,0x01,0x03,0x02,0x03,0x03,0x02,0x03,0x03}; void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } key() // °´¼üº¯Êý { if(key1==0) { delay(10); if(key1==0) { i++; if(i>9) i=0; while(key1==0); } } } void main(void) { TMOD = 0x01; ET0 = 1; EA = 1; TR0 = 1; EA=1; //¿ªÈ«¾Ö×ÜÖÐ¶Ï while(1) { }} void timer0() interrupt 1 //¶¨Ê±Æ÷ÖÐ¶Ï { TL0=0x78; //¶¨Ê±5ms TH0=0xec; P2M1 =0x0f; P2M0 =0x00; key(); switch(ScanCoun) //¶¯Ì¬É¨ÃèÏÔʾ { case 0: //COM3正向驱动 COM0=1; COM1=1; COM2=1; COM3=0; P0=C0; P2M1 =0x07; P2M0 =0x00; break; case 1 : //COM3反向驱动 COM0=0; COM1=0; COM2=0; COM3=1; P0=~C0; P2M1 =0x07; P2M0 =0x00; break; case 2: //COM2正向驱动 COM0=1; COM1=1; COM2=0; COM3=1; P0=C1; P2M1 =0x0b; P2M0 =0x00; break; case 3: //COM2反向驱动 COM0=0; COM1=0; COM2=1; COM3=0; P0=~C1; P2M1 =0x0b; P2M0 =0x00; break; case 4: //COM1正向驱动 COM0=1; COM1=0; COM2=1; COM3=1; P0=C2; P2M1 =0x0d; P2M0 =0x00; break; case 5: //COM1反向驱动 COM0=0; COM1=1; COM2=0; COM3=0; P0=~C2; P2M1 =0x0d; P2M0 =0x00; break; case 6 : //COM0正向驱动 COM0=0; COM1=1; COM2=1; COM3=1; P0=C3; P2M1 =0x0e; P2M0 =0x00; break; case 7: //COM0反向驱动 COM0=1; COM1=0; COM2=0; COM3=0; P0=~C3; P2M1 =0x0e; P2M0 =0x00; break; } ScanCoun++; //加一 if (ScanCoun>7) ScanCoun=0; } |
|
相关推荐
3 个讨论
|
|
就教一下,下面这几行是什么意思.
unsigned char C0[10]={0x01,0x00,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01}; unsigned char C1[10]={0x03,0x02,0x02,0x02,0x03,0x01,0x01,0x02,0x03,0x03}; unsigned char C2[10]={0x01,0x00,0x03,0x02,0x02,0x02,0x03,0x00,0x03,0x02}; unsigned char C3[10]={0x03,0x02,0x01,0x03,0x02,0x03,0x03,0x02,0x03,0x03}; |
|
|
|
|
|
只有小组成员才能发言,加入小组>>
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 07:10 , Processed in 0.677550 second(s), Total 46, Slave 38 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号