Part Number Hot Search : 
TS431A 2N5229 DS3508 AWD626R 722EB FR70G02 2N337 78M05CT
Product Description
Full Text Search
 

To Download AN1180 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  AN1180/1199 1/17 application note using the st7263 kit to implement a usb game pad by microcontroller division applications 1 introduction the game pad described in this application note is a low speed, self powered device. it has digital and analog capabilities for the x and y axes, and includes 10 buttons and two motors for vibration. in order to demonstrate the use of the st7263 microcontroller, we adapted this game pad to the st7263 demo kit to make a usb game pad, with usb mouse and hotkey functions. this application uses the key features of the st7263 usb microcontroller, the analog con- verter, the 3 usb endpoints (control endpoint, interrupt in, interrupt out) and pwm capabil- ities with the two output compare waveforms on port a. the source code of the software described on this application note is available from st. as with other usb devices, endpoint 0 is the control endpoint used for device enumeration. endpoint 1 is an interrupt in endpoint, this allows the device to send data to the pc. this end- point is shared using the reportid capabilities specific to the hid class. in this case, the first byte sent to the pc is the reportid number. in this demo application we use three reportids: C reportid number 1 is used for the game pad data C reportid number 2 is used for the mouse data C reportid number 3 for the hotkey function endpoint 2 is an interrupt out endpoint to send data from the pc to the device. this endpoint is used to control the motors for the vibration feature. 1
2/17 using the st7263 kit to implement a usb game pad 2 game pad hardware figure 1. game pad controls 2.1 select button this button is used to toggle between game pad mode and hotkey mode. you can not use it as a game pad button for games in game pad mode, and you can not use it as a hotkey func- tion in hotkey mode. note: toggling between the two modes can also be controlled from the windows application on the pc (see figure 5 ). 2.2 analog button this button can be used only in game pad mode. it has no effect in hotkey mode. by pushing the analog button, the analog axes are enabled, the analog led is switched on and the digital digital axes l1 button l2 button r1 button r2 button select button analog button led for analog state start button analog x axis analog y axis b1 button b2 button b3 button b4 button 1
3/17 using the st7263 kit to implement a usb game pad axes are switched off. to return to digital mode, press the analog button again and check that the led is switched off. 2.3 game pad mode at start-up, game pad mode is enabled (hotkey mode disabled) as are digital axes (analog axes disabled). you can open the game controller properties dialog box to test the operation of the different buttons, and check the x and y axes. in game pad mode, you have 9 buttons: l1, l2, r1, r2, b1, b2, b3, b4 and start. figure 2. windows 98 control panel 2.3.1 how to open the game controller properties dialog box in the control panel window, click on the game controller icon, select the usb game pad and click on the properties button, then click on the test tab to see the dialog box shown in figure 3 . game controllers icon 1
4/17 using the st7263 kit to implement a usb game pad figure 3. game controller properties dialog box with the demo there is an associated windows application: hotkey.exe. this application is dis- played in the windows 98 taskbar (see figure 4 ) figure 4. hotkey application icon when you plug the demo to the usb port, the hotkey application will open the dual-shock game pad dialog box (see figure 5 ). x and y axes button status stmicroelectronics hotkey application 1
5/17 using the st7263 kit to implement a usb game pad figure 5. usb game pad dialog box to close the dialog box, choose close in the file menu. this will close the dialog box but the hotkey application is still running and the st icon remains displayed in the taskbar. to close the application, choose exit from the file menu, and the st icon will disappear. once the game pad is plugged-in, a left click to the st icon in the taskbar will open the dual- shock dialog box, a right click opens the about window. the slider bar allows you to generate a pwm waveform to drive the vibration motors if the game pad radio button is selected. with the radio button you can select game pad mode or hotkey mode. if you press the (phys- ical) select button on the game pad, the select status displayed in the radio buttons is auto- matically updated via the usb bus. hotkey mode : hotkey mode is enabled by clicking the hotkey radio button in the dialog box, or by pressing the select button on the game pad. in this case, the game pad function is disabled and the ar- rows for the digital x and y axes are used for the usb mouse. the l1 and l2 buttons are used for the left and right click of the mouse. the analog mode is not functional and the b1, b2, b3 and start buttons are used for the hotkey functions described below. slider bar device information radio buttons for selecting game pad or hotkey mode 1
6/17 using the st7263 kit to implement a usb game pad the reportid number 1 reports the data for the game pad. using the endpoint 1 for x, y axes and the 9 buttons. using the endpoint 2 for the vibration of the motor. figure 6. example of data sent through endpoint 1 (in endpoint) figure 7. example of data sent through endpoint 2 (out endpoint) the interrupt out for low speed device is only supported from windows 98 second edition (build 4.10.2222 a) or later: windows 2000. to check the version of windows you have click on the system icon in the control panel (see figure 8 ). the other buttons have no effect. table 1. hotkey assignments note: in the current version of the demo software, the paths assigned to the hotkey functions are not programmable. button path start internet browser (netscape or internet explorer): netscape: c:/program files/netscape/communicator/program/netscape.exe internet explorer: c:/program files/internet explorer/iexplore.exe b1 windows explorer: c:/windows/explorer.exe b2 solitaire game: c:/windows/sol.exe b3 notepad: c:/windows/notepad.exe 01 81 81 00 00 reportid number x axis y axis buttons 1 to 8 button 9 01 20 reportid number pwm value 1
7/17 using the st7263 kit to implement a usb game pad 2.4 report descriptor using reportid 0x05, 0x01, // usage_page (generic desktop) 0x09, 0x05, // usage (game pad) 0xa1, 0x01, // collection (application) 0x85, 0x01, // report_id (1) 0x09, 0x01, // usage (pointer) 0xa1, 0x00, // collection (physical) 0x09, 0x30, // usage (x) 0x09, 0x31, // usage (y) 0x15, 0x00, // logical_minimum (0) 0x26, 0xff, 0x00, // logical_maximum (255) 0x35, 0x00, // physical_minimum (0) 0x46, 0xff, 0x00, // physical_maximum (255) 0x75, 0x08, // report_size (8) 0x95, 0x02, // report_count (2) 0x81, 0x02, // input (data,var,abs) 0xc0, // end_collection 0x05, 0x09, // usage_page (button) 0x15, 0x00, // logical_minimum (0) 0x25, 0x01, // logical_maximum (1) 0x35, 0x00, // physical_minimum (0) 0x45, 0x01, // physical_maximum (1) 0x75, 0x01, // report_size (1) 0x95, 0x0a, // report_count (10) 0x19, 0x01, // usage_minimum (button 1) 0x29, 0x0a, // usage_maximum (button 10) 0x81, 0x02, // input (data,var,abs) 0x75, 0x01, // report_size (1) 0x95, 0x06, // report_count (6) 0x81, 0x01, // input (cnst,ary,abs) 0x05, 0x8c, // usage_page (st page) 0x09, 0x05, // usage (pwm out) 0x95, 0x01, // report_count (1) 0x75, 0x08, // report_size (8) 0x15, 0x00, // logical_minimum (0) 0x25, 0x64, // logical_maximum (100) 0x91, 0x02, // output (data,var,abs) 0xc0, // end_collection 0x05, 0x01, // usage_page (generic desktop) 0x09, 0x02, // usage (mouse) 0xa1, 0x01, // collection (application) 0x85, 0x02, // report_id (2) 0x09, 0x01, // usage (pointer) 1
8/17 using the st7263 kit to implement a usb game pad 0xa1, 0x00, // collection (physical) 0x05, 0x09, // usage_page (button) 0x19, 0x01, // usage_minimum (button 1) 0x29, 0x03, // usage_maximum (button 3) 0x15, 0x00, // logical_minimum (0) 0x25, 0x01, // logical_maximum (1) 0x95, 0x03, // report_count (3) 0x75, 0x01, // report_size (1) 0x81, 0x02, // input (data,var,abs) 0x95, 0x01, // report_count (1) 0x75, 0x05, // report_size (5) 0x81, 0x03, // input (cnst,var,abs) 0x05, 0x01, // usage_page (generic desktop) 0x09, 0x30, // usage (x) 0x09, 0x31, // usage (y) 0x15, 0x81, // logical_minimum (-127) 0x25, 0x7f, // logical_maximum (127) 0x35, 0x81, // physical_minimum (-127) 0x45, 0x7f, // physical_maximum (127) 0x75, 0x08, // report_size (8) 0x95, 0x02, // report_count (2) 0x81, 0x07, // input (cnst,var,rel) 0xc0, // end_collection 0xc0, // end_collection 0x05, 0x8c, // usage_page (st page) 0x09, 0x01, // usage (demo kit) 0xa1, 0x01, // collection (application) 0x85, 0x03, // report_id (3) 0x09, 0x0e, // usage (hotkey) 0x15, 0x00, // logical_minimum (0) 0x26, 0xff, 0x00, // logical_maximum (255) 0x35, 0x00, // physical_minimum (0) 0x46, 0xff, 0x00, // physical_maximum (255) 0x75, 0x08, // report_size (8) 0x95, 0x01, // report_count (1) 0x81, 0x02, // input (data,var,abs) 0x85, 0x03, // report_id (3) 0x09, 0x0e, // usage (hotkey) 0xb1, 0x02, // feature (data,var,abs) 0xc0 // end_collection 1
9/17 using the st7263 kit to implement a usb game pad figure 8. windows system properties to send information to the device, the windows application uses a function defined in the hid driver. if the use of the out endpoint is allowed, (this is the case for windows second edition and later) the application will send data through the interrupt out endpoint. if the use of the out endpoint is not allowed, (in the case of windows first edition: build 4.10.1998), the appli- cation will use the set_output specific request through endpoint 0. version number 1
10/17 using the st7263 kit to implement a usb game pad figure 9. data sent through endpoint 2 (in windows 98 second edition) polling on endpoint 1 data sent by endpoint 2 1
11/17 using the st7263 kit to implement a usb game pad figure 10. data sent through endpoint 0 (in windows 98 version 4.10.1998) reportid 2 is used for the mouse data. the first byte is the reportid number, the second one is the x axis, the third one is the y axis and the fourth one is the button status figure 11. data for the mouse polling on endpoint 1 set_output data through endpoint 0 02 00 00 01 reportid number x axis y axis button 9 1
12/17 using the st7263 kit to implement a usb game pad reportid 3 is for the hotkey function. we use only one byte to send the hotkey value. to switch from game pad mode to hotkey mode, we send 0xfd. to switch from hotkey mode to game pad mode we send 0xff. figure 12. hotkey mode enable figure 13. game pad mode enable 03 fd reportid number hotkey value 03 ff reportid number hotkey value 1
13/17 using the st7263 kit to implement a usb game pad figure 14. interface to the st7263 demokit usb connector pull-up resistor transistor motor for vibration connector to the st7263 demokit 1
14/17 using the st7263 kit to implement a usb game pad figure 15. board schematics and hardware description vcc gnd gnd gnd vcc gnd gnd gnd vcc vcc vcc gnd gnd gnd gnd extvcc gnd extvdd vcc gnd gnd vcc gnd gnd gnd gnd vcc vcc gnd vcc gnd gnd gnd gnd gnd vcc vcc gnd vcc extvdd or vbus gnd vcc gnd gnd vcc gnd vss vssa vdd usbdp usbdm usbvcc oscout oscin pc2 pc1 pc0 nreset pb7 pb6 vpp pb5 pa3 pa0 vss pa2 pa1 vdda pa5 vssa pa4 pb0 pb2 pa7 pa6 pb1 pb4 pb3 pb6 pb7 pb5 vpp pb4 pb1 pb3 pb2 pb7 oscout nreset nreset pc2 oscin usbdp usbdm usbvcc pa2 pa3 pa4 pa5 pb2 pb5 pb1 pc0 pc2 pa0 pb4 pa1 pa6 pb3 pb0 pc1 vdda vdd pb6 pc1 pc0 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 pb0 xt1 24mhz c17 10n c1 33p/3p c6 33p/3p r7 10k r2 1m c13 100nf c2 100nf sw11 pb7 5 4 2 1 3 sw1 reset 5 4 2 1 3 + c11 1u c10 100nf r10 4.7k tp4 header 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 tp3 header 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 u2 st72e63 15 21 20 18 17 16 14 13 31 12 30 29 28 27 24 23 22 6 19 5 4 2 3 8 32 1 11 10 7 9 26 25 pb2/ain2 pa4/icap1/it1 pa5/cap2/it2 pa7/ocmp2/it4 pb0/ain0 pb1/ain1 pb3/ain3 pb4/ain4/it5 usbvcc pb5/ain5/it6 usbdm usbdp vssa pa0/cpuclk nc pa2/scl pa3/extclk pc1/tdo pa6/ocmp1/it3 pc2/usboe vss oscout oscin nreset vdda vdd vpp/test pb6/ain6/it7 pc0/rdi pb7/ain7/it8 pa1/sda nc j2 usb 1 2 3 4 u3 usb6b1 1 8 2 3 4 5 6 7 vbus vbus d+ d- gnd gnd d- d+ r3 1.5k + c5 100mf-ct-16v + c8 100mf-ea-25v j1 jack 2 3 1 d1 1n4004 1 2 ld1 led-green r1 330 w1 power 1 2 3 c7 470nf r4 4.7k sw4 pa3 5 4 2 1 3 sw5 pa4 5 4 2 1 3 sw6 pa5 5 4 2 1 3 r5 4.7k sw7 pb2 5 4 2 1 3 r8 4.7k sw9 pb5 5 4 2 1 3 sw2 pa0 5 4 2 1 3 rv2 10k 1 3 2 sw16 5 4 2 1 3 r12 10k sw12 pc0 5 4 2 1 3 r11 4.7k sw15 5 4 2 1 3 sw8 pb4 5 4 2 1 3 r6 4.7k sw14 pc2 5 4 2 1 3 ld2 led-red r15 330 a - + m1 motor servo q1 npn r14 2.7k sw3 pa2 5 4 2 1 3 c3 100nf c4 100nf i gnd o u1 lm7805 1 2 3 r13 10k rv1 10k 1 3 2 sw13 pc1 5 4 2 1 3 r9 4.7k sw10 pb6 5 4 2 1 3 data- data+ game pad st7263 dual-shock rumble left up down select analog r1 b2 l2 r2 start b1 b3 l1 right b4 x axe y axe
15/17 using the st7263 kit to implement a usb game pad there are two types of pcb used to manufacture the game pad. depending on the pcb type, the pinout of the connection to the demokit is not the same. figure 16. pcb 1 (2 lines) for this pcb, the pinout is the following: 1 : r2 (-> pa5) 2 : r1 (-> pa2) 3 : b1 (-> pc0) 4 : b2 (-> pa3) 5 : b3 (-> pb3 through 10k) 6 : b4 (-> pb3 through 4.7k) 7 : start (-> pb2) 8 : select (-> pa0) 9 : analog (-> pc2) 10 : gnd 11 : left (-> pb4) 12 : down (-> pb7) 13 : right (-> pb6) 14 : up (-> pb5) 15 : l1(-> pc1) 16 : l2 (-> pa4) connector for buttons 135 7 911 13 15 246 8 10 12 14 16
16/17 using the st7263 kit to implement a usb game pad figure 17. pcb 2 (1 line) for this pcb the pinout is the following: 1 : r2 (-> pa5) 2 : r1 (-> pa2) 3 : b1 (-> pc0) 4 : b2 (-> pa3) 5 : b3 (-> pb3 through 10k) 6 : b4 (-> pb3 through 4.7k) 7 : start (-> pb2) 8 : select (-> pa0) 9 : analog (-> pc2) 10 : gnd 11 : left (-> pb4) 12 : down (-> pb7) 13 : right (-> pb6) 14 : up (-> pb5) 15 : l1(-> pc1) 16 : l2 (-> pa4) connector for buttons 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17/17 using the st7263 kit to implement a usb game pad notes: information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the co nsequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specifications mentioned in this publicati on are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics prod ucts are not authorized for use as critical components in life support devices or systems without the express written approval of stmicroele ctronics. the st logo is a registered trademark of stmicroelectronics ? 1999 stmicroelectronics - all rights reserved. purchase of i 2 c components by stmicroelectronics conveys a license under the philips i 2 c patent. rights to use these components in an i 2 c system is granted provided that the system conforms to the i 2 c standard specification as defined by philips. stmicroelectronics group of companies australia - brazil - china - finland - france - germany - hong kong - india - italy - japan - malaysia - malta - morocco - sin gapore - spain sweden - switzerland - united kingdom - u.s.a. http://www.st.com


▲Up To Search▲   

 
Price & Availability of AN1180

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X