- 博客(13)
- 收藏
- 关注
原创 在数码管上静态显示键值
#include#define uchar unsigned char#define uint unsigned int #define LL P0#define temp P1uchar code tab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};uc
2015-09-07 22:16:43
1764
原创 用三个独立按键实现按下第一个时计时停止,按下第二个时计时开始,按下第三个时计数值清零从头开始,秒表设计!!!!
#include#include#define uchar unsigned char #define uint unsigned intsbit dula=P2^6;sbit wela=P2^7;sbit key1=P3^5;sbit key2=P3^4;sbit key3=P3^3;sbit key4=P3^2;uchar code tab[]={0xc0,0xf9,0x
2015-09-06 16:53:44
7911
原创 用定时器1控制四位数码管从6432减到6393保持住这个数值,同时用定时器0控制流水灯从上至下以500ms移动同时停止!!!然后流水灯全部闪烁2.4秒后熄灭!继而数码管上显示6666
#include#include#define uchar unsigned char #define uint unsigned intsbit dula=P2^6;sbit wela=P2^7;uchar code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x8
2015-09-05 18:12:11
2091
原创 用定时器1设计秒表
#include#define uchar unsigned char#define uint unsigned int sbit dula=P2^6;sbit wela=P2^7;uchar code tab1[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
2015-09-03 19:30:51
3386
原创 用定时器在数码管上依次扫描出1,2,3,4
#include//#include#define uchar unsigned char#define uint unsigned int sbit dula=P2^6;sbit wela=P2^7;uchar code tabdu[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1
2015-09-02 20:45:43
1289
转载 同时用两个定时器控制蜂鸣器发声,定时器0控制频率,定时器1控制同个频率持续的时间,间隔300ms依次输出1,10,50,100,200,400,800,1K的方波
#include#include#define uchar unsigned char#define uint unsigned int uchar tt,aa;uint fre,flag;sbit beep=P3^6;void main(){ TMOD=0x11; //选择定时器 t0的工作方式为1 EA=1; TH0=(65536-fre)/256; TL0=
2015-09-01 20:39:33
9619
8
原创 利用定时/计数器T1产生定时时钟,由P1口控制8个发光二极管,使8个提示灯依次一个一个闪动,闪动频率为10次每秒(8个灯亮一遍为一个周期),循环
#include#include#define uchar unsigned char#define uint unsigned int uchar tt,aa;//sbit d1=P1^0;void main(){ TMOD=0x10; //选择定时器 t0的工作方式为1 EA=1; TH0=(65536-50000)/256; TL0=(65536-50000)
2015-09-01 19:28:47
32088
10
原创 利用定时/计数器TO从P1输入周期为1s的方波,让发光二极管以1HZ闪烁,设晶振频率为12MHZ
#include#define uchar unsigned char#define uint unsigned int uchar tt;sbit d1=P1^0;void main(){ TMOD=0x01; //选择定时器 t0的工作方式为1 EA=1; TH0=(65536-50000)/256; TL0=(65536-50000)%256; ET0=1;
2015-09-01 18:45:59
10172
转载 还是上边一个问题
#include #include #define uint unsigned int #define uchar unsigned char void delay(uint z) ; void main() { uchar a,i,j;while(1) {a=0xfe; for(j=0;j<8;j++){for(i=0;i<8-j;i++) {P1=a; dela
2015-08-31 21:32:13
484
转载 间隔300ms第一次一个管亮流动一次,第二次两个管亮流动。依次到8个管亮,然后重复此过程
#include #include #define ui unsigned int#define uc unsigned charvoid yanshi(ui);ui x,y,e;uc a,b,c,d;void main(){ while(1)//大循环 { e=1; for(a=1;a<=8;a++)//整个过程要重复8次,然后大循环 { b=9-a;//当第一次时
2015-08-31 21:22:31
7256
1
原创 8个发光二极管间隔200ms由上至下,再由下至上,再重复一遍,然后全部熄灭再次以300ms间隔全部闪烁5次,重复此过程
#include#include#define uchar unsigned char#define uint unsigned intuchar aa;void delay(uint z);void main(){ uchar i,j,k; while(1) { for(i=0;i<2;i++) { aa=0xfe; for(j=0;j<7;j++)
2015-08-31 20:40:11
16176
1
原创 8个发光二极管来回流动,每个管亮五十毫秒,灭五十毫秒,亮时蜂鸣器响,灭时蜂鸣器灭,一直重复下去
#include#include#define uchar unsigned char#define uint unsigned intsbit beep=P3^6;uchar aa;void delay(uint z);void main(){ uchar i,j; while(1) { aa=0xfe; for(i=0;i<7;i++) {
2015-08-31 20:10:24
3831
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人