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是什么 ...
随机推荐
- Unity 3D中的界面快捷键
Ctrl+1 切换到Scene视图Ctrl+2 切换到Game视图Ctrl+3 切换到Inspector视图Ctrl+4 切换到Hierarchy视图Ctrl+5 切换到Project视图Ctrl+6 ...
- IIS Express 的 applicationhost.config配置文件
文件所在目录 C:\Users\admin\Documents\IISExpress\config 或者 C:\Program Files\IIS Express\AppServer\ //加载语言文 ...
- 专注于HTTP的高性能高易用性网络库:Fslib.network库
博客列表页:http://blog.fishlee.net/tag/fslib-network/ 原创FSLib.Network库(目前专注于HTTP的高性能高易用性网络库) FSLib.Networ ...
- poj1305:概念水题
了解一下毕达哥拉斯三元组概念= = 暴力求出所有的本源三元组即可 代码: #include <iostream> #include <stdio.h> #include< ...
- Codeforces554C:Kyoya and Colored Balls(组合数学计算+费马小定理)
题意: 有k种颜色,每种颜色对应a[i]个球,球的总数不超过1000 要求第i种颜色的最后一个球,其后面接着的必须是第i+1种颜色的球 问一共有多少种排法 Sample test(s) input o ...
- mysql语句添加索引
1.PRIMARY KEY(主键索引) mysql>ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` ) 2. ...
- 贪心-hdu-1789-Doing Homework again
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1789 题目意思: 有n个作业,每个作业有一个截止日期,每个作业如果超过截止日期完成的时候有一个惩罚值 ...
- JAVA学习第三十课(经常使用对象API)- String类:类方法练习
intern方法 public class Main { public static void main(String[] args) { String str1 = new String(" ...
- Laravel Eloquent ORM
Eloquent ORM 简介 基本用法 集体赋值 插入.更新.删除 软删除 时间戳 查询范围 关系 查询关系 预先加载 插入相关模型 触发父模型时间戳 与数据透视表工作 集合 访问器和调整器 日期调 ...
- java foreach循环为什么不能赋值
直接上代码 public class test4 { public static void main(String args[]){ int [] a=new int[3]; for(int j:a) ...