#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. 从客户端(txtNewsContent="<hr />")中检测到有潜在危险的 Request.Form 值。怎么办呀?

    <system.web><httpRuntime requestValidationMode="2.0" executionTimeout="3600& ...

  2. JVM JMM

  3. CH Round #53 -【Nescafé 32】杯NOIP模拟赛

    A.GCD Path http://ch.ezoj.tk/contest/CH%20Round%20%2353%20-%E3%80%90Nescaf%C3%A9%2032%E3%80%91%E6%9D ...

  4. Dynamic Binding & Static Binding

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

  5. java servlet+jquery+json学习小例子

    引入JSON的jar包: 注意,如果包不全,页面请求servlet时,jquery ajax会返回error:function 弹出error occured!!! HTML Code: <%@ ...

  6. poj 2785 4 Values whose Sum is 0(折半枚举(双向搜索))

    Description The SUM problem can be formulated . In the following, we assume that all lists have the ...

  7. python calendar标准库基础学习

    # -*- coding: utf-8 -*-# 作者:新手__author__ = 'Administrator'#标准库:日期时间基础学习:calendar:处理日期#例1import calen ...

  8. 使用IDEA动态调试smali代码

    原创,转载请注明出处. 一般java ide(如eclipse.idea)都可用来进行smali的动态调试,这里选择IDEA. 第1步:使用apktool反编译apk java -jar apktoo ...

  9. Eclipse+Java+OpenCV246人脸识别

    1.环境搭建:见上一篇博客 整个项目的结构图: 2.编写DetectFaceDemo.java,代码如下: package com.njupt.zhb.test; import org.opencv. ...

  10. android实现计算器功能

    设计一个简单的计算器. 第一个Activity的界面. 第二个Activity显示算式和计算结果. 第一个Activity代码: import android.app.Activity; import ...