#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. qmake使用实践:包含动态库的Qt4工程

    文章来源:http://blog.csdn.net/dbzhang800/article/details/6317006 本文是qmake的一个使用练习,是半年前所学的 分析与学习Qt Solutio ...

  2. Powershell创建对象

    .Net类型中的方法功能很强大.可以通过类型的构造函数创建新的对象,也可以将已存在的对象转换成指定的类型. 通过New-Object创建新对象 如果使用构造函数创建一个指定类型的实例对象,该类型必须至 ...

  3. Linux企业级项目实践之网络爬虫(8)——认识URL

    URL是Uniform Resource Location的缩写,译为"统一资源定位符".也可以说,URL是Internet上用来描述信息资源的字符串,主要用在各种WWW客户程序和 ...

  4. libeXosip2(2-3) -- eXosip2 event API

    eXosip2 event API General purpose API. Data Structures struct   eXosip_event Enumerations enum   eXo ...

  5. Dynamic Binding & Static Binding

    Reference: JavaPoint BeginnerBook What is Binding Connecting a method call to the method body is kno ...

  6. Entify Framewrok - 学习链接

    http://blogs.msdn.com/b/adonet/archive/2011/01/31/using-dbcontext-in-ef-feature-ctp5-part-6-loading- ...

  7. [Redux] Passing the Store Down with <Provider> from React Redux

    Previously, we wrote the Provider component by ourself: class Provider extends Component { getChildC ...

  8. iOS 8 Auto Layout界面自动布局系列5-自身内容尺寸约束、修改约束、布局动画

    首先感谢众多网友的支持,最近我实在是事情太多,所以没有写太多.不过看到大家的反馈和评价,我还是要坚持挤出时间给大家分享我的经验.如果你对我写的东西有任何建议.意见或者疑问,请到我的CSDN博客留言: ...

  9. python - 类的方法

    类的方法分为:普通方法. 静态方法和类方法   调用方式 特征 普通方法 由对象去调用执行,属于类 至少一个self,对象调用 静态方法 属于类,但通过类来调用,不依赖于任何对象,方法内部不需要对象封 ...

  10. 先装Net Framework 后 装 IIS的处理办法

    先装IIS话,后面装Net Framework时候会自动注册 处理aspx和ashx等的处理扩展程序 先装Net Framework 后 装 IIS.扩展程序注册在命令:aspnet_regiis - ...