HID Volume Error When Compile

Pytania, kody i porady dotyczące nie tylko Bascom.
ODPOWIEDZ
weako
Posty: 11
Rejestracja: 22 mar 2020, 14:37

HID Volume Error When Compile

Post autor: weako » 30 mar 2020, 8:41

Hello Everyone,
I trying to build this project, before that i try to compile the code to Bascom, but i am getting an error.

Could anyone here help me to solve the problem where is the core.

Below are the code.
  1. 'USB Keyboard Emulator Example
  2. 'ollopa 2009-2012
  3. '
  4. 'This project emulates a standard 105 key USB keyboard.
  5. 'PORTB shows the status of the keyboard LEDs (CAPS lock, NUMLOCK, etc)
  6. 'PORTA connects to STK500 buttons.
  7. '      BTN0 = send "hello" message.
  8. '      BTN1 = send "A"
  9. 'Note: Buttons and LEDs are inverted due to STK500's inverted logic (0 = pressed / on)
  10. '
  11. 'Test setup is on the STK500 with Vtarget set to 3.6V
  12. 'Using an atmega644 and external 12MHz crystal
  13.  
  14. 'Save about 38 bytes of code size
  15. $noramclear
  16.  
  17. $hwstack = 30
  18. $swstack = 30
  19. $framesize = 40                                             '24 bytes reserved
  20.  
  21. Rem porta.0 = 1
  22. Rem
  23.  
  24. '$regfile = "attiny85.dat"
  25.  
  26. $regfile = "m8def.dat"
  27. $crystal = 12000000
  28. '$crystal = 15000000
  29.  
  30.  
  31. 'Include the software USB library
  32. $lib "swusb.lbx"
  33. $external _swusb
  34. $external Crcusb
  35.  '****************************************************************************
  36.  '****************************************************************************
  37.  
  38.  
  39.  '*******************************************************************************
  40. '************************* USB Configuration Constants *************************
  41.  
  42. 'Use EEPROM or FLASH to store USB descriptors
  43. '1 = EEPROM, 0 = FLASH.  Storing to EEPROM will reduce code size slightly.
  44. Const _usb_use_eeprom = 0
  45.  
  46. 'Don't wait for sent packets to be ACK'd by the host before marking the
  47. 'transmission as complete.  This option breaks the USB spec but improves
  48. 'throughput with faster polling speeds.
  49. 'This may cause reliability issues.  Should leave set to 0 to be safe.
  50. Const _usb_assume_ack = 0
  51.  
  52. '***************************** Device Descriptor *******************************
  53.  
  54. 'USB Vendor ID and Product ID (Assigned by USB-IF)
  55. 'Const _usb_vid = &HBBBB
  56. 'Const _usb_pid = &HEF33
  57.  
  58. 'USB Device Release Number (BCD)
  59. 'Const _usb_devrel = &H0001
  60.  
  61. 'USB Release Spec (BCD)
  62. 'Const _usb_spec = &H0110
  63.  
  64. 'USB Device Class, subclass, and protocol (assigned by USB-IF).
  65. '&h00 = Class defined by interface. (HID is defined in the interface)
  66. '&hFF = Vendor-defined class (You must write your own PC driver)
  67. 'See http://www.usb.org/developers/defined_class  for more information
  68. Const _usb_devclass = 0
  69. Const _usb_devsubclass = 0
  70. Const _usb_devprot = 0
  71.  
  72. 'These are _indexes_ to UNICODE string descriptors for the manufacturer,
  73. 'product name, and serial number.  0 means there is no descriptor.
  74. Const _usb_imanufacturer = 1
  75. Const _usb_iproduct = 2
  76. Const _usb_iserial = 0
  77.  
  78. 'Number of configurations for this device.  Don't change this unless
  79. 'you know what you are doing.  Ordinarily it should just be 1.
  80. Const _usb_numconfigs = 1
  81.  
  82. '***************************** Descriptor configuration ************************
  83.  
  84. 'The number of interfaces for this device
  85. 'Const _usb_numifaces = 1
  86. Const _usb_numifaces = 2                                    'Now we have 2 interfaces  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  87.  
  88. 'Configuration Number (do not edit)
  89. Const _usb_confignum = 1
  90.  
  91. 'Index of UNICODE string descriptor that describes this config (0 = None)
  92. 'Const _usb_iconfig = 2
  93. Const _usb_iconfig = 0                                      'Not needed   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  94.  
  95. '&H80 = device powered from USB bus.
  96. '&HC0 = self-powered (has a power supply)
  97. 'Const _usb_powered = &HC0
  98. 'Const _usb_powered = &HA0                                   'Device powered from USB bus and can wakeup it !!!!!!!!!!!!!!!!!
  99.  
  100. 'Required current in 2mA increments (500mA max)
  101. Const _usb_maxpower = 50                                    '50 * 2mA = 100mA
  102.  
  103. '**************************** Interface Descriptor *****************************
  104.  
  105. 'Number of interfaces for this device (1 or 2)
  106. 'Const _usb_ifaces = 1
  107. Const _usb_ifaces = 2                                       'Now we have 2 interfaces  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  108.  
  109. 'Interface numbers
  110. Const _usb_ifaceaddr = 0
  111. Const _usb_ifaceaddr1 = 1                                   'Second Interface number  **************************************
  112.  
  113. 'Alternate indexes
  114. Const _usb_alternate = 0
  115. Const _usb_alternate1 = 0                                   'Second Interface Alternate index  *****************************
  116.  
  117. 'Number of endpoints for each interface (excluding endp 0)
  118. 'Const _usb_ifaceendpoints = 2
  119. Const _usb_ifaceendpoints = 1                               'First Interface Endpoint !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  120. Const _usb_ifaceendpoints1 = 1                              'Second Interface Endpoint *************************************
  121.  
  122. 'USB Interface Class, subclass, and protocol (assigned by USB-IF).
  123. '&h00 = RESERVED
  124. '&hFF = Vendor-defined class (You must write your own PC driver)
  125. '       Other values are USB interface device class. (such as HID)
  126. 'See http://www.usb.org/developers/defined_class  for more information
  127. Const _usb_ifclass = 3                                      'Interrupt class
  128. Const _usb_ifclass1 = 3                                     'Interrupt class  **********************************************
  129.  
  130. 'Const _usb_ifsubclass = 0
  131. Const _usb_ifsubclass = 1                                   'Subclass 1 for keyboard !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  132. Const _usb_ifsubclass1 = 0                                  'Subclass 0 for multimedia ************************************
  133.  
  134. 'Const _usb_ifprotocol = 0
  135. Const _usb_ifprotocol = 1                                   'For first interface   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  136. Const _usb_ifprotocol1 = 0                                  'For second interface  *****************************************
  137.  
  138. 'Index to UNICODE string descriptor for this interface (0 = None)
  139. Const _usb_iiface = 0
  140. Const _usb_iiface1 = 0                                      'The same for second interface *********************************
  141.  
  142. '*************************** Optional HID Descriptor ***************************
  143. 'HID class devices are things like keyboard, mouse, joystick.
  144. 'See http://www.usb.org/developers/hidpage/  for the specification,
  145. 'tools, and resources.
  146.  
  147. 'Note that for a HID device, the device class, subclass, and protocol
  148. 'must be 0. The interface class must be 3 (HID).
  149. 'Interface subclass and protocol must be 0 unless you are making a
  150. 'keyboard or a mouse that supports the predefined boot protocol.
  151. 'See pages 8 and 9 of the HID 1.11 specification PDF.
  152.  
  153. 'Number of HID descriptors (EXCLUDING report and physical)
  154. 'If you are not making a HID device, then set this constant to 0
  155. 'Const _usb_hids = 1
  156. Const _usb_hids = 2                                         'Now we have 2 HIDs !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  157.  
  158. 'BCD HID releasenumber.  Current spec is 1.11
  159. Const _usb_hid_release = &H0111
  160.  
  161. 'Country code from page 23 of the HID 1.11 specifications.
  162. 'Usually the country code is 0 unless you are making a keyboard.
  163. Const _usb_hid_country = 0
  164.  
  165. 'The number of report and physical descriptors for this HID
  166. 'Must be at least 1! All HID devices have at least 1 report descriptor.
  167. Const _usb_hid_numdescriptors = 1                           'Here we set the number of descriptors for each interface separately, but use it twice
  168.  
  169. 'Use a software tool to create the report descriptor and $INCLUDE it.
  170.  
  171.  
  172. '*************************** Endpoint Descriptor(s) ****************************
  173.  
  174. 'Endpoint 0 is not included here.  These are only for optional
  175. 'endpoints.
  176. 'Note: HID devices require 1 interrupt IN endpoint
  177.  
  178. 'Address of optional endpoints (Must be > 0. comment-out to not use)
  179. Const _usb_endp2addr = 1
  180. Const _usb_endp3addr = 2
  181.  
  182. 'Valid types are 0 for control or 3 for interrupt
  183. Const _usb_endp2type = 3
  184. Const _usb_endp3type = 3
  185.  
  186. 'Directions Are : 0 = Out , 1 = In. Ignored By Control Endpoints
  187. Const _usb_endp2direction = 1
  188. 'Const _usb_endp3direction = 0
  189. Const _usb_endp3direction = 1                               'Now this point is IN too !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  190.  
  191. 'Polling interval (ms) for interrupt endpoints.  Ignored by control endpoints
  192. ' (Must be at least 10)
  193. Const _usb_endp2interval = 10
  194. Const _usb_endp3interval = 10
  195.  
  196.  
  197.  
  198. '*****************************************************************************
  199. '*****************************************************************************
  200.  
  201. $include "multikbd_declarations.inc"
  202.  
  203. Declare Sub Typemessage(message As String)
  204. Declare Sub Typekey(key As Byte)
  205. Declare Function Ascii2usage(ascii As Byte) As Word
  206. Declare Function Crcusb(buffer() As Byte , Count As Byte) As Word
  207.  
  208. '**************************** USB Interrupt And Init ***************************
  209. 'Set all the variables, flags, and sync bits to their initial states
  210. Call Usb_reset()
  211.  
  212. Const _usb_intf = Intf0
  213. Config Int0 = Rising
  214. On Int0 Usb_isr Nosave
  215. Enable Int0
  216. Enable Interrupts
  217.  
  218. '*******************************************************************************
  219. '*************************** End Of USB Configuration **************************
  220.  
  221. Config Pinb.1 = Input : Portb.1 = 1
  222. Config Pinb.2 = Input : Portb.2 = 1
  223.  
  224.  
  225. Dim Resetcounter As Word
  226. Dim Idlemode As Byte
  227.  
  228. Dim Keybd_leds As Byte                                      'keyboard status LEDs (numlock, capslock, etc.)
  229. Dim Message As String * 10
  230.  
  231. Dim Akey As Byte
  232.  
  233. Dim Paus As Byte
  234.  
  235. Paus = 70
  236.  
  237. Message = "BARTek "
  238.  
  239. Do
  240.    Resetcounter = 0
  241.  
  242.    Call Usb_check_reset
  243.    Akey = Usb_check_rx()
  244.  
  245. '############# THIS TYPE "BARTek" if unmarked and switch pressed (I test KB option on Mega8)
  246. 'BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek
  247. '#######################################################################
  248.  
  249. '   If Pinb.1 = 0 Then
  250. '      Call Typemessage(message)
  251. '   End If
  252.  
  253. '######################################################################
  254.  
  255.  
  256.  
  257.  
  258.    If Pinb.1 = 0 Then
  259.  
  260.      If _usb_tx_status._usb_txc = 1 Then                    ' Volume-
  261.              _usb_tx_buffer3(2) = 1
  262.              _usb_tx_buffer3(3) = 234
  263.              _usb_tx_buffer3(4) = 0
  264.            Call Usb_send(_usb_tx_status3(1) , 3)
  265.            Waitms Paus
  266.      End If
  267.      If _usb_tx_status._usb_txc = 1 Then
  268.             _usb_tx_buffer3(2) = 1
  269.             _usb_tx_buffer3(3) = 0
  270.             _usb_tx_buffer3(4) = 0
  271.            Call Usb_send(_usb_tx_status3(1) , 3)
  272.            Waitms Paus
  273.      End If
  274.  
  275.    End If
  276.  
  277.  
  278.    If Pinb.2 = 0 Then
  279.  
  280.         If _usb_tx_status._usb_txc = 1 Then                 ' Volume+
  281.                 _usb_tx_buffer3(2) = 1
  282.                 _usb_tx_buffer3(3) = 233
  283.                 _usb_tx_buffer3(4) = 0
  284.               Call Usb_send(_usb_tx_status3(1) , 3)
  285.               Waitms Paus
  286.         End If
  287.         If _usb_tx_status._usb_txc = 1 Then
  288.                _usb_tx_buffer3(2) = 1
  289.                _usb_tx_buffer3(3) = 0
  290.                _usb_tx_buffer3(4) = 0
  291.               Call Usb_send(_usb_tx_status3(1) , 3)
  292.               Waitms Paus
  293.         End If
  294.  
  295.    End If
  296.  
  297.    Loop
  298.  
  299. End
  300.  'BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek BARTek
  301. '#######################################################################
  302.  
  303. $include "swusb_routines.inc"
  304.  
  305.  
  306. Sub Typemessage(message As String)
  307.    Local Count As Byte
  308.    Local Key As Byte
  309.    Local Char As String * 1
  310.    For Count = 1 To Len(message)
  311.       Char = Mid(message , Count , 1)
  312.       Key = Asc(char)
  313.       Call Typekey(key)
  314.    Next
  315. End Sub
  316.  
  317. Sub Typekey(key As Byte)
  318.    Local Usage As Word
  319.    Usage = Ascii2usage(key)
  320.  
  321.    Do : Loop Until _usb_tx_status2(1)._usb_txc = 1
  322.    ' Key down
  323.    _usb_tx_buffer2(2) = High(usage)                         'Modifier keys (shift, ctl, alt, etc)
  324.    _usb_tx_buffer2(3) = 0                                   'Reserved.  Always 0
  325.    _usb_tx_buffer2(4) = Low(usage)                          'key1
  326.    _usb_tx_buffer2(5) = 0                                   'key2
  327.    _usb_tx_buffer2(6) = 0                                   'key3
  328.    _usb_tx_buffer2(7) = 0                                   'key4
  329.    _usb_tx_buffer2(8) = 0                                   'key5
  330.    _usb_tx_buffer2(9) = 0                                   'key6
  331.    Call Usb_send(_usb_tx_status2(1) , 8)
  332.  
  333.    ' Key up
  334.    Do : Loop Until _usb_tx_status2(1)._usb_txc = 1
  335.    _usb_tx_buffer2(2) = 0                                   'Modifier keys (shift, ctl, alt, etc)
  336.    _usb_tx_buffer2(3) = 0                                   'Reserved.  Always 0
  337.    _usb_tx_buffer2(4) = 0                                   'key1
  338.    _usb_tx_buffer2(5) = 0                                   'key2
  339.    _usb_tx_buffer2(6) = 0                                   'key3
  340.    _usb_tx_buffer2(7) = 0                                   'key4
  341.    _usb_tx_buffer2(8) = 0                                   'key5
  342.    _usb_tx_buffer2(9) = 0                                   'key6
  343.    Call Usb_send(_usb_tx_status2(1) , 8)
  344. End Sub
  345.  
  346. End
  347.  
  348. '*******************************************************************************
  349. '******************** Descriptors stored in EEPROM or FLASH ********************
  350. '                  Do not change the order of the descriptors!
  351. '
  352. #if _usb_use_eeprom = 1
  353.    $eeprom
  354. #else
  355.    $data
  356. #endif
  357.  
  358. 'Device Descriptor
  359. _usb_devicedescriptor:
  360. Data 18 , 18 , _usb_desc_device , _usb_specl , _usb_spech , _usb_devclass
  361. Data _usb_devsubclass , _usb_devprot , 8 , _usb_vidl , _usb_vidh , _usb_pidl
  362. Data _usb_pidh , _usb_devrell , _usb_devrelh , _usb_imanufacturer
  363. Data _usb_iproduct , _usb_iserial , _usb_numconfigs
  364.  
  365.  
  366. 'Retrieving the configuration descriptor also gets all the interface and
  367. 'endpoint descriptors for that configuration.  It is not possible to retrieve
  368. 'only an interface or only an endpoint descriptor.  Consequently, this is a
  369. 'large transaction of variable size.
  370.  
  371. _usb_configdescriptor:
  372. Data _usb_descr_total , 9 , _usb_desc_config , _usb_descr_totall
  373. Data _usb_descr_totalh , _usb_numifaces , _usb_confignum , _usb_iconfig
  374. Data _usb_powered , _usb_maxpower
  375.  
  376. '_usb_IFaceDescriptor
  377. Data 9 , _usb_desc_iface , _usb_ifaceaddr , _usb_alternate
  378. Data _usb_ifaceendpoints , _usb_ifclass , _usb_ifsubclass , _usb_ifprotocol
  379. Data _usb_iiface
  380.  
  381. '#if _usb_hids > 0
  382. '_usb_HIDDescriptor
  383. Data _usb_hid_descr_len , _usb_desc_hid , _usb_hid_releasel , _usb_hid_releaseh
  384. Data _usb_hid_country , _usb_hid_numdescriptors
  385.  
  386. 'Next follows a list of bType and wLength bytes/words for each report and
  387. 'physical descriptor.
  388. Data _usb_desc_report
  389. Data 63 , 0
  390. 'End of report/physical descriptor list
  391. '#endif
  392.  
  393. '#if _usb_endpoints > 1
  394. '_usb_EndpointDescriptor
  395. Data 7 , _usb_desc_endpoint , _usb_endp2attr , _usb_endp2type , 8 , 0
  396. Data _usb_endp2interval
  397. '#endif
  398.  
  399. '_usb_IFaceDescriptor1 *************************************************************************************
  400. Data 9 , _usb_desc_iface , _usb_ifaceaddr1 , _usb_alternate1       '                            ***********
  401. Data _usb_ifaceendpoints1 , _usb_ifclass1 , _usb_ifsubclass1 , _usb_ifprotocol1       '         ***********
  402. Data _usb_iiface1                                           '                                   ***********
  403.  
  404. '_usb_HIDDescriptor1  *************************************************************************************
  405. Data _usb_hid_descr_len , _usb_desc_hid , _usb_hid_releasel , _usb_hid_releaseh       '         ***********
  406. Data _usb_hid_country , _usb_hid_numdescriptors , _usb_desc_report       '                      ***********
  407. Data 50 , 0                                                 '                                   ***********
  408.  
  409. '#if _usb_endpoints > 2
  410. '_usb_EndpointDescriptor
  411. 'Data 7 , _usb_desc_endpoint , _usb_endp3attr , _usb_endp3type , 8 , 0
  412. Data 7 , _usb_desc_endpoint , _usb_endp3attr , _usb_endp3type , 3 , 0       'Multimedia message lenght is 3 bytes !!!!!!!!!!!!!!!!
  413. Data _usb_endp3interval
  414. '#endif
  415.  
  416. #if _usb_hids > 0
  417. _usb_hid_reportdescriptor:
  418. Data 63
  419. Data &H05 , &H01                                            ' USAGE_PAGE (Generic Desktop)
  420. Data &H09 , &H06                                            ' USAGE (Keyboard)
  421. Data &HA1 , &H01                                            ' COLLECTION (Application)
  422. Data &H05 , &H07                                            '   USAGE_PAGE (Keyboard)
  423. Data &H19 , &HE0                                            '   USAGE_MINIMUM (Keyboard LeftControl)
  424. Data &H29 , &HE7                                            '   USAGE_MAXIMUM (Keyboard Right GUI)
  425. Data &H15 , &H00                                            '   LOGICAL_MINIMUM (0)
  426. Data &H25 , &H01                                            '   LOGICAL_MAXIMUM (1)
  427. Data &H75 , &H01                                            '   REPORT_SIZE (1)
  428. Data &H95 , &H08                                            '   REPORT_COUNT (8)
  429. Data &H81 , &H02                                            '   INPUT (Data,Var,Abs)
  430. Data &H95 , &H01                                            '   REPORT_COUNT (1)
  431. Data &H75 , &H08                                            '   REPORT_SIZE (8)
  432. Data &H81 , &H03                                            '   INPUT (Cnst,Var,Abs)
  433. Data &H95 , &H05                                            '   REPORT_COUNT (5)
  434. Data &H75 , &H01                                            '   REPORT_SIZE (1)
  435. Data &H05 , &H08                                            '   USAGE_PAGE (LEDs)
  436. Data &H19 , &H01                                            '   USAGE_MINIMUM (Num Lock)
  437. Data &H29 , &H05                                            '   USAGE_MAXIMUM (Kana)
  438. Data &H91 , &H02                                            '   OUTPUT (Data,Var,Abs)
  439. Data &H95 , &H01                                            '   REPORT_COUNT (1)
  440. Data &H75 , &H03                                            '   REPORT_SIZE (3)
  441. Data &H91 , &H03                                            '   OUTPUT (Cnst,Var,Abs)
  442. Data &H95 , &H06                                            '   REPORT_COUNT (6)
  443. Data &H75 , &H08                                            '   REPORT_SIZE (8)
  444. Data &H15 , &H00                                            '   LOGICAL_MINIMUM (0)
  445. Data &H25 , &H65                                            '   LOGICAL_MAXIMUM (101)
  446. Data &H05 , &H07                                            '   USAGE_PAGE (Keyboard)
  447. Data &H19 , &H00                                            '   USAGE_MINIMUM (Reserved (no event indicated))
  448. Data &H29 , &H65                                            '   USAGE_MAXIMUM (Keyboard Application)
  449. Data &H81 , &H00                                            '   INPUT (Data,Ary,Abs)
  450. Data &HC0                                                   ' END_COLLECTION
  451.  
  452. _usb_hid_reportdescriptor1:                                 '                                               ************
  453. Data 50                                                     '                                               ************
  454. Data &H05 , &H0C                                            'Usage Page (Consumer Devices)                  ************
  455. Data &H09 , &H01                                            'Usage (Consumer Control)                       ************
  456. Data &HA1 , &H01                                            'Collection (Application)                       ************
  457. Data &H85 , &H01                                            '  Report ID (1)                                ************
  458. Data &H19 , &H00                                            '  Usage Minimum (Undefined)                    ************
  459. Data &H2A , &H3C , &H02                                     '  Usage Maximum (reserved 0x023c)              ************
  460. Data &H15 , &H00                                            '  Logical Minimum (0)                          ************
  461. Data &H26 , &H3C , &H02                                     '  Logical Maximum (572)                        ************
  462. Data &H95 , &H01                                            '  Report Count (1)                             ************
  463. Data &H75 , &H10                                            '  Report Size (16)                             ************
  464. Data &H81 , &H00                                            '  Input (Data,Ary,Abs)                         ************
  465. Data &HC0                                                   'End Collection                                 ************
  466. Data &H05 , &H01                                            'Usage Page (Generic Desktop)                   ************
  467. Data &H09 , &H80                                            'Usage (System Control)                         ************
  468. Data &HA1 , &H01                                            'Collection (Application)                       ************
  469. Data &H85 , &H02                                            '  Report ID (2)                                ************
  470. Data &H19 , &H81                                            '  Usage Minimum (System Power Down)            ************
  471. Data &H29 , &H83                                            '  Usage Maximum (System Wake Up)               ************
  472. Data &H25 , &H01                                            '  Logical Maximum (1)                          ************
  473. Data &H75 , &H01                                            '  Report Size (1)                              ************
  474. Data &H95 , &H03                                            '  Report Count (3)                             ************
  475. Data &H81 , &H02                                            '  Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)  ************
  476. Data &H95 , &H05                                            '  Report Count (5)                             ************
  477. Data &H81 , &H01                                            '  Input (Cnst,Ary,Abs)                         ************
  478. Data &HC0                                                   'End Collection                                 ************
  479.  
  480.  
  481. #endif
  482.  
  483. '*****************************String descriptors********************************
  484. 'Yes, they MUST be written like "t","e","s","t".  Doing so pads them with
  485. '0's.  If you write it like "test," I promise you it won't work.
  486.  
  487. 'Default language descriptor (index 0)
  488. _usb_langdescriptor:
  489. Data 4 , 4 , _usb_desc_string , 09 , 04                     '&h0409 = English
  490.  
  491. 'Manufacturer Descriptor (unicode)
  492. _usb_mandescriptor:
  493. Data 14 , 14 , _usb_desc_string
  494. Data "o" , "l" , "l" , "o" , "p" , "a"
  495.  
  496. 'Product Descriptor (unicode)
  497. _usb_proddescriptor:
  498. Data 46 , 46 , _usb_desc_string
  499. Data "o" , "l" , "l" , "o" , "p" , "a" , "'" , "s" , " " , "k" , "e" , "y" , "b" , "o" , "a" , "r" , "d" , " "
  500. Data "v" , "1" , "." , "0"
  501.  
  502. _usb_numdescriptor:
  503. Data 4 , 4 , _usb_desc_string
  504. Data "2" , 0 , 0
  505.  
  506. '*******************************************************************************
  507.  
  508.  
  509.  
  510.  
  511. Function Ascii2usage(ascii As Byte) As Word
  512. Local Result As Word
  513.  
  514. 'Maps common (mostly printable) ASCII characters to USB Keyboard usage codes
  515. 'Returns two bytes: keyboard modifier flags and key code
  516.  
  517. 'Modifier bits:
  518. '0 LEFT CTRL
  519. '1 LEFT SHIFT
  520. '2 LEFT ALT
  521. '3 LEFT GUI
  522. '4 RIGHT CTRL
  523. '5 RIGHT SHIFT
  524. '6 RIGHT ALT
  525. '7 RIGHT GUI
  526.  
  527. 'USB Keyboard usage codes
  528. '0   No event (no keys pressed)
  529. '1   Keyboard ErrorRollOver
  530. '2   Keyboard POSTFail
  531. '3   Undefined Keyboard Error
  532.  
  533. 'Standard Keyboard keys
  534. '04-29 (a and A) to (z and Z)     Letters
  535. '30-39 (1 and !) to (0 and ))     Numbers
  536. '40    Enter/Return (^m)
  537. '41    Escape
  538. '42    Backspace  (^h)
  539. '43    Tab
  540. '44    Space
  541. '45    - and _
  542. '46    = and +
  543. '47    [ and {
  544. '48    ] and }
  545. '49    \ and |
  546. '50    Non-US # and ~  or \ and |
  547. '51    ; and :
  548. '52    ' and "
  549. '53    ` and ~
  550. '54    , and <
  551. '55    . and >
  552. '56    / and ?
  553. '57    CAPS LOCK
  554. '58-69 F1 - F12
  555. '70    PRINT SCREEN
  556. '71    SCROLL LOCK
  557. '72    Pause
  558. '73    Insert
  559. '74    Home
  560. '75    PageUp
  561. '76    Delete
  562. '77    End
  563. '78    PageDown
  564. '79    Right Arrow
  565. '80    Left Arrow
  566. '81    Down Arrow
  567. '82    Up Arrow
  568.  
  569. 'Standard Keypad keys (ten-key)
  570. '83    Keypad Numlock
  571. '84    Keypad /
  572. '85    Keypad *
  573. '86    Keypad -
  574. '87    Keypad +
  575. '88    Keypad ENTER
  576. '89-98 Keypad 1-0
  577. '99    Keypad . and DEL
  578. Select Case Ascii
  579. Case "a" To "z":
  580.    Result = Ascii - 93
  581. Case "A" To "Z":
  582.    Result = Ascii - 61
  583.    Result = Result Or &B00000010_00000000                   'left shift modifier
  584. Case "1" To "9":
  585.    Result = Ascii - 19
  586. Case "0":
  587.    Result = 39
  588. Case " ":
  589.    Result = 44
  590. Case Else:
  591.    Result = 0
  592. End Select
  593. Ascii2usage = Result
  594. End Function
Capture.JPG
Please find attached an error files, could be this first error and possible have an another error.

Thank you.
Weako.
Nie masz wymaganych uprawnień, aby zobaczyć pliki załączone do tego posta.
Awatar użytkownika
niveasoft
Posty: 1216
Rejestracja: 17 sie 2015, 12:13
Kontakt:

Re: HID Volume Error When Compile

Post autor: niveasoft » 30 mar 2020, 11:20

This is simple. You need library "swusb.lbx" means "software USB". Try to find it with google if you dont have account on the MCS server :D

https://www.mcselec.com/index.php?optio ... &Itemid=57
Awatar użytkownika
Oldman
Posty: 61
Rejestracja: 19 cze 2019, 11:15

Re: HID Volume Error When Compile

Post autor: Oldman » 30 mar 2020, 11:25

Insert this file into the "LIB" folder in Bascom. Unpack first of course.
Nie masz wymaganych uprawnień, aby zobaczyć pliki załączone do tego posta.
weako
Posty: 11
Rejestracja: 22 mar 2020, 14:37

Re: HID Volume Error When Compile

Post autor: weako » 31 mar 2020, 12:08

Niveasoft & Oldman,
Thank you so much for helping.

Thanks,
Weako.
ODPOWIEDZ