bshy.net
当前位置:首页>>关于单片机用C语言写两个数码管显示0到59循环的程序在归0的资料>>

单片机用C语言写两个数码管显示0到59循环的程序在归0

#include sbit wei=P3^0; sbit led1=P3^2; sbit led2=P3^3; char tt =0; char i=0; unsigned char code led_zx[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff}; void mdelay(unsigned int delaytime) { int c; for(;delaytime!=0;...

#include //----------------------------------------------- void delay(unsigned int i) //延时 { unsigned char j; while(i--) for(j = 0; j < 115; j++); } //----------------------------------------------- void main(void) { unsigned...

#include#include#define u16 unsigned int#define u8 unsigned char/*********************************************************/u8 ds[2]; //数码管显示缓存//共阴code u8 w[]={~0x01,~0x02,~0x04,~0x08};//位码code u8 d[]={~0xc0,~0xf9,~0x...

动态扫描,先送位选1 锁存,段选1; 然后,位选2锁存,段选2

两个灯管的交换不要放在中断程序里面。拿到主程序循环,中间加点延迟。 中断程序只负责改变时间k。 另外 k==60才变回0。

#include unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; void show(unsigned char n); void delay(); void main() { unsigned char i; int j; while(1) { for(i=0;j=100,i

# include# define uint unsigned int# define uchar unsigned charcode uchar shu[] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07, /* 0 1 2 3 4 56 7*/0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}; //数码管段选 /* 8 9a b c def*/code uchar w...

#include sbit k1=P1^0; #define uint16 unsigned int #define uchar unsigned char uchar code shuzu[ ]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; void delay() { uint16 i=1000; while(i--); } void main() { uchar n ; P2...

去我的博客上参考吧,

电路有错。。。。。

网站首页 | 网站地图
All rights reserved Powered by www.bshy.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com