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是什么 ...
随机推荐
- Leetcode:LRUCache四个版本实现
题目 Design and implement a data structure for Least Recently Used (LRU) cache. It should support the ...
- Linux下查看文件夹或目录大小
当磁盘大小超过标准时会有报警提示,这时如果掌握df和du命令是非常明智的选择. df可以查看一级文件夹大小.使用比例.档案系统及其挂入点,但对文件却无能为力. du可以查看文件及文件夹的大小.d ...
- linux 文件内容的复制
#include <string.h> #include <strings.h> #include <stdio.h> #include <stdlib.h& ...
- 算法导论(第三版)Exercises4.2(第四章二节)
4.2-1(计算结果) 18 14 62 66 4.2-2(Strassen算法计算矩阵乘法) void multiplyMatrix(int a[], int b[], int n, int r ...
- python高级编程:有用的设计模式1
# -*- coding: utf-8 -*-__author__ = 'Administrator'#python高级编程:有用的设计模式#设计械是可复用的,某种程序上它对软件设计中觉问题提供的语言 ...
- C++ multimap 的插入,遍历,删除
#include <iostream> #include <map> #include <string> using namespace std; int main ...
- ewebeditor下利用ckplayer增加html5 (mp4)全平台的支持
学校数字化平台富文本编辑器一直用的ewebeditor,应该说非常的好,支持常用office文档的直接导入,极大的方便了老师们资料的上传,最近在规划整个数字化校园向全平台改版,框架采用bootstra ...
- SVG 路径(path)
本文转自:https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths <path>元素是SVG基本形状中最强大的一个,它 ...
- OkHttp 上手
OkHttp 上手 优点 快.节省带宽. 支持 HTTP/2 和 SPDY. HTTP/2 和 SPDY 允许对同一个主机的所有请求,使用一个 socket. 如果不支持 SPDY 的话,可以用连接池 ...
- .net 开发定时执行的windows服务
环境:win7+vs2010+Oracle11g+office2010(64位操作系统) 需求:开发定时执行的windows服务从数据库中查询数据下载到指定地址Excel中 一.添加新建项目——win ...