文件名称:jpxs
- 所属分类:
- 单片机(51,AVR,MSP430等)
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- l**
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
取键值程序 功能:等待键入,并刷新显示,并返回键值放 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