#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. CCI_chapter 2 Linked Lists

    2.1  Write code to remove duplicates from an unsorted linked list /* Link list node */ struct node { ...

  2. QT树莓派交叉编译环开发环境搭建(附多个exe工具下载链接)

    前两天入手了一块2.8’的tft液晶显示屏,于是和树莓派连了一发,成功将命令行显示在了这块小的可怜的屏幕上之后,觉得这屏幕就显示个黑白内容太浪费了,于是考虑开发一个”脸”(图形用户界面,GUI).首先 ...

  3. Qt下使用的静态链接库------ *.lib转化为mingw使用的.a格式的静态库

    使用MinGW附带的工具reimp.exe,该工具一般在MinGW in目录下,其readme文档在MinGWdoc eimp目录下, 方法很简单,比如: C:CodeBlocksMinGWlibdx ...

  4. Buffer Cache 原理

    在将数据块读入到SGA中,他们的缓冲区被放置在悬挂散列存储桶的链表中(散列链),这种内存结构由大量 子cache buffers chains锁存器(也称为散列锁存器或CBC锁存器)保护. Buffe ...

  5. linux下core文件设置(转)

    在程序不寻常退出时,内核会在当前工作目录下生成一个core文件(是一个内存映像,同时加上调试信息).使用gdb来查看core文件,可以指示出导致程序出错的代码所在文件和行数. 1.core文件的生成开 ...

  6. android图标设计事宜

    1.Launcher图标 图标的最佳宽高是48x48 dp. ldpi:36*36px,0.75倍密度,一般不用提供,系统会从hdpi取图缩小1倍. mdpi:48*48px, 1倍密度 hdpi:7 ...

  7. day49

    几天没写了 这几天比较麻木呢 各种课程的再看 想买一直不舍得money 今天下定决心买了 这样我也静下心好好备战把 一天背的东西好多 政治和作文也是背了就忘记 尽力把 今天的买的课很悬乎 就不在这说了 ...

  8. python高级编程之我不测试

    # -*- coding: utf-8 -*-__author__ = 'Administrator'#测试驱动开发(高级编程处学习,第11章)#测试驱动开发也叫TDD, 是制造高质量软件的一种简单技 ...

  9. [IOI1999]花店橱窗布置(DP路径记录)

    题目:[IOI1999]花店橱窗布置 问题编号:496 题目描述 某花店现有F束花,每一束花的品种都不一样,同时至少有同样数量的花瓶,被按顺序摆成一行,花瓶的位置是固定的,从左到右按1到V顺序编号,V ...

  10. 寒哥细谈之AutoLayout全解

    文/南栀倾寒(简书作者)原文链接:http://www.jianshu.com/p/683fbcbfb705著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”. 看到群中好多朋友还停留在Fr ...