第37卷 第3期 电 子 器 件 Vo1.37 No.3
2014年 6月 Chinese3ournalofElectronDevices Jun.2014
Simulation andRealization ofPS/2DigitalKeyboard
CommunicationProtocolBasedon STM 32
ZHANG Genbao ,LILu
(CollegeofElectricalandInformationEngineering,ShaanxiUniversityofScienceandTechnology,Xi’a/z710021,China)
Abstract:Inordertowidelyusethedigitalkeyboard in industry,itweaksto solvethecostofdigitalkeyboard
hardwarecircuitdesigningandtheproblem ofconveniencesofdigitalkeyboardmodularizationusing.Bythestudyof
PS/2communicationprotocol,usingtheSTM32microcontrollerI/OPin5V tolerantfunction,eliminatingthein—
consistencyofelectricallevelofPS/2 andSTM32,asimulationmethod forPS/2 communication protocolisput
forward.The method thatused the software algorithm programming solved data communication and function
realizationfrom keyboardtoSTM32.AfterKeilsoftwaresimulationandthetestandverification ofinstrument,the
expectedresultsareobtained.
Keywords:PS/2;communicationprotocolsimulation;STM32;Coaex—M3;externalinterruption
EEACC:1265;6150M doi:10.3969/j.issn.1005-9490.2014.03.043
基于 STM32的 PS/2数字键盘通信协议模拟与实现
张根宝 ,李 露
(陕西科技大学电气与信息工程学院,西安710021)
摘 要 :为了解决数字键盘硬件电路设计的成本和数字键盘模块使用的方便性,使得在工业上具有普遍使用性。通过对PS/
2通信协议的研究,利用STM32系列控制器I/O管脚 5V容忍的功能,消除PS/2与STM32电平不一致性 ,提出一种对PS/2通
讯协议模拟方法。该方法采用了软件算法编程 ,实现了从键盘到STM32数据通讯及功能实现。经过Keil软件仿真及仪表验
证,最终得出预期结果。
关键词 :PS/2;通讯协议模拟;STM32;Coflex—M3.夕部中断
中图分类号:TN919.3 文献标识码 :A 文章编号:1005-9490(2014)03-0579—04
现今,很多工业现场设备中,需要数字键盘,使
1 PS/2数字键盘
得现场设备朝着人们的预定计划进行。特别是在嵌
入式系统中,一般需要专门设计键盘电路,所使用的 1.1 PS/2接 口描述
按键是单个按键和多个按键组合在一起构成键盘, PS/2接 口连接器一般有 5或6脚 ,不管是5脚
或者定制一体化的薄膜开关,单个按键一般寿命不 还是