终极流水灯单片机C语言程序.docVIP

  • 6
  • 0
  • 约1.41千字
  • 约 3页
  • 2018-11-23 发布于河南
  • 举报
终极流水灯单片机C语言程序

#includereg52.h #includeintrins.h #define uint unsigned int sbit beep=P2^3; void ji_ou(); void sx(); void shanshuo(); void two_out_in_out(); void four_out_in_out(); void delay(uint z) { uint x,y; for(x=z;x0;x--) for(y=110;y0;y--); } void main() { ji_ou(); sx(); two_out_in_out(); four_out_in_out(); shanshuo(); P1=0xff; while(1); } void ji_ou() { uint t; for(t=0;t3;t++) { P1=0xaa; delay(300); P1=0x55; delay(300); } } void sx() { uint a,i,j; for(j=0;j3;j++) { a=0xfe; for(i=0;i8;i++) { P1=a; //delay(200); beep=0; delay(50); beep=1; delay(50); a=_crol_(a,1); } a=0x7f; for(i=0;i8;i++) { P1=a; //delay(200); beep=0; delay(50); beep=1; delay(50); a=_cror_(a,1); } } } void two_out_in_out() { uint i,j; P1=0xff; for(i=0;i3;i++) { P1=0x7e; delay(300); P1=0xbd; delay(300); P1=0xdb; delay(300); P1=0xe7; delay(300); } P1=0xff; for(j=0;j3;j++) { P1=0xe7; delay(300); P1=0xdb; delay(300); P1=0xbd; delay(300); P1=0x7e; delay(300); } } void four_out_in_out() { uint k; P1=0xff; for(k=0;k3;k++) { P1=0x3c; delay(300); P1=0xc3; delay(300); } P1=0xff; for(k=0;k3;k++) { P1=0xc3; delay(300); P1=0x3c; delay(300); } } void shanshuo() { uint k; P1=0xff; for(k=0;k6;k++) { P1=~P1; delay(300); beep=0; delay(50); beep=1; delay(50); } }

文档评论(0)

1亿VIP精品文档

相关文档