文件名称:jpxs
介绍说明--下载内容来自于网络,使用问题请自行百度
取键值程序 功能:等待键入,并刷新显示,并返回键值放 A 占用: PSW,A,DPTR,R0,R2,R3,R4,R6,R7 入口:无 出口: A ORG 0190H WAT_KB: MOV R0,#3FH WAT_0: ACALL DISP_0 刷新显示器 ACALL T_KB JZ WAT_0 无键 , 循环 ACALL KEY_LD 延时消抖-#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit SDA=P1^0
sbit CLK=P1^1
sbit P1_2=P1^2
uchar checkKey[8] ={1,2,4,8,16,32,64,128}
code uchar Table[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}
void delay()
{
uint i
for(i=0 i<=500 i++)
}
void send(uchar a)
{
uchar i
for(i=0 i<8 i++)
{
if(_crol_(a,i)&0x80)
SDA=1
else
SDA=0
CLK=0
CLK=1
}
}
void xianshi(uchar a)
{
uchar coun
uchar com=0xbf
coun=a 10
P1=0xff
send(~Table[coun])
P1=com
delay()
P1=0xff
}
int main(void)
{
uint i
uchar keyValue
while(1)
{
send(0x00)
if(P1_2 == 0)
{
for(i = 0 i <8 i++)
{
send(~checkKey[i])
if(P1_2 == 0)
{
keyValue = i
xianshi(keyValue)
break
}
}
}
}
}
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit SDA=P1^0
sbit CLK=P1^1
sbit P1_2=P1^2
uchar checkKey[8] ={1,2,4,8,16,32,64,128}
code uchar Table[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}
void delay()
{
uint i
for(i=0 i<=500 i++)
}
void send(uchar a)
{
uchar i
for(i=0 i<8 i++)
{
if(_crol_(a,i)&0x80)
SDA=1
else
SDA=0
CLK=0
CLK=1
}
}
void xianshi(uchar a)
{
uchar coun
uchar com=0xbf
coun=a 10
P1=0xff
send(~Table[coun])
P1=com
delay()
P1=0xff
}
int main(void)
{
uint i
uchar keyValue
while(1)
{
send(0x00)
if(P1_2 == 0)
{
for(i = 0 i <8 i++)
{
send(~checkKey[i])
if(P1_2 == 0)
{
keyValue = i
xianshi(keyValue)
break
}
}
}
}
}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
jpxs/jpxs.c
jpxs
jpxs
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.