CN106201014A - A kind of multichannel PS2 able to programme interface UAS button decoder - Google Patents

A kind of multichannel PS2 able to programme interface UAS button decoder Download PDF

Info

Publication number
CN106201014A
CN106201014A CN201610531733.7A CN201610531733A CN106201014A CN 106201014 A CN106201014 A CN 106201014A CN 201610531733 A CN201610531733 A CN 201610531733A CN 106201014 A CN106201014 A CN 106201014A
Authority
CN
China
Prior art keywords
circuit
key
button
decoding circuit
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610531733.7A
Other languages
Chinese (zh)
Other versions
CN106201014B (en
Inventor
李博
李丽锦
张盛兵
王军强
田心宇
潘计辉
林凡勇
牛振中
王兴华
王鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Northwestern Polytechnical University
Xian Aisheng Technology Group Co Ltd
Original Assignee
Northwestern Polytechnical University
Xian Aisheng Technology Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Northwestern Polytechnical University, Xian Aisheng Technology Group Co Ltd filed Critical Northwestern Polytechnical University
Priority to CN201610531733.7A priority Critical patent/CN106201014B/en
Publication of CN106201014A publication Critical patent/CN106201014A/en
Application granted granted Critical
Publication of CN106201014B publication Critical patent/CN106201014B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/02Input arrangements using manually operated switches, e.g. using keyboards or dials
    • G06F3/023Arrangements for converting discrete items of information into a coded form, e.g. arrangements for interpreting keyboard generated codes as alphanumeric codes, operand codes or instruction codes
    • G06F3/0238Programmable keyboards

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Input From Keyboards Or The Like (AREA)

Abstract

The present invention relates to a kind of multichannel PS2 able to programme interface UAS button decoder, including keystroke interface circuit, instruction decoding circuit, command reception circuit, data feedback circuit, key storage circuit and some PS2 interface circuits.Present invention employs the minimal application system with single-chip microcomputer as core, it is possible to by the key code information that instruction change button is corresponding, it is adaptable to noncoding Independent keys and matrix press-key, and there is the modifiable function of button key.There is many PS2 Interface design to realize singly organizing button and the control of single computer also realizes can singly organize button control multiple stage computer simultaneously simultaneously, meet the needs of UAS multiple air combat.

Description

一种多通道可编程PS2接口无人机系统按键译码器A multi-channel programmable PS2 interface UAV system key decoder

技术领域technical field

本发明属于无人机电子技术,涉及一种无人机系统多通道可编程PS2按键译码装置。The invention belongs to the unmanned aerial vehicle electronic technology, and relates to a multi-channel programmable PS2 key decoding device for an unmanned aerial vehicle system.

背景技术Background technique

按键译码器是将非编码独立按键或者矩阵按键转化为具有多路PS2接口标准键盘的设备,可被应用于工业控制、视频监控、以及无人机系统等众多领域。目前,公知的按键译码设备都是按键键码固化的专用设备,不能够根据使用要求更改而改变按键的键码值,当应用到新的使用要求时,需重新设计按键译码设备,因此不具有通用化的特点。已公知的专利(专利200610132019.7和200510100145.X)是用于嵌入式系统装置(例如手机)的按键识别,无法实现与PC中的PS2接口直接连接,同时每个按键的键码是固定的无法更改,并且与处理器或计算机连接的接口只有一个,无法满足无人机多机控制系统中需要使用单组按键同时控制多台控制计算机,根据需要可在线更改键码等要求,因此无法在无人机系统中应用。The key decoder is a device that converts non-coded independent keys or matrix keys into standard keyboards with multiple PS2 interfaces, and can be used in many fields such as industrial control, video surveillance, and unmanned aerial vehicles. At present, the known key decoding devices are all special equipment for solidifying the key codes of the keys, and cannot change the key code values of the keys according to the use requirements. When applying to new use requirements, the key decoding equipment needs to be redesigned, so Does not have the characteristics of generalization. The known patents (patents 200610132019.7 and 200510100145.X) are used for key recognition of embedded system devices (such as mobile phones), which cannot be directly connected to the PS2 interface in the PC. At the same time, the key code of each key is fixed and cannot be changed. , and there is only one interface connected to the processor or computer, which cannot meet the requirements of using a single group of keys to control multiple control computers at the same time in the multi-machine control system of the UAV, and the key code can be changed online as needed, so it cannot be used in unmanned machine system application.

发明内容Contents of the invention

本发明解决的技术问题是:为了克服现有的按键译码装置不能通用化以及不能够同时控制多台计算机的缺点,本发明设计出了一种能够通过指令接口发送指令改变按键所对应键码值的译码设备,同时针对单组按键控制多台计算机的使用要求,本装置设计有多PS2接口,根据指令接口接收到的指令来设置单个或者多个PS2接口输出,满足无人机多机控制系统的使用要求。The technical problem solved by the present invention is: in order to overcome the shortcomings of the existing key decoding device that cannot be generalized and cannot control multiple computers at the same time, the present invention designs a key code that can send instructions through the command interface to change the key code corresponding to the key. Value decoding equipment, and at the same time for the use of a single group of buttons to control multiple computers, this device is designed with multiple PS2 interfaces, and set single or multiple PS2 interface outputs according to the instructions received by the command interface to meet the multi-machine UAV The requirements for the use of the control system.

本发明的技术方案是:一种多通道可编程PS2接口无人机系统按键译码器,其特征在于,包括按键接口电路2、指令译码电路3、指令接收电路6、数据回传电路7、键码存储电路8和若干PS2接口电路;键码存储电路8中用于存储按键类型、PS2输出通道和键码值三类设置信息;上电工作时,指令译码电路3先从键码存储电路8中将按键模式、PS2输出通道和键码值信息读入指令译码电路3的内存中;当有按键按下时,按键接口电路2接收来自外部的按键信号后,传入指令译码电路3;指令译码电路3将接收的按键信号和指令译码电路3内存中存储的按键类型和键码信息进行比对,从而确定当前按键信号对应的键码值;按照内存中存储的PS2输出通道设置信息,将键码值经设置的PS2接口电路按照公知的PS2传输协议传入其相对应的被控计算机;同时,当外部控制设备9发送查询指令时,指令译码电路3会将内存中保存的按键模式、PS2输出通道和键码值设置信息经回传数据电路7传入外部控制设备9进行显示;当需要改变按键模式、PS2输出通道或键码值设置信息时,外部控制设备9经指令接收电路6和指令译码电路3按照约定的通信协议将改变信息的指令传入键码存储电路8中;在不重新上电的情况下,指令译码电路3仍按照内存中所保存的按键类型、PS2输出通道和键码值设置信息进行工作,当重新上电时,指令译码电路3先从键码存储电路8中将新的按键模式、PS2输出通道和键码值信息读入指令译码电路3的内存中,本设备将会按新的设置信息进行工作。The technical solution of the present invention is: a multi-channel programmable PS2 interface unmanned aerial vehicle system button decoder, which is characterized in that it includes a button interface circuit 2, an instruction decoding circuit 3, an instruction receiving circuit 6, and a data return circuit 7 , key code storage circuit 8 and some PS2 interface circuits; Key code storage circuit 8 is used to store three types of setting information of button type, PS2 output channel and key code value; In the storage circuit 8, the button mode, PS2 output channel and key code value information are read into the memory of the instruction decoding circuit 3; code circuit 3; the command decoding circuit 3 compares the key type and key code information stored in the key signal received with the command decoding circuit 3 internal memory, thereby determining the key code value corresponding to the current key signal; according to the key code stored in the internal memory PS2 output channel setting information, the key code value is passed into its corresponding controlled computer according to known PS2 transmission protocol through the PS2 interface circuit of setting; The key mode, PS2 output channel and key code value setting information stored in the internal memory are transferred to the external control device 9 through the return data circuit 7 for display; when it is necessary to change the key mode, PS2 output channel or key code value setting information, the external The control device 9 passes the command receiving circuit 6 and the command decoding circuit 3 into the key code storage circuit 8 to change the information according to the agreed communication protocol; The key type, PS2 output channel and key code value setting information saved in the work, when the power is turned on again, the instruction decoding circuit 3 first transfers the new key mode, PS2 output channel and key code from the key code storage circuit 8 The value information is read into the internal memory of the instruction decoding circuit 3, and the device will work according to the new setting information.

本发明的进一步技术方案是:所述键码存储电路8是一种串行通信的EEPROM芯片型号是24C02,其A0端、A1端、A2端和GND端均接地;VCC端和外界的VCC端相连;WP端接地;SDA端和指令译码电路3的I2C接口输入端P3.1相连;SCL端和指令译码电路3的I2C接口输出端P3.0相连。需要说明的是,I2C的通信体制和编程方法是公知的。The further technical scheme of the present invention is: described key code storage circuit 8 is a kind of EEPROM chip model of serial communication is 24C02, and its A0 end, A1 end, A2 end and GND end are all grounded; VCC end and external VCC end connected; the WP terminal is grounded; the SDA terminal is connected to the I2C interface input terminal P3.1 of the command decoding circuit 3; the SCL terminal is connected to the I2C interface output terminal P3.0 of the command decoding circuit 3 . It should be noted that the I 2 C communication system and programming method are well known.

本发明的进一步技术方案是:所述指令接收电路6为MAX3232芯片中的RS232信号接收器,数据回传电路7为MAX3232芯片中的RS232信号发送器;指令接收电路6的输入端与外部控制设备相连接,输出端与指令译码电路3上的UxRXD0端口相连接;数据回传电路7的输入端与指令译码电路3上的UxTXD0端口相连接,输出端与外部控制设备相连接。A further technical solution of the present invention is: the instruction receiving circuit 6 is the RS232 signal receiver in the MAX3232 chip, and the data return circuit 7 is the RS232 signal transmitter in the MAX3232 chip; the input terminal of the instruction receiving circuit 6 is connected with the external control device The output end is connected to the UxRXD0 port on the instruction decoding circuit 3; the input end of the data return circuit 7 is connected to the UxTXD0 port on the instruction decoding circuit 3, and the output end is connected to the external control device.

本发明的进一步技术方案是:所述指令译码电路3为430系列单片机。A further technical solution of the present invention is: the instruction decoding circuit 3 is a 430 series single-chip microcomputer.

本发明的进一步技术方案是:按键接口电路2若连接非编码独立按键,引脚顺序连接指令译码电路3的IO管脚P1.0~1.7和P2.0~2.7,最多可接入16个非编码独立按键;若连接非编码矩阵按键,行向量引脚连接指令译码电路3的IO管脚P1.0~P1.7,列向量引脚连接指令译码电路3的IO管脚P2.0~P2.7,最多可接入8行×8列,即64个非编码矩阵按键。A further technical solution of the present invention is: if the button interface circuit 2 is connected to non-coded independent buttons, the pins are sequentially connected to the IO pins P1.0-1.7 and P2.0-2.7 of the instruction decoding circuit 3, and up to 16 can be connected. Non-coding independent buttons; if connecting non-coding matrix buttons, the row vector pins are connected to the IO pins P1.0~P1.7 of the instruction decoding circuit 3, and the column vector pins are connected to the IO pin P2 of the instruction decoding circuit 3. 0~P2.7, can access up to 8 rows x 8 columns, that is, 64 non-coded matrix keys.

发明效果Invention effect

本发明的技术效果在于:由于采用了以单片机为核心的最小应用系统,设计了控制接口,外部控制设备9可以通过控制接口向设备发送指令更改按键对应的按键类型和键码信息,适用于非编码的独立按键和矩阵按键,并具有按键键码可更改的功能,具有很好的通用性。同时多PS2接口设计即能实现单组按键对单台计算机的控制也实现能够单组按键同时控制多台计算机,满足无人机系统多机控制的需要。The technical effect of the present invention is that: due to the adoption of the minimum application system with a single-chip microcomputer as the core, and the design of the control interface, the external control device 9 can send instructions to the device through the control interface to change the key type and key code information corresponding to the key. Coded independent keys and matrix keys, and has the function of changing the key code, which has good versatility. At the same time, the multi-PS2 interface design can not only realize the control of a single computer by a single group of buttons, but also realize the simultaneous control of multiple computers by a single group of buttons, which meets the needs of multi-machine control of the UAV system.

附图说明Description of drawings

图1是本发明的示意图;Fig. 1 is a schematic diagram of the present invention;

图2是键码存储电路示意图。Fig. 2 is a schematic diagram of a key code storage circuit.

附图标记说明:1-外部非编码独立按键或矩阵按键,2-按键接口电路,3-指令译码电路,4-PS2接口电路1,5-PS2接口电路2,6-指令接收电路,7-数据回传电路,8-键码存储电路,9-外部控制设备,10-外部被控计算机1,11-外部被控计算机2Description of reference signs: 1-external non-coded independent key or matrix key, 2-key interface circuit, 3-command decoding circuit, 4-PS2 interface circuit 1, 5-PS2 interface circuit 2, 6-command receiving circuit, 7 - data return circuit, 8 - key code storage circuit, 9 - external control equipment, 10 - external controlled computer 1, 11 - external controlled computer 2

具体实施方式detailed description

下面结合具体实施实例,对本发明技术方案进一步说明。The technical solutions of the present invention will be further described below in conjunction with specific implementation examples.

参见图1-图2,本装置包括按键接口电路2、指令译码电路3、PS2接口电路1 4、PS2接口电路2 5、指令接收电路6、数据回传电路7和键码存储电路8。所述按键接口电路为按键的接口电路。输入端为外部单个按键或矩阵按键,输出端连接指令译码电路3的P1.0~P1.7和P2.0~2.7接口。所述指令译码电路3为公知的430系列单片机最小应用系统,能够接收由异步串行数据接收端(UxRXD0)传输的控制指令,外部控制设备9通过软件,根据约定的控制指令帧格式及指令码,用帧内容的判决方法识别出按键类型、控制模式和键码设置信息,并将这些信息保存在键码存储电路8中,所保存的信息能够断电后不丢失。需要说明的是,所述的软件为串口通信软件,能从网上直接下载到或用公知的方法进行开发;键码存储电路8中保存的按键类型、控制模式和键码设置信息只能通过经接收由异步串行数据接收端(UxRXD0)传输的控制指令进行更改。此外指令译码电路3可根据控制指令按照约定的格式,通过异步串行数据发送端(UxTXD0)向外部控制设备9发送当前工作的按键类型、控制模式和键码设置信息的数据。上电工作时,指令译码电路3先从键码存储电路8中将按键模式、PS2输出通道和键码值信息读入指令译码电路3的内存中。如果按键类型设置为独立按键,指令译码电路3周期性采集P1.0~P1.7和P2.0~2.7接口的按键信号,当未有按键按下时,指令译码电路3采集的P1.0~P1.7和P2.0~2.7接口信号全为低电平,当有按键按下时,按键所对应的接口信号为高电平,获得按键所对应的按键信息,同时根据指令译码电路3内存中的控制模式信息,将按键信息按照公知的标准PS2通信接口协议通过单片机的GPIO端口将按键信息发送给对应的PS2接口电路。如果按键类型设置为矩阵按键,指令译码电路3会将P1.0~P1.7设置为输入,默认状态为低电平,将P2.0~P2.7设置为输出,默认状态为高电平,指令译码电路3周期性采集P1.0~P1.7按键信号,当有按键按下时,指令译码电路3采集的P1.0~P1.7信号按键对应的信号为高电平,从而知道矩阵按键中哪行有按键按下,然后指令译码电路3会将P1.0~P1.7设置为输出,默认状态为高电平,将P2.0~P2.7设置为输入,默认状态为低电平,指令译码电路3采集的P2.0~P2.7信号按键对应的信号为高电平,从而知道矩阵按键中哪列有按键按下,最终得知矩阵按键中哪个按键被按下,指令译码电路3会将采集到按键信号与指令译码电路3内存中的键码设置信息进行比对,获得按键所对应的按键信息,同时根据键码存储电路8中所保存的控制模式信息,将按键信息按照公知的标准PS2通信接口协议通过单片机的GPIO端口将按键信息发送给对应的PS2接口电路。所述控制指令接收电路6为RS232信号接收器。控制指令进入RS232信号接收器,从其输出端进入指令译码电路3的异步串行数据接收端。所述的PS2接口电路1用于与外部被控制计算机连接,输入端为指令译码电路3的P4.0和P4.1脚位,输出端接外部被控制计算机。所述的PS2接口电路2用于与外部被控制计算机连接,输入端为指令译码电路3的P4.2和P4.3脚位,输出端接外部被控制计算机。所述指令接收电路6为RS232信号接收器。输入端接外部控制设备9,输出端接指令译码电路3的UxRXD0引脚。所述数据回传电路7为RS232信号发送器。输入端接指令译码电路3UxTXD0引脚,输出端接外部控制设备9。所述的键码存储电路8为数据存储电路。输入端和连接指令译码电路3的P3.0引脚,输出端连接指令译码电路3的P3.1引脚。所述键盘接口电路2为非编码独立按键或者矩阵按键的接口电路。输入端为外部非编码独立按键或矩阵按键,输出端连接指令译码电路3的P1.0~P1.7和P2.0~2.7接口,最多16个独立按键。当输入端为单个按键连接时,最多可连接16个按键,当输入端为矩阵按键时,最多可连接8行×8列个矩阵按键,即64个矩阵按键。1-2, the device includes key interface circuit 2, instruction decoding circuit 3, PS2 interface circuit 14, PS2 interface circuit 25, instruction receiving circuit 6, data return circuit 7 and key code storage circuit 8. The key interface circuit is an interface circuit of keys. The input end is an external single key or matrix key, and the output end is connected to interfaces P1.0-P1.7 and P2.0-2.7 of the instruction decoding circuit 3 . The instruction decoding circuit 3 is the minimum application system of the known 430 series single-chip microcomputer, which can receive the control instruction transmitted by the asynchronous serial data receiving end (UxRXD0), and the external control device 9 passes through the software, according to the agreed control instruction frame format and instruction code, identify the button type, control mode and key code setting information with the judgment method of the frame content, and save these information in the key code storage circuit 8, and the saved information can not be lost after power off. It should be noted that the software is serial communication software, which can be directly downloaded from the Internet or developed by known methods; the key type, control mode and key code setting information preserved in the key code storage circuit 8 can only be obtained through Receive the control command transmitted by the asynchronous serial data receiver (UxRXD0) to change. In addition, the command decoding circuit 3 can send the data of the currently working key type, control mode and key code setting information to the external control device 9 through the asynchronous serial data transmitting terminal (UxTXD0) according to the agreed format according to the control command. When powered on, the command decoding circuit 3 first reads the key mode, PS2 output channel and key code value information into the memory of the command decoding circuit 3 from the key code storage circuit 8 . If the button type is set as an independent button, the instruction decoding circuit 3 periodically collects the button signals of the P1.0-P1.7 and P2.0-2.7 interfaces. When no button is pressed, the P1 collected by the instruction decoding circuit 3 .0~P1.7 and P2.0~2.7 interface signals are all low level, when a key is pressed, the interface signal corresponding to the key is high level, and the key information corresponding to the key is obtained, and at the same time, it is translated according to the instruction Code circuit 3 memory control mode information, the button information is sent to the corresponding PS2 interface circuit through the GPIO port of the single-chip microcomputer according to the known standard PS2 communication interface protocol. If the button type is set to matrix button, the instruction decoding circuit 3 will set P1.0~P1.7 as input, the default state is low level, and set P2.0~P2.7 as output, the default state is high level Ping, instruction decoding circuit 3 periodically collects P1.0~P1.7 button signals, when a button is pressed, the signal corresponding to the P1.0~P1.7 signal button collected by instruction decoding circuit 3 is high level , so as to know which row of the matrix keys has a key pressed, and then the instruction decoding circuit 3 will set P1.0~P1.7 as output, the default state is high level, and set P2.0~P2.7 as input , the default state is low level, and the signals corresponding to the P2.0~P2.7 signal buttons collected by the instruction decoding circuit 3 are high level, so as to know which column of the matrix buttons has a button pressed, and finally know which column of the matrix buttons is pressed. Which key is pressed, the instruction decoding circuit 3 will compare the key code setting information collected from the key signal with the key code setting information in the memory of the instruction decoding circuit 3, and obtain the key information corresponding to the key. The stored control mode information sends the key information to the corresponding PS2 interface circuit through the GPIO port of the single chip microcomputer according to the known standard PS2 communication interface protocol. The control instruction receiving circuit 6 is an RS232 signal receiver. The control instruction enters the RS232 signal receiver, and enters the asynchronous serial data receiving end of the instruction decoding circuit 3 from its output end. The PS2 interface circuit 1 is used to connect with the external controlled computer, the input terminal is the P4.0 and P4.1 pins of the instruction decoding circuit 3, and the output terminal is connected to the external controlled computer. The PS2 interface circuit 2 is used to connect with the external controlled computer, the input terminal is the P4.2 and P4.3 pins of the instruction decoding circuit 3, and the output terminal is connected to the external controlled computer. The instruction receiving circuit 6 is an RS232 signal receiver. The input terminal is connected to the external control device 9, and the output terminal is connected to the UxRXD0 pin of the instruction decoding circuit 3. The data return circuit 7 is an RS232 signal transmitter. The input terminal is connected to the instruction decoding circuit 3UxTXD0 pin, and the output terminal is connected to the external control device 9 . The key code storage circuit 8 is a data storage circuit. The input end is connected to the P3.0 pin of the instruction decoding circuit 3 , and the output end is connected to the P3.1 pin of the instruction decoding circuit 3 . The keyboard interface circuit 2 is an interface circuit of non-coded independent keys or matrix keys. The input end is an external non-coded independent key or matrix key, and the output end is connected to the P1.0-P1.7 and P2.0-2.7 interfaces of the instruction decoding circuit 3, up to 16 independent keys. When the input terminal is a single button connection, a maximum of 16 buttons can be connected, and when the input terminal is a matrix button, a maximum of 8 rows×8 columns of matrix buttons can be connected, that is, 64 matrix buttons.

所述指令译码电路3为公知的430系列单片机最小应用系统,能够通过异步串行数据接收端(UxRXD0)接收指令接收电路6传输的控制指令控制指令,通过软件根据约定的控制指令帧格式及指令码,用约定的判决方法识别出不同的按键设置码,需要说明的是,其中所述的约定的协议和判决方法见专利201510197173.1,即:约定的协议为通信协议,每个数据帧长度为66个字节,以十六进制数据“0x EB 0x 90”为数据帧头,数据帧头后第1个字节为按键类型,使用十六进制数据0x55表示非编码独立按键,十六进制数据0xAA表示非编码矩阵按键;数据帧头后第2个字表示通过那个或那几个PS2通道输出,本字节用低4位表示,每位中0表示不输出,1表示输出,例如0x01表示仅PS1口有输出,0x02表示仅PS2口输出,0x03表示PS1口和PS2口都有输出;若为非编码独立按键,数据帧头后从第3个字节到第10个字节依次代表连接P1.0~P1.7引脚按键的键码值,数据帧头后从第11个字节到第18个字节依次代表连接P2.0~P2.7引脚按键的键码值,数据帧头后第19个字节到第66个字节均为“0x00”;若为非编码矩阵按键,连接P1.0~P1.7引脚按键是矩阵按键的行向量,连接P2.0~P2.7引脚按键是矩阵按键的列向量,形成8(行)×8(列)矩阵,数据帧头后从第3个字节到第10个字节代表连接第一行按键的键码值(如帧头后第3个字节代表第1行第1列的按键的键码值,帧头后第4个字节代表第1行第2列的按键的键码值,依次类推帧头后第10个字节代表第1行第8列的按键的键码值),从帧头后第11个字节到第18个字节依次代表连接第2行按键的键码值,依次类推从帧头后第59个字节到第66个字节依次代表连接第8行按键的键码值。所述的键码值为公知的PC机标准键盘对应的ASCII码值,比如“a”的ASCII码值为0x61,“A”的ASCII码值为0x41。以要将本设备设置为独立按键,仅PS2输出,如果仅设置P1.0所连接的按键对应输出a,P1.3所连接的按键对应输出A为例,则控制指令内容为0xEB 0x90 0x550x02 0x61 0x00 0x41 0x00…….,其余不设置的内容默认填写0x00。本设备首先将键码存储电路8中的存储信息清零,然后把除0xEB 0x90外所有内容按照字节顺序保存在键码存储电路8中,当存储成功后本设备会向外部控制设备9的串口通信软件发送的成功标志数据,其内容为字符“OK”。当控制指令帧第3字节为0xFA时,表示外部控制设备9查询本设备当前工作状态,本设备会将内存中所保存的按键模式、PS2输出通道和键码值信息回传给外部控制设备9,回传数据帧格式与控制指令帧格式相同,即帧长为66个字节,“0x EB 0x90”为数据帧头,数据帧头后第1个字节为按键类型,使用十六进制数据0x55表示当前设置为非编码独立按键,十六进制数据0xAA表示当前设置为非编码矩阵按键;数据帧头后第2个字表示通过那个或那几个PS2通道输出,表示方法与控制指令相同,其余字节为各个按键的编码值。The instruction decoding circuit 3 is the minimum application system of the known 430 series single-chip microcomputer, which can receive the control instruction control instruction transmitted by the instruction receiving circuit 6 through the asynchronous serial data receiving terminal (UxRXD0), and the control instruction frame format and Instruction code, using the agreed judgment method to identify different button setting codes. It should be noted that the agreed protocol and judgment method described in the patent 201510197173.1, that is: the agreed protocol is a communication protocol, and the length of each data frame is 66 bytes, with the hexadecimal data "0x EB 0x 90" as the data frame header, the first byte after the data frame header is the key type, using the hexadecimal data 0x55 to represent non-encoded independent keys, sixteen The hexadecimal data 0xAA means non-encoded matrix key; the second word after the data frame header means output through which or those PS2 channels, this byte is represented by the lower 4 bits, 0 means no output in each bit, 1 means output, For example, 0x01 means that only PS1 port has output, 0x02 means only PS2 port has output, 0x03 means both PS1 port and PS2 port have output; if it is a non-coded independent key, the data frame header is from the third byte to the tenth byte Represents the key code value of the button connected to the P1.0~P1.7 pin in turn, and the 11th byte to the 18th byte after the data frame header represents the key code of the button connected to the P2.0~P2.7 pin in turn Value, the 19th byte to the 66th byte after the data frame header are all "0x00"; if it is a non-coding matrix button, connect P1.0~P1.7 pins. The button is the row vector of the matrix button, and connect to P2 The .0~P2.7 pin keys are the column vectors of the matrix keys, forming an 8 (row)×8 (column) matrix, and the 3rd byte to the 10th byte after the data frame header represent the connection to the first row of keys (For example, the 3rd byte after the frame header represents the keycode value of the key in row 1 and column 1, the 4th byte after the frame header represents the keycode value of the button in row 1 and column 2, By analogy, the 10th byte after the frame header represents the key code value of the button in the first row and the 8th column), and the 11th byte to the 18th byte after the frame header represents the key code of the button connected to the second row value, and so on, from the 59th byte to the 66th byte after the frame header represents the key code value of the button connected to the 8th row. The key code value is the ASCII code value corresponding to the known PC standard keyboard, for example, the ASCII code value of "a" is 0x61, and the ASCII code value of "A" is 0x41. Take this device as an independent button, only PS2 output, if only the button connected to P1.0 is set to output a, and the button connected to P1.3 is set to output A as an example, then the content of the control command is 0xEB 0x90 0x550x02 0x61 0x00 0x41 0x00……. The rest of the content that is not set is filled with 0x00 by default. This device first clears the storage information in the key code storage circuit 8, and then saves all content except 0xEB 0x90 in the key code storage circuit 8 in byte order. The success flag data sent by the serial communication software, its content is the character "OK". When the third byte of the control command frame is 0xFA, it means that the external control device 9 inquires the current working status of the device, and the device will return the key mode, PS2 output channel and key code value information stored in the memory to the external control device 9. The format of the returned data frame is the same as that of the control command frame, that is, the frame length is 66 bytes, "0x EB 0x90" is the data frame header, and the first byte after the data frame header is the key type, using hexadecimal The system data 0x55 indicates that the current setting is a non-coding independent key, and the hexadecimal data 0xAA indicates that the current setting is a non-coding matrix key; the second word after the data frame header indicates which or several PS2 channels are output, indicating the method and control The instructions are the same, and the remaining bytes are the coded values of each key.

指令译码电路3将设置信息保存在键码存储电路8中。上电工作时,指令译码电路3会从键码存储电路8中读出设置信息到其内存中,然后根据设置信息控制模式是输出单个PS2接口还是输出多个PS2接口来对应数量的计算机。按键类型、键码设置信息和控制模式信息均保存在键码存储电路8中,所保存的信息能够断电后不丢失。按键类型、键码设置信息和控制模式信息只能通过经接收由异步串行数据接收端(UxRXD0)传输的控制指令进行更改。所述的PS2接口电路1用于与外部被控制计算机连接,输入端为指令译码电路3的P4.0和P4.1脚位,输出端接外部被控制计算机。本电路主要将MSP430单片机输出的CMOS电平转化为标准PS2接口使用的TTL电平。The instruction decoding circuit 3 saves the setting information in the key code storage circuit 8 . When powered on, the instruction decoding circuit 3 will read the setting information from the key code storage circuit 8 into its internal memory, and then according to the setting information control mode, output a single PS2 interface or output multiple PS2 interfaces to correspond to the number of computers. The key type, key code setting information and control mode information are all stored in the key code storage circuit 8, and the stored information can not be lost after power failure. Key type, key code setting information and control mode information can only be changed by receiving control commands transmitted by the asynchronous serial data receiver (UxRXD0). The PS2 interface circuit 1 is used to connect with the external controlled computer, the input terminal is the P4.0 and P4.1 pins of the instruction decoding circuit 3, and the output terminal is connected to the external controlled computer. This circuit mainly converts the CMOS level output by the MSP430 microcontroller into the TTL level used by the standard PS2 interface.

所述的PS2接口电路2用于与外部被控制计算机连接,输入端为指令译码电路3的P4.2和P4.3脚位,输出端接外部被控制计算机。本电路主要将MSP430单片机输出的CMOS电平转化为标准PS2接口使用的TTL电平。The PS2 interface circuit 2 is used to connect with the external controlled computer, the input terminal is the P4.2 and P4.3 pins of the instruction decoding circuit 3, and the output terminal is connected to the external controlled computer. This circuit mainly converts the CMOS level output by the MSP430 microcontroller into the TTL level used by the standard PS2 interface.

所述指令接收电路6为RS232信号接收器。输入端接外部控制设备9,输出端接指令译码电路3的UxRXD0引脚,即P3.5引脚。The instruction receiving circuit 6 is an RS232 signal receiver. The input terminal is connected to the external control device 9, and the output terminal is connected to the UxRXD0 pin of the instruction decoding circuit 3, that is, the P3.5 pin.

所述数据回传电路7为RS232信号发送器。输入端接指令译码电路3的UxTXD0引脚即P3.4引脚,输出端接外部控制设备9。The data return circuit 7 is an RS232 signal transmitter. The input terminal is connected to the UxTXD0 pin of the instruction decoding circuit 3 , that is, the P3.4 pin, and the output terminal is connected to the external control device 9 .

所述的键码存储电路8为数据存储电路。输入端和输出端连接指令译码电路3的P3.0、P3.1引脚。The key code storage circuit 8 is a data storage circuit. The input end and the output end are connected to the P3.0 and P3.1 pins of the instruction decoding circuit 3 .

相比现有技术本专利的创新点有以下几点:(1)现有技术键盘接口电路连接为固定的非编码独立按键或者固定的非编码矩阵按键,不能两者兼容;本专利键盘接口电路可以兼容非编码独立按键或者非编码矩阵按键两种控制方式。Compared with the prior art, the innovation of this patent has the following points: (1) the prior art keyboard interface circuit is connected to fixed non-coding independent keys or fixed non-coding matrix keys, which cannot be compatible; the keyboard interface circuit of this patent Compatible with non-coded independent buttons or non-coded matrix buttons two control methods.

(2)现有技术按键的键码固化,不能够根据使用要求更改而改变按键的键码值;本专利可以根据实际工作需要改变按键的键码值。(2) The key code of the prior art button is solidified, and the key code value of the button cannot be changed according to the use requirements; this patent can change the key code value of the button according to actual work needs.

(3)由于现有技术的键盘接口电路和按键的键码固定化,所以其无存储功能;本专利由于可以改变按键方式和按键的键码值,所以有所选用的控制信息和按键的键码值具有存储功能,改变后自动存储,仅需上电重新启动即可按改变后的工作方式进行工作。(3) Because the keyboard interface circuit of the prior art and the key code of button are immobilized, so it has no storage function; This patent is owing to can change the key code value of button mode and button, so the key of the selected control information and button The code value has a storage function, which is automatically stored after being changed, and it can work in the changed working mode only by powering on and restarting.

(4)现有技术键盘接口电路与计算机通过1路PS2是一对一的控制关系,而本专利键盘接口电路与计算机可以一对一的控制关系,也可以一对二的控制关系。(4) The keyboard interface circuit of the prior art and the computer have a one-to-one control relationship through 1 PS2, while the keyboard interface circuit of this patent and the computer can have a one-to-one control relationship or a one-to-two control relationship.

本发明的工作过程如下:首次输入控制信息和更改控制信息均是通过外部控制设备9的串口通信软件发送给RS232信号接收器,在经过指令译码电路3到存储到键码存储电路8中。在指令译码电路3中,接收“RS232信号接收器”的中断优先级最高,若该中断触发,按键信息无效,装置接收控制信息,并自动存储控制信息,存储成功后会在外部控制设备9的串口通信软件接收本装置发送的成功标志数据,其内容为字符“OK”,这时将设备断电,再重新启动设备时,键码存储电路8中新存入的信息被读入到指令译码电路3的内存中,本装置按照内存中所保存的“按键类型、控制模式和键码设置信息”进行工作。The working process of the present invention is as follows: the first input control information and change control information are sent to the RS232 signal receiver through the serial port communication software of the external control device 9, and are stored in the key code storage circuit 8 through the instruction decoding circuit 3. In the command decoding circuit 3, the interrupt receiving the "RS232 signal receiver" has the highest priority. If the interrupt is triggered, the button information is invalid, and the device receives the control information and automatically stores the control information. After the storage is successful, it will be displayed on the external control device 9 The serial port communication software of the device receives the successful sign data sent by the device, and its content is the character "OK". At this time, the device is powered off, and when the device is restarted, the newly stored information in the key code storage circuit 8 is read into the instruction In the internal memory of the decoding circuit 3, the device works according to the "key type, control mode and key code setting information" stored in the internal memory.

如果按键类型设置为独立按键,加电工作时,指令译码电路3周期性采集P1.0~P1.7和P2.0~2.7接口的按键信号,当未有按键按下时,指令译码电路3采集的P1.0~P1.7和P2.0~2.7接口信号全为低电平,当有按键按下时,按键所对应的接口信号为高电平,指令译码电路3会将采集到按键信号与内存中保存的键码设置信息进行比对,获得按键所对应的按键信息,同时根据内存中所保存的控制模式信息,将按键信息按照公知的标准PS2通信接口协议通过单片机的GPIO端口将按键信息发送给对应的PS2接口电路。如果按键类型设置为矩阵按键,加电工作时,指令译码电路3会将P1.0~P1.7设置为输入,默认状态为低电平,将P2.0~P2.7设置为输出,默认状态为高电平,指令译码电路3先周期性采集P1.0~P1.7按键信号,当有按键按下时,指令译码电路3采集的P1.0~P1.7信号按键对应的信号为高电平,从而知道矩阵按键中哪行有按键按下,然后指令译码电路3会将P1.0~P1.7设置为输出,默认状态为高电平,将P2.0~P2.7设置为输入,默认状态为低电平,指令译码电路3采集的P2.0~P2.7信号按键对应的信号为高电平,从而知道矩阵按键中哪列有按键按下,最终得知矩阵按键中哪个按键被按下,指令译码电路3会将采集到按键信号与内存中保存的键码设置信息进行比对,获得按键所对应的按键信息,同时根据内存中所保存的控制模式信息,将按键信息按照公知的标准PS2通信接口协议通过单片机的GPIO端口将按键信息发送给对应的PS2接口电路。If the button type is set as an independent button, when the power is on, the instruction decoding circuit 3 periodically collects the button signals of the P1.0~P1.7 and P2.0~2.7 interfaces, and when no button is pressed, the instruction decoding The P1.0~P1.7 and P2.0~2.7 interface signals collected by circuit 3 are all low level. When a button is pressed, the interface signal corresponding to the button is high level, and the instruction decoding circuit 3 will The collected key signal is compared with the key code setting information stored in the memory to obtain the key information corresponding to the key. At the same time, according to the control mode information stored in the memory, the key information is passed through the MCU according to the known standard PS2 communication interface protocol. The GPIO port sends the key information to the corresponding PS2 interface circuit. If the button type is set as a matrix button, the instruction decoding circuit 3 will set P1.0~P1.7 as input, the default state is low level, and set P2.0~P2.7 as output when power is on. The default state is high level, and the command decoding circuit 3 periodically collects P1.0~P1.7 button signals first. When a button is pressed, the P1.0~P1.7 signal collected by the instruction decoding circuit 3 corresponds to the button The signal of the signal is high level, so as to know which row of the matrix keys has a key pressed, and then the instruction decoding circuit 3 will set P1.0~P1.7 as output, the default state is high level, and set P2.0~P1.7 P2.7 is set as input, the default state is low level, and the signals corresponding to the P2.0~P2.7 signal buttons collected by the instruction decoding circuit 3 are high level, so as to know which column of the matrix buttons has a button pressed, Finally know which button is pressed in the matrix button, the instruction decoding circuit 3 will compare the collected button signal with the key code setting information stored in the memory to obtain the button information corresponding to the button, and at the same time according to the stored in the memory The control mode information, the key information is sent to the corresponding PS2 interface circuit through the GPIO port of the single chip microcomputer according to the known standard PS2 communication interface protocol.

当需要更改按键类型、控制模式和键码设置信息时,外部控制设备9将控制指令通过指令接收电路6传给指令译码电路3的UxRXD0引脚,当指令译码电路3接收到控制指令时,首先将键码存储电路8中的存储信息清零,然后将新的控制指令的按键类型、控制模式和键码设置信息保存到键码存储电路8中。然后当本设备重新上电时,指令译码电路3就从键码存储电路8将新的按键类型、控制模式和键码设置信息读到内存中,按照新的设置信息开始工作。When it is necessary to change the button type, control mode and key code setting information, the external control device 9 passes the control command to the UxRXD0 pin of the command decoding circuit 3 through the command receiving circuit 6, and when the command decoding circuit 3 receives the control command , first clear the storage information in the key code storage circuit 8, then save the key type, control mode and key code setting information of the new control command into the key code storage circuit 8. Then when the equipment was powered on again, the instruction decoding circuit 3 read the new key type, control mode and key code setting information into the internal memory from the key code storage circuit 8, and started working according to the new setting information.

当要查询本设备当前所设置的工作状态时,外部控制设备9将查询指令通过指令接收电路6传给指令译码电路3的UxRXD0引脚,当指令译码电路3接收到控制指令时,会将内存中所保存的设置信息按照约定的通信协议,经指令译码电路3的UxTXD0引脚,通过数据回传电路7发送外部控制设备9。When inquiring about the current working state of the device, the external control device 9 will pass the query instruction to the UxRXD0 pin of the instruction decoding circuit 3 through the instruction receiving circuit 6. When the instruction decoding circuit 3 receives the control instruction, it will The setting information stored in the memory is sent to the external control device 9 through the data return circuit 7 through the UxTXD0 pin of the instruction decoding circuit 3 according to the agreed communication protocol.

Claims (5)

1. a multichannel PS2 able to programme interface UAS button decoder, it is characterised in that include keystroke interface circuit (2), instruction decoding circuit (3), command reception circuit (6), data feedback circuit (7), key storage circuit (8) and some PS2 Interface circuit;Key storage circuit (8) stores in advance keystroke pattern, PS2 output channel and key value three category information;Power on During work, instruction decoding circuit (3) first stores keystroke pattern, PS2 output channel and key value information circuit (8) from key Read in the internal memory of instruction decoding circuit (3);When there being button to press, keystroke interface circuit (2) receives from outside button After signal, incoming instruction decoding circuit (3);Instruction decoding circuit (3) is by the push button signalling received and instruction decoding circuit (3) Push-button type and the key code information of depositing middle storage are compared, so that it is determined that the key value that current push button signalling is corresponding;According to interior Deposit the PS2 output channel configuration information of middle storage, key value is transmitted according to known PS2 by the PS2 interface circuit arranged Agreement its corresponding controlled computer incoming;Meanwhile, when external control devices sends query statement, instruction decoding circuit (3) can be incoming through return data circuit (7) by the keystroke pattern preserved in internal memory, PS2 output channel and key value configuration information External control devices shows;When needs change keystroke pattern, PS2 output channel or key value configuration information, outside control The instruction of the information of change is passed according to the communication protocol of agreement by control equipment through command reception circuit (6) and instruction decoding circuit (3) Enter in key storage circuit (8);In the case of not re-powering, instruction decoding circuit (3) is still according to being preserved in internal memory Push-button type, PS2 output channel and key value configuration information are operated, when re-powering, instruction decoding circuit (3) first from The keystroke pattern newly stored, PS2 output channel and key value information are read in instruction decoding circuit by key storage circuit (8) (3), in internal memory, this equipment will be operated by new configuration information.
2. a kind of multichannel PS2 able to programme interface UAS button decoder as claimed in claim 1, its feature exists In, described key storage circuit (8) is the eeprom chip of a kind of serial communication, and model is 24C02, its A0 end, A1 end, A2 end Ground connection equal with GND end;VCC end is connected with extraneous VCC end;WP end ground connection;SDA end and the I2C interface of instruction decoding circuit (3) Input P3.1 is connected;SCL end is connected with the I2C interface outfan P3.0 of instruction decoding circuit (3).
3. a kind of multichannel PS2 able to programme interface UAS button decoder as claimed in claim 1, its feature exists In, described command reception circuit (6) is the RS232 signal receiver in MAX3232 chip, and data feedback circuit (7) is RS232 sender unit in MAX3232 chip;On the output pin of RS232 signal receiver and instruction decoding circuit (3) UxRXD0 port is connected;The input pin of RS232 sender unit is connected with the UxTXD0 port on instruction decoding circuit (3) Connect.
4. a kind of multichannel PS2 able to programme interface UAS button decoder as claimed in claim 1, its feature exists In, described instruction decoding circuit (3) is 430 series monolithics.
5. a kind of multichannel PS2 able to programme interface UAS button decoder as claimed in claim 1, its feature exists In, keystroke interface circuit (2) is if fixing non-coding Independent keys, and the IO of pin order link order decoding circuit (3) manages Foot P1.0~1.7 and P2.0~2.7, the most accessible 16 non-coding Independent keys;If fixing non-coding matrix press-key, I/O pin P1.0~P1.7 of row vector pin link order decoding circuit (3), column vector pin link order decoding circuit (3) I/O pin P2.0~P2.7, at most accessible 8 row × 8 row, i.e. 64 non-coding matrix press-key.
CN201610531733.7A 2016-07-07 2016-07-07 A kind of programmable PS2 interface UAV system button decoders of multichannel Active CN106201014B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610531733.7A CN106201014B (en) 2016-07-07 2016-07-07 A kind of programmable PS2 interface UAV system button decoders of multichannel

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610531733.7A CN106201014B (en) 2016-07-07 2016-07-07 A kind of programmable PS2 interface UAV system button decoders of multichannel

Publications (2)

Publication Number Publication Date
CN106201014A true CN106201014A (en) 2016-12-07
CN106201014B CN106201014B (en) 2018-08-31

Family

ID=57472907

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610531733.7A Active CN106201014B (en) 2016-07-07 2016-07-07 A kind of programmable PS2 interface UAV system button decoders of multichannel

Country Status (1)

Country Link
CN (1) CN106201014B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI897698B (en) * 2024-04-10 2025-09-11 大陸商集創北方(珠海)科技有限公司 Data feedback circuit and method and display

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6529145B1 (en) * 1999-12-16 2003-03-04 Silitek Corporation Keyboard with interchangeable connection function and hot keys
US20040150535A1 (en) * 2003-01-30 2004-08-05 Ben-Chang Sun User programmable input apparatus with a keyboard
CN1885244A (en) * 2006-07-10 2006-12-27 海信集团有限公司 Method for realizing programmable special keyboard
CN102053712A (en) * 2009-11-02 2011-05-11 研祥智能科技股份有限公司 Multi-keyboard input system, input equipment, switching device and control method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6529145B1 (en) * 1999-12-16 2003-03-04 Silitek Corporation Keyboard with interchangeable connection function and hot keys
US20040150535A1 (en) * 2003-01-30 2004-08-05 Ben-Chang Sun User programmable input apparatus with a keyboard
CN1885244A (en) * 2006-07-10 2006-12-27 海信集团有限公司 Method for realizing programmable special keyboard
CN102053712A (en) * 2009-11-02 2011-05-11 研祥智能科技股份有限公司 Multi-keyboard input system, input equipment, switching device and control method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI897698B (en) * 2024-04-10 2025-09-11 大陸商集創北方(珠海)科技有限公司 Data feedback circuit and method and display

Also Published As

Publication number Publication date
CN106201014B (en) 2018-08-31

Similar Documents

Publication Publication Date Title
US7047331B2 (en) Interfacing devices
CN104754392B (en) A kind of remote-control data transmission method of television set
CN104317255A (en) Internet-of-things-based intelligent household control system
CN100507969C (en) Selective intelligent remote control system and method
CN100573611C (en) The input instruction system of electronic equipment and method
CN105679004A (en) Method and system for controlling multiple slave devices with main device
CN103000008A (en) Method and apparatus for responding remote signals of remote receiving equipment
CN102592434A (en) Infrared remote control method and device
CN205810103U (en) The infrared transmission control system of long distance wireless based on high in the clouds infrared code database data
US20100073191A1 (en) Wireless Data Programmer For Electronic Utility Registers And Meters
CN107015507A (en) A kind of central controller integrates extension system
CN114513411B (en) Unified peripheral interaction interface for IoT terminals
US20140237146A1 (en) Automated network triggering-forwarding device
CN101510352B (en) Infrared remote-controller and control method for sending display encode for LED dot matrix display screen
CN106201014B (en) A kind of programmable PS2 interface UAV system button decoders of multichannel
CN106152386A (en) A kind of processing method and processing device of AIR COND SIG Air Conditioner Singnal
KR100586523B1 (en) Information processing system and its control method
CN102393998A (en) General remote controller based on image coding identification
CN104155891B (en) I<2>C-based networked transmitter and communication implementation method thereof
CN104574886A (en) Paged universal key remote controller
CN207851910U (en) A kind of vehicle carried electronic label
CN103605427B (en) A kind of free drive based on Intelligent flat is dynamic quickly responds input equipment
US20070046494A1 (en) System and method for providing operation of internet powered universal remote controller
CN102932687A (en) Method and system for realizing mouse function by using television infrared receiving head
CN207008338U (en) A kind of central controller integrates extension system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant