?? rfinput.c
字號:
/*********************************************************************************************************
** Small RTOS(51)
** The Real-Time Kernel(For Keil c51)
**
** (c) Copyright 2002-2002, chenmingji
** All Rights Reserved
**
** V1.12.1
**
**
**--------------文件信息--------------------------------------------------------------------------------
**文 件 名: lcd1602.c
**創 建 人: 陳明計
**最后修改日期: 2003年4月27日
**描 述: DP-51的液晶TC1602A的驅動程序
**
**--------------歷史版本信息----------------------------------------------------------------------------
** 修改人: 陳明計
** 版 本: V1.0
** 日 期: 2003年4月27日
** 描 述: 原始版本,應用于Small RTOS 51 v1.12.1
**------------------------------------------------------------------------------------------------------
**--------------當前版本修訂------------------------------------------------------------------------------
** 修改人:
** 日 期:
** 描 述:
**
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
#include "config.h"
/*********************************************************************************************************
** 函數名稱: RFInputScan()
** 功能描述: 掃描鍵盤
**
** 輸 入: 無
** 輸 出: 無
** 全局變量:
** 調用模塊: 無
**
** 作 者: 龔樹強
** 日 期: 2003年7月18日
**-------------------------------------------------------------------------------------------------------
** 修改人:
** 日 期:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
extern uint8 _InputBuf;
extern uint16 _Address;
void RFInputScan(void)
{
static uint16 timer[2];
static uint16 input_addr;
static uint8 input_command;
static uint8 i,j;
static uint16 k;
OS_ENTER_CRITICAL();
P2|=0X01;
for(j=200;(j--)&&(_RF_Input););
timer[0]=TH0;
timer[0]<<=8;
timer[0]+=TL0;
TH0=0;
TL0=0;
TR0=1;
for(k=1000;(k--)&&(!_RF_Input););
timer[1]=TH0;
timer[1]<<=8;
timer[1]+=TL0;
TH0=0;
TL0=0;
TR0=1;
if((timer[1]>timer[0]*20)&&(timer[0]>80))
{
input_addr=0;
input_command=0;
for(i=0;i<16;i++)
{
for(j=250;(j--)&&(_RF_Input););
timer[0]=TH0;
timer[0]<<=8;
timer[0]+=TL0;
TH0=0;
TL0=0;
TR0=1;
for(j=250;(j--)&&(!_RF_Input););
timer[1]=TH0;
timer[1]<<=8;
timer[1]+=TL0;
TH0=0;
TL0=0;
TR0=1;
if(timer[1]>timer[0])
{
input_addr<<=1;
}
else
{
input_addr<<=1;
input_addr++;
}
}
for(;i<24;i++)
{
for(j=250;(j--)&&(_RF_Input););
timer[0]=TH0;
timer[0]<<=8;
timer[0]+=TL0;
TH0=0;
TL0=0;
TR0=1;
for(j=250;(j--)&&(!_RF_Input););
timer[1]=TH0;
timer[1]<<=8;
timer[1]+=TL0;
TH0=0;
TL0=0;
TR0=1;
if(timer[1]>timer[0])
{
input_command<<=1;
}
else
{
input_command<<=1;
input_command++;
}
}
if(input_addr==_Address)
{
switch(input_command)
{
case 0X03 : _InputBuf=ENTER;
OSSemPost(Input_SEM);
break;
case 0X0C : _InputBuf=EXIT;
OSSemPost(Input_SEM);
break;
case 0X30 : _InputBuf=UP;
OSSemPost(Input_SEM);
break;
case 0XC0 : _InputBuf=DOWN;
OSSemPost(Input_SEM);
break;
default : break;
}
for(k=15000;k--;);
}
}
OS_EXIT_CRITICAL();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -