ps2keyboard demo code for 8052
#pragma code symbols debug objectextend
#include <reg51.h> /* special function register declarations */
/* for the intended 8051 derivative */
#include <stdio.h> /* prototype declarations for I/O functions */
#define BYTE unsigned char
#define WORD unsigned int
#define LONG unsigned long
#define dword unsigned long
#define DWORD unsigned long
#define byte unsigned char
#define word unsigned int
#define XBYTE ((unsigned char volatile xdata *) 0)
#define XWORD ((unsigned int volatile xdata *) 0)
#define NES 0x6000
data union{
LONG l;
BYTE b[];
}lShift;
data BYTE bCnt;
/****************/
/* main program */
/****************/
void main (void) { /* execution starts here after stack init */
#define KEY_BREAK 0x1f800
#define BCNT_VALUE 0
//BYTE code abBitHi[] ={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
//BYTE code KeyTable[][2]={}
data BYTE bKey=0xff, bC, bKeyTmp;
//data WORD wKb;
//data long lBrk;
data union{
LONG l;
BYTE b[];
}lTmp;
bit fParity, fP;
TCON=0x01; //bit0: 1/0 falling edge/low level triggered external interrupts
IP=0x01; //bit0:Externl interrupt 0 Priority control bit
IE=0x81; //bit0:Enable External interrupt 0 control bit
//bit7:All control bit
XBYTE[NES]=0x00;
///if (bCnt>=BCNT_VALUE) {
){
T0=~T0;
bCnt=BCNT_VALUE;
lTmp.l=lShift.l;
] & ] & 0xfc)==0x80)) ||
((lTmp.b[]==]<=0x10)))
{
//fBrk=1;
bKey &= 0x7f;
}
] & 0xa0)==0x80) && //stop bit=1, data bit7=0
((lTmp.b[] & 0x20)==0x00) ){ //start bit==0 bit0 , data bit7==0
] & ; //parity bit bit9
;
lTmp.l<<=;
bKeyTmp=lTmp.b[];
fParity=;
; bC<=; bC++){
] & ) fParity=~fParity;
lTmp.b[]<<=;
}
if (fP==fParity) {
//fOk=1;
//bKey=KeyTable[bKeyTmp];
bKey=bKeyTmp | 0x80;
}
}
P1=bKey;
XBYTE[NES]=bKey;
}
////else bCnt++; //while (1)
} //void main (void)
{
bit fT0;
fT0=INT1;
lShift.l>>=;
] |= 0x80;
///bCnt=0;
}
/* link
hello.obj
XDATA(0) IDATA(80H) RAMSIZE(256) SYMBOLS
*/
ps2keyboard demo code for 8052的更多相关文章
- penpyxl basic function demo code
Openpyxl basic function demo code demo code: #!/usr/bin/env python # -*- coding: utf-8 -*- "&qu ...
- RAD Studio Demo Code和几个国外FMX网站 good
FireMonkey X – Amazing overview of FireMonkey FMX Feeds – All your FireMonkey news in one place FMX ...
- ( ! ) Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in D:\demo\code\yolo\index\index.php on li
sql语句为:$sql="select count(*) from com where a_id=$v['id']"; 出现以下错误: 原因: 变量没有用花括号引起来 改为: $ ...
- npm install 安装报错:npm ERR! EPERM npm ERR! -4048 npm ERR! Error: EPERM: operation not permitted, unlink 'D:\test\demo\code\materialT\node_modules\.staging'
更新项目依赖包,删除掉package-lock.json.node_modules,运行npm install,报如上错误信息,查询资料说是没有权限,本人用管理员身份打开powershell,运行np ...
- swagger demo code
//Application 开启注解 @EnableSwagger2public class Application { public static void main(String[] args) ...
- c++ demo code
/* //多继承 #include <iostream> using namespace std; class Sofa { public: Sofa(); ~Sofa(); void s ...
- 创建简单的表单Demo
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- react context toggleButton demo
//toggleButton demo: //code: //1.Appb.js: import React from 'react'; import {ThemeContext, themes} f ...
- Google Summer of Code 2017 经验谈
Google Summer of Code (GSoC) 2018 又要开始了. 如果想实现你心中的开源梦想, 用代码让世界变得更美好. 参加GSoC可能是你进入开源的世界最好途径. GSoC是什么 ...
随机推荐
- ASP.ENT中上一篇和下一篇
前台页面:<div class="mtgz_prev_next"> <p> <span class="textcolor ...
- netstat命令, netstat指令在windows和linux有什么不同
查看当前tcp监听端口[op@TIM html]$ netstat -nltp(Not all processes could be identified, non-owned process inf ...
- php字符串常用处理函数(数组的拆分、查找替换)
//字符串常用函数 $a = "hello"; echo strlen($a); //输出字符串的长度 $b = "Hello"; ...
- poj 2976 Dropping tests (二分搜索之最大化平均值之01分数规划)
Description In a certain course, you take n tests. If you get ai out of bi questions correct on test ...
- 在ubuntu14.04上部署hadoop2.6.3
一.在Ubuntu下创建hadoop组和hadoop用户 增加hadoop用户组,同时在该组里增加hadoop用户,后续在涉及到hadoop操作时,我们使用该用户. 1.创建hadoop用户组 2.创 ...
- java基础 二分查找算法
/* * 折半查找法: * 思路: * 定义三个变量记录查找范围中最大.最小和中间的索引值,每次都是使用中间索引值与要查找的目标进行对比,如果不符合,那么就不停缩小查找范围 * */ ...
- [置顶] iOS 应用程序内部国际化,不跟随系统语言
前言:网络上关于iOS国际化的文章很多,但基本上都是基于跟随系统语言的国际化,笔者就不赘述了-0 – 今天要讲的是不跟随系统的切换语言版本方案,即程序内部的切换语言版本方案. 一.总则: 应用内部语言 ...
- java.lang.OutOfMemoryError: Java heap space错误及处理办法
以下是从网上找到的关于堆空间溢出的错误解决办法: java.lang.OutOfMemoryError: Java heap space ============================= ...
- C/C++笔试准备(2)
问题:编辑距离,是指将一个字符串变为另一个字符串,仅可以3种操作:修改一个字符,删除一个字符,插入一个字符.the变成that:删除e,插入a,插入t.20’ 实现编辑距离算法. 解算:利用动态规划的 ...
- Picasso – Android系统的图片下载和缓存类库
Picasso – Android系统的图片下载和缓存类库 Picasso 是Square开源的一个用于Android系统下载和缓存图片的项目.该项目和其他一些下载图片项目的主要区别之一是:使用4.0 ...