• LeoLau
  • C/C++
  • 95KB
  • rar
  • 0
  • 1 积分
  • 12
  • 2009-11-27 21:33
AVR單片機ATMEG8, ATMEG16A 中斷處理外部按鈕,類似於PC機的鍵盤 附帶詳細的流程說明(英文),一定要看。 Features &#8226 Interfacing Standard PC AT Keyboards &#8226 Requires Only Two I/O Pins. One of them must be an External Interrupt Pin &#8226 No Extra Hardware Required &#8226 Complete Example in C, Implementing a Keyboard to Serial Converter
  • Keyboard.dtp
  • pindefs.h
  • Keyboard.prj
  • scancodes.h
  • kb.c
  • AVR_KEY.pdf
  • serial.h
  • low_level_init.c
  • kb.h
  • gpr.h
  • avr313.xcl
  • serial.c
  • gpr.c
  • main.c
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta name="generator" content="pdf2htmlEX"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css"> <link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css"> <link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/622babe815da9b288b5d79c8/raw.css"> <script src="https://static.pudn.com/base/js/compatibility.min.js"></script> <script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script> <script> try{ pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({}); }catch(e){} </script> <title></title> </head> <body> <div id="sidebar" style="display: none"> <div id="outline"> </div> </div> <div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/622babe815da9b288b5d79c8/bg1.jpg"><div class="t m0 x1 h2 y1 ff1 fs0 fc0 sc0 ls0 ws0"><span class="fc1 sc0">1</span></div><div class="t m0 x2 h3 y2 ff1 fs1 fc0 sc0 ls1 ws1">A<span class="_ _0"></span>VR313: Interfacing the PC A<span class="_ _1"></span>T Keyboard</div><div class="t m0 x3 h4 y3 ff1 fs2 fc0 sc0 ls2 ws0">Features</div><div class="t m0 x3 h5 y4 ff2 fs0 fc0 sc0 ls0 ws0">&#8226;<span class="_ _2"> </span><span class="ff1 fs3 ls3 ws2">Interfacing <span class="_ _3"></span>Standard PC A<span class="_ _1"></span>T Keyboards</span></div><div class="t m0 x3 h5 y5 ff2 fs0 fc0 sc0 ls0 ws0">&#8226;<span class="_ _2"> </span><span class="ff1 fs3 ls4 ws3">Requires O<span class="_ _3"></span>nly T<span class="_ _1"></span>wo I/O Pins. One <span class="_ _3"></span>of them must be a<span class="_ _3"></span>n External Inte<span class="_ _3"></span>rrupt Pin</span></div><div class="t m0 x3 h5 y6 ff2 fs0 fc0 sc0 ls0 ws0">&#8226;<span class="_ _2"> </span><span class="ff1 fs3 ls5 ws4">No Extra Hardware Required</span></div><div class="t m0 x3 h5 y7 ff2 fs0 fc0 sc0 ls0 ws0">&#8226;<span class="_ _2"> </span><span class="ff1 fs3 ls6 ws5">Comple<span class="_ _3"></span>te Example i<span class="_ _3"></span>n C, Implemen<span class="_ _3"></span>ting a Key<span class="_ _3"></span>board to Serial C<span class="_ _3"></span>onverter</span></div><div class="t m0 x3 h4 y8 ff1 fs2 fc0 sc0 ls7 ws0">Introduction</div><div class="t m0 x3 h5 y9 ff2 fs0 fc0 sc0 ls8 ws6">Most mi<span class="_ _4"></span>crocon<span class="_ _4"></span>troll<span class="_ _4"></span>ers requ<span class="_ _4"></span>ires<span class="_ _4"></span> some kind<span class="_ _4"></span> of a hum<span class="_ _4"></span>an inter<span class="_ _4"></span>face. Th<span class="_ _4"></span>is ap<span class="_ _4"></span>plicat<span class="_ _4"></span>ion not<span class="_ _4"></span>e</div><div class="t m0 x3 h5 ya ff2 fs0 fc0 sc0 ls9 ws7">describe<span class="_ _4"></span>s one w<span class="_ _4"></span>ay of doin<span class="_ _4"></span>g this<span class="_ _4"></span> using a <span class="_ _4"></span>standa<span class="_ _4"></span>rd PC A<span class="_ _3"></span>T keyboard.</div><div class="t m0 x3 h4 yb ff1 fs2 fc0 sc0 lsa ws8">The P<span class="_ _3"></span>hysical <span class="_ _3"></span>Interfa<span class="_ _3"></span>ce</div><div class="t m0 x3 h5 yc ff2 fs0 fc0 sc0 lsb ws9">The p<span class="_ _3"></span>hysical int<span class="_ _3"></span>erface b<span class="_ _3"></span>etween t<span class="_ _3"></span>he keyboa<span class="_ _3"></span>rd and t<span class="_ _3"></span>he host<span class="_ _3"></span> is shown<span class="_ _3"></span> in Figu<span class="_ _3"></span>re 1. T<span class="_ _1"></span>wo</div><div class="t m0 x3 h5 yd ff2 fs0 fc0 sc0 ls8 wsa">signal li<span class="_ _4"></span>nes are us<span class="_ _4"></span>ed, clock and da<span class="_ _4"></span>ta. The signal<span class="_ _4"></span> lines are open c<span class="_ _4"></span>onnector<span class="_ _3"></span>, with pullu<span class="_ _4"></span>p</div><div class="t m0 x3 h5 ye ff2 fs0 fc0 sc0 lsc wsb">resistor<span class="_ _3"></span>s located<span class="_ _3"></span> in the <span class="_ _3"></span>keyboard. <span class="_ _3"></span>This allo<span class="_ _3"></span>ws eithe<span class="_ _3"></span>r the keyb<span class="_ _3"></span>oard or<span class="_ _3"></span> the host<span class="_ _3"></span> system</div><div class="t m0 x3 h5 yf ff2 fs0 fc0 sc0 lsd wsc">to force <span class="_ _4"></span>a line to low l<span class="_ _4"></span>evel. T<span class="_ _3"></span>wo connec<span class="_ _4"></span>tor type<span class="_ _4"></span>s are avail<span class="_ _4"></span>able, the 5<span class="_ _4"></span>-pin DIN conn<span class="_ _4"></span>ector</div><div class="t m0 x3 h5 y10 ff2 fs0 fc0 sc0 lse wsd">of &#8220;5D&#8221; type, a<span class="_ _4"></span>nd the sm<span class="_ _4"></span>aller six-<span class="_ _4"></span>pin mini-DIN. T<span class="_ _4"></span>he pin as<span class="_ _4"></span>signments a<span class="_ _4"></span>re sho<span class="_ _4"></span>wn in</div><div class="t m0 x3 h5 y11 ff2 fs0 fc0 sc0 lsd wse">T<span class="_ _0"></span>abl<span class="_ _4"></span>e 1.</div><div class="t m0 x3 h5 y12 ff1 fs0 fc0 sc0 lsf wsf">Figure 1. <span class="ff2 ls10 ws10">The Int<span class="_ _4"></span>erface.</span></div><div class="t m0 x4 h6 y13 ff3 fs4 fc0 sc0 ls0 ws0">K<span class="_ _3"></span>e<span class="_ _3"></span>yboard</div><div class="t m0 x5 h7 y14 ff3 fs5 fc0 sc0 ls0 ws0">+5V</div><div class="t m0 x6 h7 y15 ff3 fs5 fc0 sc0 ls0 ws0">Clock</div><div class="t m0 x7 h7 y16 ff3 fs5 fc0 sc0 ls0 ws0">Data</div><div class="t m0 x7 h7 y17 ff3 fs5 fc0 sc0 ls0 ws0">GND</div><div class="t m0 x8 h8 y18 ff1 fs4 fc0 sc0 ls11 ws0">AV</div><div class="t m1 x9 h9 y18 ff1 fs6 fc0 sc0 ls0 ws0">R</div><div class="t m0 xa h7 y19 ff3 fs5 fc0 sc0 ls0 ws0">V</div><div class="t m0 xb h7 y1a ff3 fs5 fc0 sc0 ls0 ws0">cc</div><div class="t m0 xc h7 y1b ff3 fs5 fc0 sc0 ls0 ws0">VCC</div><div class="t m0 xc h7 y1c ff3 fs5 fc0 sc0 ls0 ws0">GND</div><div class="t m0 xc h7 y1d ff3 fs5 fc0 sc0 ls0 ws0">INT0</div><div class="t m0 xd h7 y1e ff3 fs5 fc0 sc0 ls0 ws0">(or INT1)</div><div class="t m0 xe h7 y1f ff3 fs5 fc0 sc0 ls0 ws0">P</div><div class="t m2 xf ha y20 ff3 fs7 fc0 sc0 ls0 ws0">xy</div><div class="t m0 x10 hb y21 ff1 fs8 fc0 sc0 ls12 ws11">8-bit </div><div class="t m0 x10 hb y22 ff1 fs8 fc0 sc0 ls3 ws0">Microcontroller</div><div class="t m0 x10 hb y23 ff1 fs8 fc0 sc0 ls13 ws0">Application </div><div class="t m0 x10 hb y24 ff1 fs8 fc0 sc0 ls14 ws0">Note</div><div class="t m0 x11 hc y25 ff3 fs9 fc0 sc0 ls15 ws12">Rev. 1<span class="_ _4"></span>235B<span class="ff2 ls0 ws0">&#8211;<span class="ff3 ls16">AVR</span>&#8211;<span class="ff3 ls17">05/02</span></span></div><a class="l" rel='nofollow' onclick='return false;'><div class="d m3"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m3"></div></a></div><div class="pi" data-data='{"ctm":[1.613445,0.000000,0.000000,1.613445,0.000000,-38.722689]}'></div></div> </body> </html>