The PCs keyboard.docx

上传人:b****2 文档编号:2459655 上传时间:2022-10-29 格式:DOCX 页数:12 大小:52.90KB
下载 相关 举报
The PCs keyboard.docx_第1页
第1页 / 共12页
The PCs keyboard.docx_第2页
第2页 / 共12页
The PCs keyboard.docx_第3页
第3页 / 共12页
The PCs keyboard.docx_第4页
第4页 / 共12页
The PCs keyboard.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

The PCs keyboard.docx

《The PCs keyboard.docx》由会员分享,可在线阅读,更多相关《The PCs keyboard.docx(12页珍藏版)》请在冰豆网上搜索。

The PCs keyboard.docx

ThePCskeyboard

The PC's keyboard.

WhywouldyouwanttointerfacetheKeyboard?

TheIBMkeyboardcanbeacheapalternativetoakeyboardonaMicroprocessordevelopmentsystem.Ormaybeyouwantaremoteterminal,justcoupleitwithaLCDModule.

MaybeyouhaveaRS-232BarcodeScannerorotherinputdevices,whichyouwanttousewithexistingsoftwarewhichonlyallowsyoutokeyinnumbersorletters.YoucoulddesignyourselfalittleboxtoconvertRS-232intoaKeyboardTransmission,makingittransparenttothesoftware.

Aninterfacingexampleisgivenshowingthekeyboard'sprotocolsinaction.Thisinterfacingexampleusesa68HC705J1AMCUtodecodeanIBMATkeyboardandoutputtheASCIIequivalentofthekeypressedat9600BPS.

NotethatthispageonlydealswithATKeyboards.IfyouhaveanyXTkeyboards,youwishtointerface,considerplacingtheminamuseum.Wewillnotdealwiththistypeofkeyboardinthisdocument.XTKeyboardsuseadifferentprotocolcomparedtotheAT,thuscodecontainedonthispagewillbeincompatible.

 

PCKeyboardTheory

TheIBMkeyboardyoumostprobablyhavesittinginfrontofyou,sendsscancodestoyourcomputer.ThescancodestellyourKeyboardBios,whatkeysyouhavepressedorreleased.Takeforexamplethe'A'Key.The'A'keyhasascancodeof1C(hex).Whenyoupressthe'A'key,yourkeyboardwillsend1Cdownit'sserialline.Ifyouarestillholdingitdown,forlongerthanit'stypematicdelay,another1Cwillbesent.Thiskeepsoccurringuntilanotherkeyhasbeenpressed,orifthe'A'keyhasbeenreleased.

Howeveryourkeyboardwillalsosendanothercodewhenthekeyhasbeenreleased.Taketheexampleofthe'A'keyagain,whenreleased,thekeyboardwillsendF0(hex)totellyouthatthekeywiththeproceedingscancodehasbeenreleased.Itwillthensend1C,soyouknowwhichkeyhasbeenreleased.

Yourkeyboardonlyhasonecodeforeachkey.Itdoesn'tcareittheshiftkeyhasbeenpressed.Itwillstillsendyouthesamecode.It'suptoyourkeyboardBIOStodeterminethisandtaketheappropriateaction.Yourkeyboarddoesn'tevenprocesstheNumLock,CapsLockandScrollLock.WhenyoupresstheCapsLockforexample,thekeyboardwillsendthescancodeforthecaplocks.ItisthenuptoyourkeyboardBIOStosendacodetothekeyboardtoturnontheCapslockLED.

Nowthere's101keysand8bitsmake256differentcombinations,thusyouonlyneedtosendonebyteperkey,right?

Nop.Unfortunatelyahandfulofthekeysfoundonyourkeyboardareextendedkeys,andthusrequiretwoscancode.ThesekeysareprecededbyaE0(hex).Butitdoesn'tstopattwoscancodeseither.HowaboutE1,14,77,E1,F0,14,F0,77!

Nowthatcan'tbeavalidscancode?

Wrongagain.It'shappenstobesentwhenyoupressthePause/breakkey.Don'taskmewhytheyhavetomakeitsolong!

Maybetheywerehavingabaddayorsomething?

Whenanextendedkeyhasbeenreleased,itwouldbeexpectthatF0wouldbesenttotellyouthatakeyhasbeenreleased.ThenyouwouldexpectE0,tellingyouitwasanextendedkeyfollowedbythescancodeforthekeypressed.Howeverthisisnotthecase.E0issentfirst,followedbyF0,whenanextendedkeyhasbeenreleased.

KeyboardCommands

BesidesScancodes,commandscanalsobesenttoandfromthekeyboard.Thefollowingsectiondetailsthefunctionofthesecommands.Bynomeansisthisacompletelist.Theseareonlysomeofthemorecommoncommands.

HostCommands

ThesecommandsaresentbytheHosttotheKeyboard.Themostcommoncommandwouldbethesetting/resettingoftheStatusIndicators(i.e.theNumlock,CapsLock&ScrollLockLEDs).Themorecommonandusefulcommandsareshownbelow.

ED

SetStatusLED's-ThiscommandcanbeusedtoturnonandofftheNumLock,CapsLock&ScrollLockLED's.AfterSendingED,keyboardwillreplywithACK(FA)andwaitforanotherbytewhichdeterminestheirStatus.Bit0controlstheScrollLock,Bit1theNumLockandBit2theCapslock.Bits3to7areignored.

EE

Echo-UponsendingaEchocommandtotheKeyboard,thekeyboardshouldreplywithaEcho(EE)

F0

SetScanCodeSet.UponSendingF0,keyboardwillreplywithACK(FA)andwaitforanotherbyte,01-03whichdeterminestheScanCodeUsed.Sending00asthesecondbytewillreturntheScanCodeSetcurrentlyinUse

F3

SetTypematicRepeatRate.KeyboardwillAcknowledgecommandwithFAandwaitforsecondbyte,whichdeterminestheTypematicRepeatRate.

F4

KeyboardEnable-Clearsthekeyboardsoutputbuffer,enablesKeyboardScanningandreturnsanAcknowledgment.

F5

KeyboardDisable-Resetsthekeyboard,disablesKeyboardScanningandreturnsanAcknowledgment.

FE

Resend-Uponreceiptoftheresendcommandthekeyboardwillre-transmitthelastbytesent.

FF

Reset-ResetstheKeyboard.

Command

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 卡通动漫

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1