#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的更多相关文章

  1. penpyxl basic function demo code

    Openpyxl basic function demo code demo code: #!/usr/bin/env python # -*- coding: utf-8 -*- "&qu ...

  2. RAD Studio Demo Code和几个国外FMX网站 good

    FireMonkey X –  Amazing overview of FireMonkey FMX Feeds – All your FireMonkey news in one place FMX ...

  3. ( ! ) 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']"; 出现以下错误: 原因: 变量没有用花括号引起来 改为:  $ ...

  4. 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 ...

  5. swagger demo code

    //Application 开启注解 @EnableSwagger2public class Application { public static void main(String[] args) ...

  6. c++ demo code

    /* //多继承 #include <iostream> using namespace std; class Sofa { public: Sofa(); ~Sofa(); void s ...

  7. 创建简单的表单Demo

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. react context toggleButton demo

    //toggleButton demo: //code: //1.Appb.js: import React from 'react'; import {ThemeContext, themes} f ...

  9. Google Summer of Code 2017 经验谈

    Google Summer of Code (GSoC) 2018 又要开始了. 如果想实现你心中的开源梦想, 用代码让世界变得更美好. 参加GSoC可能是你进入开源的世界最好途径. GSoC是什么 ...

随机推荐

  1. java比较相等符

    public class Test1 { /** * @param args */ public static void main(String[] args){ int a = 1000, b = ...

  2. java实现二维码

    说起二维码,微信好像最先启用,随后各类二维码就开始流行起来了.那什么是二维码呢. 1.什么是二维码?百度一下即可 http://baike.baidu.com/view/132241.htm?fr=a ...

  3. bzoj 1194

    http://www.lydsy.com/JudgeOnline/problem.php?id=1194 我们看看怎么判断B是否是A的升级. 我们新建一个图G,每个点为一个二元组(i,j),表示A的i ...

  4. struct2(六) 为表单添加验证

    简介 为表单添加验证 添加校验的方法: 1. first name 不能为null 2. Email address 不能为null 3. age 必须大于18岁 为了在用户提交的时候,能够校验这个表 ...

  5. 【Java】在JTable中设置鼠标监听器,点击操作对应数据

    最终效果 鼠标点击JTable中任一数据,修改相应的信息. 确定点击的行和列 package com.dao; import java.awt.event.MouseAdapter; import j ...

  6. Collections.sort()

    Comparator是个接口,可重写compare()及equals()这两个方法,用于比价功能:如果是null的话,就是使用元素的默认顺序,如a,b,c,d,e,f,g,就是a,b,c,d,e,f, ...

  7. Map的内容按字母顺序排序

    map有自带的排序功能,但需要重写排序方法,代码如下: package coreJava.com.shindo.corejava.map; import java.util.ArrayList; im ...

  8. (转)A drop-in universal solution for moving text fields out of the way of the keyboard

    There are a hundred and one proposed solutions out there for how to move UITextField andUITextView o ...

  9. nyist 82迷宫寻宝(一)(BFS)

    题目连接:http://acm.nyist.net/JudgeOnline/problem.php?pid=82 此题在基础BFS上加入了门和钥匙,要找齐所有钥匙才能开门,所以要对门特殊处理. 1.先 ...

  10. Cocos2d-x学习笔记(3)

    Cocos2d-x有一个包括全部其它头文件的cocos2d.h,仅仅要在使用时包括这个头文件,就能够使用引擎的全部功能.Cocos2d-x的类都放置于cocos2d的命名空间下,如引擎下的" ...