用c语言编程,用数码管同时显示1-6或自己的学号后六位这6个数字,并让显示的数字循环移动起来
#include #defineuintunsignedint#defineucharunSignedCharsBitdula = p2 ^6 ; sbitwela = p2 ^7 ; uCharnum; uCharCodetable [] = {0x3 f,0x06 ,0x5 b,0x4 f,0x6 6 ,0x6 d,0x7 d,0x07 ,0x7 f,0x6 f,0x6 f,0x7 7 ,0x7 7 ,0x7 c,0x3 9 ,0x5 e,0x7 9 ,0x7 1 }; voidDelay(uintz); voidmain(){wela = 1 ; // 1 1 1 01 01 01 0p0 = 0xea; wela; wela; wela = 0; while(num = 0; num = 0; num <1 6 ; num ++){dula = 1 ; p0 = table [ num]; dula = 0; delay(1 000);}}}}} voidDelay(uintz){uintx,y; for(x = z; x> 0; x-)for(y = 1 1 0; y> 0; y; y ---);}
用单片机c51编出程序,显示两位学号
如果是静态数字管,则可以通过黄油单独控制数字管显示。
单片机数码管静态显示学号1830508,用keil 最好有过程,在图上的过程上修改
//动态显示数字管。
关联。
#include #defineCharunsignedchar // This table is an LED font 01 2 3 4 5 6 7 8 9 8 9 ABCDEFUNSINEDCHORCODELED7 CODE [] = {0x0x5 f, 0x06 ,0x5 b, 0x4 f, 0x4 f, 0x4 f, 0x4 f, 0x6 6 .0x6 d,0x7 d,0x07 .0x7 f,0x6 6 .0x6 d,0x7 d,0x07 0x7 ,0x7 7 .0x7 c,0x3 9 .0x5 e,0x7 9 .0x7 1 }; voiddelay(ucharz){uchari,j; for(i = 0; i
51单片机,要求是让流水灯正常运行,要求是数码管显示学号流水灯运行,然后打开开关数码管开始计数?
#include“ at8 9 x5 2 .h” #include“ interins.h”#defulleleg_linep2 unsignedlongdispalycount; unsedIntmcount; unsededchartable [] = {0xc0,0xf9 ,0xa4 ,0xb0 }; voiddisplay(unsignedlongdisplaydata){leg_line = 0x01 ; 1 00; /1 00000]; MCONT = 1 00; 而(mcount-); leg_duan = 0xff; leg_line = 0x00; leg_line = 0x04 ; leg_duan = table [displayData%1 000000%1 00000000]; MCONT = 1 00; 而(mcount-); leg_duan = 0xff; leg_line = 0x00; leg_line = 0x08 ; leg_duan = table [displayData%1 00000000%1 0000000%1 000000/1 00000]; mcont = 1 00; 而(mcount-); leg_duan = 0xff; leg_line = 0x00; leg_line = 0x1 0; leg_duan = table [displayData%1 0000000%1 00000%1 00000000/1 000]; MCONT = 1 00; 而(mcount-); leg_duan = 0xff; leg_line = 0x00; leg_line = 0x2 0; leg_duan = table [displayData%1 000000%1 0000%1 0000%1 0000%1 0000%1 000/1 00]; MCONT = 1 00; 1 0000%1 0000%1 0000%1 0000%1 0000%1 000%1 000/1 0]; MCONT = 1 00; 而(mcount-); leg_duan = 0xff; leg_line = 0x00; leg_line = 0x 8 0; leg_duan = table [displayData%1 0]; MCONT = 1 00; ystatus; voidmain(void){timer1 init(); while(1 ){if(button == 0){mcount = 1 00; while(mcount-){keystatus = 〜keystatus! button);}} if(!keystatus){display(displayData); VispalyCount = 0;} else {display(vispalyCount);}} unsignEdInt Count1 ,count2 ; unsignedchartemp = 0xfe; voidTime1 ()中断{tl1 = 0x00; ; temp = _croke_(temp,1 ); p1 = temp;} if(count2 ++ == 1 0){count2 = 0; 如果(VistalyCount ++> = 8 8 8 8 8 8 8 8 ){VistalyCount = 0;}}}}