用c语言编程,用数码管同时显示1-6或自己的学号后六位这6个数字,并让显示的数字循环移动起来

如题所述

第1个回答  2015-05-28
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
uchar num;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
void delay(uint z);
void main()
{
wela=1;//11101010
P0=0xea;
wela=0;
while(1)
{
for(num=0;num<16;num++)
{
dula=1;
P0=table[num];
dula=0;
delay(1000);
}
}
}

void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}本回答被网友采纳

用c语言编程,用数码管同时显示1-6或自己的学号后六位这6个数字,并让显...
define uchar unsigned char sbit dula=P2^6;sbit wela=P2^7;uchar num;uchar code table[]={ 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};void delay(uint z);void main(){ wela=1;\/\/11101010 P0=0xea;wela=0;while(1){ for(num...

用51单片机C语言编写程序实现6位共阴极数码管循环显示0123456789ABCDEF...
\/\/数码管段选 \/* 8 9a b c def*\/code uchar wen[] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf};\/\/数码管位选uchar huancun[] = {0x00,0x00,0x00,0x00,0x00,0x00};\/\/数码管段选缓存sbit duan = P2^6;\/\/段选sbit wei = P2^7;\/\/位选void delay(uchar x)\/\/延时函数...

如何用C语言实现数码管显示数字12345和HELLO
sbit dula=P2^6;sbit wela=P2^7;uchar code tabledu[]={ 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};uchar code tablewe[]={ 0xfe,0xfd,0xfb,0xf7,0xef,0xdf};delay(uchar);uchar a;void main(){ while(1){ for(a=6;a>0...

C语言动态数码管显示学号的后六位,同时运行流水灯
unsigned char num[6];unsinged char numi;writenum(unsigned char i, unsigned char num){ num[i] = num;} 定时中断(){ 位选端口 = 0;段选端口 = num[numi];位选端口 = 1<<numi;numi++;if(numi > 5)numi = 0;}

如何用C语言编程控制数码管动态显示字符串?
用仿真实现,采用6位一体的共阴数码管,P0口输出段码,P2口输出位码。仿真图如下:程序如下 include <reg51.h> include <intrins.h> define uint unsigned int define uchar unsigned char uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,\/\/0~9段码 0x77,0x7...

如果需要让6个数码管分别显示1、2、3、4、5、6,如何用C语言编程?
在单片机上显示 五位 显示1 2 3 4 5 共阴的 但是电路很关键 看你怎么接 原理搞清楚。include <hidef.h> \/* common defines and macros *\/ include <MC9S12XS128.h> \/* derivative information *\/ void delay(int num){ unsigned int i,j;for(i=0;i<num;i++)for(j=0;j<35...

请c语言高手帮忙,写一个程序,51单片机显示1234,2S后显示5678 ,一直循环...
0x7D,\/*6*\/ 0x07,\/*7*\/ 0x7F,\/*8*\/ };sbit P2_0=P2^0;sbit P2_1=P2^1;sbit P2_2=P2^2;sbit P2_3=P2^3;void delay(unsigned int ms){ uchar i;while(ms--)for(i=0;i<123;i++);} void disp(){ if(flag)k=0;else k=4;P0=tab[k+0];P2_0=0;delay(1);P2_...

C语言单片机代码 数码管动态显示
9、A、B、C、D、E、F的段码,根据什么来填这些数组元素?那就要看你设计程序时定义数组的作用才能确定.table[1]对应的元素为0x06,是十六进制数,转换成二进制数是00000110B,分别对应于数码管的Dp、g、f、e、d、c、b、a 脚,所以在共阴数码管上点亮b、c两段,显示的是数字1,其它同理。

单片机C51编程(C语言):1到100的求和显示,在数码管里显示出来.
void convert();void display();void delay();\/\/共阴:0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F code unsigned char Led[16]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};uchar num,sw,gw;void main(){ num=0;while(1){ co...

c语言如何编程点亮一个数码管显示数字
共阴极数码管也就是说,当控制信号为1时该段LED点亮,8段数码管的数字0~9定义为:3FH,06H,5BH,4FH,66H ;01234 6DH,7DH,07H,7FH,6fh ;56789 以下为简易8路抢答器的例程:include<reg51.h> define uchar unsigned char uchar table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x...

相似回答