51单片机C语言程序(四)键盘 数码管 跑表程序
数码管前三位显示一个跑表,
从000到999之间以1%秒的速度运行,
当按下一个独立键盘时跑表停止,
松开手后跑表继续运行(用定时器设计表)
#include
#include
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
sbit s2=P3^4;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,
0x76,0x79,0x38,0x3f,0};
uchar flag,t0,ge,shi,bai;
uint shu;
void init();
void display(uchar aa,uchar bb,uchar cc);
void delay(uint z)
{
}
void main()
{
}
void init()
{
}
void timer0() interrupt 1
{
}
void display(uchar aa,uchar bb,uchar cc)
{
}
程序二
数码管前三位显示一个跑表,
从000到999之间以1%秒的速度运行,
当按下一个独立键盘时跑表停止,
松开手后跑表继续运行(用定时器设计表)
三个独立键盘实现按下第一个时计时停止,按下第二个
时计时结束,按下第三个是计数值清零从头开始
#include
#include
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
sbit s2=P3^4;
sbit s3=P3^5;
sbit s4=P3^6;
sbit s5=P3^7;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,
0x76,0x79,0x38,0x3f,0};
uchar flag,t0,ge,shi,bai;
uint shu;
void init();
void display(uchar aa,uchar bb,uchar cc);
void delay(uint z)
{
}
void main()
{
}
void init()
{
}
void timer0() interrupt 1
{
}
void display(uchar aa,uchar bb,uchar cc)
{
}
程序三
按下16个矩阵键盘依次在数码管上显示
1-16的平方。如按下第一个显示1,
第二个显示4---
#include
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
sbit key1=P3^4;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uchar temp;
uint num,num1;
void delay(uint z)
{
}
uint keyscan();
void display(uchar,uchar,uchar);
void main()
{
}
void display(uchar aa,uchar bb,uchar cc)
{
}
uint keyscan()
{
51单片机C语言程序键盘数码管跑表程 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)