* Copyright:
S59KB
Thank microelectronics, 2013
* Revision History:
20130126:
* Description:
This is a simple demonstration of 8 Axis, 12 Buttons and Hat Joystick Controller
Possibility of adjusting OFFSET potentiometer USING REFERENCES VREF+ and VREF-
Due to the angle of the potentiometer.
There are opportunities to expand the matrix of buttons
Program to use USB_HID_desc
* Test configuration:
No drivers needed
Tested on WIN_98 operating systems,
Tested on WIN_XP 32_BIT operating systems,
Tested on WIN_XP 64_BIT operating systems,
Tested on WIN_7 32_BIT operating systems,
Tested on WIN_7 64_BIT operating systems,
Not tested on WIN_8 operating systems.
MCU: P18F2550 or any other USB Pic
Dev.Board: EasyPIC5 or any other.
Oscillator: 4.0000 MHz
SW: mikroBasic Pro v 3.2
You can download it
http://www.libstock.com/projects/view/5 ... button-hat
Testing program JOYSTICK
PROGRAM FOR TILES Sprint Layout50
FRONT PAGE
last page
8 BIT VERSION
Code: Select all
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
''
'' * Program name: JOYSTIC_BY_BOKI S59KB
''
'' * Copyright:
'' S59KB
'' Thank microelectronics, 2013
''
'' * Revision History:
'' 20130126:
''
'' * Description:
''
'' This is a simple demonstration of 8 Axis, 12 Buttons and Hat Joystick Controller
'' Possibility of adjusting OFFSET potentiometer USING REFERENCES VREF+ and VREF-
'' Due to the angle of the potentiometer.
'' There are opportunities to expand the matrix of buttons
'' Program to use USB_HID_desc
''
'' * Test configuration:
'' No drivers needed
'' Tested on WIN_98 operating systems,
'' Tested on WIN_XP 32_BIT operating systems,
'' Tested on WIN_XP 64_BIT operating systems,
'' Tested on WIN_7 32_BIT operating systems,
'' Tested on WIN_7 64_BIT operating systems,
'' Not tested on WIN_8 operating systems.
''
'' MCU: P18F2550 or any other USB Pic
'' Dev.Board: EasyPIC5 or any other.
'' Oscillator: 4.0000 MHz
'' SW: mikroBasic Pro v 3.2
''
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
program JOYSTIC_BY_BOKI
include USB_HID_desc
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
' Tested on 18F2550 @ 4 MHz....8 Axis, 12 Buttons and Hat Joystick Controller
' ______ _____
' ( (__) )
' COLUMN 4 RE3 O (1 28) O RB7
' ( )
' X AXIS RA0/AN0 O (2 27) O RB6 ROWS 3
' ( )
' Y AXIS RA1/AN1 O (3 26) O RB5
' ( )
' VREF - RA2/AN2 O (4 25) O RB4/AN11 SLIDER AXIS
' ( )
' VREF + RA3/AN3 O (5 24) O RB3/AN9 RY AXIS
' ( )
' ROWS 4 RA4 O (6 23) O RB2/AN8 RX AXIS
' ( )
' Z AXIS RA5/AN4 O (7 22) O RB1/AN10 RZ AXIS
' ( )
' - 5 V VSS O (8 21) O RB0/AN12 DIAL AXIS
' ( )
' OSC O (9 20) O VDD + 5 V
' 4 MHZ ( )
' OSC O (10 19) O VSS - 5 V
' ( )
' COLUMN 1 RCO O (11 18) O RC7 ROWS 2
' ( )
' COLUMN 2 RC1 O (12 17) O RC6 ROWS 1
' ( )
' COLUMN 3 RC2 O (13 16) O D++
' ( ) USB
' USB O (14 15) O D--
' (______________)
'*******************************************************************************
' USB Data Map BYTE
' |----|----|----|----|----|----|----|----|
' 0 | X |
' |----|----|----|----|----|----|----|----|
' 1 | Y |
' |----|----|----|----|----|----|----|----|
' 2 | Z |
' |----|----|----|----|----|----|----|----|
' 3 | RX |
' |----|----|----|----|----|----|----|----|
' 4 | RY |
' |----|----|----|----|----|----|----|----|
' 5 | RZ |
' |----|----|----|----|----|----|----|----|
' 6 | DIAL |
' |----|----|----|----|----|----|----|----|
' 7 | SLIDER |
' |----|----|----|----|----|----|----|----|
' 8 |HATA|HATB|HATC|HATD|SW1 |SW2 |SW3 |SW4 |
' |----|----|----|----|----|----|----|----|
' 9 |SW5 |SW6 |SW7 |SW8 |SW9 |SW10|SW11|SW12|
' |----|----|----|----|----|----|----|----|
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
DIM BR AS BYTE
DIM BUTT AS BYTE[5]
DIM NEGACIJA AS BYTE
DIM BUTTONS as BYTE[4]
DIM userWR_buffer as BYTE[64]
DIM userRD_buffer as BYTE[64]
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
sub procedure interrupt ' Main Interrupt Routine
HID_InterruptProc
end sub
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
sub procedure Init_Main ' Initialization Routine
'--------------------------------------
' Disable interrupts
'--------------------------------------
INTCON = 0 ' Disable GIE, PEIE, TMR0IE,INT0IE, RBIE
INTCON2 = 0x75 ' Turn on PORTB pull-ups
INTCON3 = 0xC0
RCON.IPEN = 0 ' Disable Priority Levels on interrupts
PIE1 = 0 PIE2 = 0 PIR1 = 0 PIR2 = 0
LATA = 0 LATB = 0 LATC = 0
'--------------------------------------
' ADCON1 = ADCON1 or 0xF3 ' 0xF3 REFERENCA +/-
ADCON0 = 0x01
ADCON1 = 0x31 ' RA2, RA3 are joystick axis inputs REFERENCA
ADCON2 = 0xBE
'--------------------------------------
' Switch Map TRIS bits: 1 = input, 0 = output
TRISC.0 = 1 ' RC0 input Columns 1 - with pullup
TRISC.1 = 1 ' RC1 input Columns 2 - with pullup
TRISC.2 = 1 ' RC2 input Columns 3 - with pullup
' TRISE.3 = 1 ' RE2 input Columns 4 - with pullup
TRISC.6 = 0 ' RC6 output Rows 1
TRISC.7 = 0 ' RC7 output Rows 2
TRISA.4 = 0 ' RA4 output Rows 3
TRISB.6 = 0 ' RB6 output Rows 4
end sub
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
main: ' Main Program Routine
Init_Main()
FOR BR = 0 TO 11
userWR_buffer[BR] = 0x00 ' Initialize everything to 0
NEXT BR
'----------------------------
FOR BR = 0 TO 4
BUTT[BR] = 0x00 ' Initialize everything to 0
NEXT BR
HID_Enable(@userRD_buffer, @userWR_buffer)
Delay_ms(1000)
Delay_ms(1000)
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
while true
PORTC.0 = 0 PORTC.1 = 0 PORTC.2 = 0 PORTE.0 = 0
' Scan switch lines
' Read key data into Hat and Buttons
' Switch Map COL
' ROW 1 - RC0 2 - RC1 3 - RC2 4 - RE4
' RC6 - 1 0.0 = 1H 0.1 = 2H 0.2 = 3H 0.3 = 4H HAT 1-4
' RC7 - 2 0.4 = 1 0.5 = 2 0.6 = 3 0.7 = 4 BUTTONS 1-4
' RA4 - 3 1.0 = 5 1.1 = 6 1.2 = 7 1.3 = 8 BUTTONS 5-8
' RB6 - 4 1.4 = 9 1.5 = 10 1.6 = 11 1.7 = 12 BUTTONS 9-12
'-------------------------------------------------------------------------------
' VARIJANTA 1 SA 4 POZICIJE OD 90°
' Scan row RC6 = 0 Hat
PORTA.4 = 1 PORTB.6 = 1 PORTC.6 = 0 PORTC.7 = 1
BUTT[0] = 1 BUTT[1] = 1 BUTT[2] = 1 BUTT[3] = 1
IF (PORTC.1 = 0) THEN BUTT[1] = 0 END IF ' B
IF (PORTC.2 = 0) THEN BUTT[2] = 0 END IF ' C
IF (PORTC.0 = 0) THEN BUTT[1] = 0 BUTT[2] = 0 END IF ' D
IF (PORTE.3 = 0) THEN BUTT[3] = 0 END IF 'A
IF (PORTC.0 = 1) AND (PORTC.1 = 1) AND (PORTC.2 = 1) THEN NEGACIJA = 0 ELSE NEGACIJA = 1 END IF
IF (BUTT[3] = 0) AND (NEGACIJA = 0) THEN NEGACIJA = 1 END IF
BUTTONS[0].0 = BUTT[0]
BUTTONS[0].1 = BUTT[1]
BUTTONS[0].2 = BUTT[2]
BUTTONS[0].3 = NEGACIJA
'---------------------------
' VARIJANTA 2 SA 8 POZICIJA OD 45°
' Scan row RC6 = 0 Hat
' PORTA.4 = 1 PORTB.6 = 1 PORTC.6 = 0 PORTC.7 = 1
' BUTTONS[0].0 = PORTC.0
' BUTTONS[0].1 = PORTC.1
' BUTTONS[0].2 = PORTC.2
' IF (PORTC.0 = 1) AND (PORTC.1 = 1) AND (PORTC.2 = 1) THEN NEGACIJA = 0 ELSE NEGACIJA = 1 END IF
' IF (PORTE.3 = 0) AND (NEGACIJA = 0) THEN NEGACIJA = 1 END IF
' BUTTONS[0].3 = NEGACIJA
'---------------------------
' Scan row RC7 = 0 Buttons
PORTA.4 = 1 PORTB.6 = 1 PORTC.6 = 1 PORTC.7 = 0
BUTTONS[0].4 = PORTC.0
BUTTONS[0].5 = PORTC.1
BUTTONS[0].6 = PORTC.2
BUTTONS[0].7 = PORTE.3
'---------------------------
' Scan row RA4 = 0 Buttons
PORTA.4 = 0 PORTB.6 = 1 PORTC.6 = 1 PORTC.7 = 1
BUTTONS[1].0 = PORTC.0
BUTTONS[1].1 = PORTC.1
BUTTONS[1].2 = PORTC.2
BUTTONS[1].3 = PORTE.3
'---------------------------
' Scan row RB6 = 0 Buttons
PORTA.4 = 1 PORTB.6 = 0 PORTC.6 = 1 PORTC.7 = 1
BUTTONS[1].4 = PORTC.0
BUTTONS[1].5 = PORTC.1
BUTTONS[1].6 = PORTC.2
BUTTONS[1].7 = PORTE.3
PORTA.4 = 1 PORTB.6 = 1 PORTC.6 = 1 PORTC.7 = 1
'---------------------------------------------------------
' SELEKTOVANJE RADNIH I MIRNIH BUTTONA
FOR BR = 0 TO 2
buttons[BR]= NOT buttons[BR]
NEXT BR
'---------------------------------------------------------
' Read axis inputs and userWR 8 BYTE
userWR_buffer[0] = adc_read(10)>>2 ' Read RZ
userWR_buffer[1] = adc_read(0)>>2 ' Read X
userWR_buffer[2] = adc_read(1)>>2 ' Read Y
userWR_buffer[3] = adc_read(4)>>2 ' Read Z
userWR_buffer[4] = adc_read(8)>>2 ' Read RX
userWR_buffer[5] = adc_read(9)>>2 ' Read RY
userWR_buffer[6] = adc_read(12)>>2 ' Read DIAL
userWR_buffer[7] = adc_read(11)>>2 ' Read SLIDER
'-----------------------------------------------------------
' Read BUTTONS inputs and HAT 2 BYTE
userWR_buffer[8] = BUTTONS[0] ' HAT and buttons 1, 2, 3, 4
userWR_buffer[9] = BUTTONS[1] ' buttons 5, 6, 7, 8, 9, 10, 11, 12
'-----------------------------------------------------------
HID_Write(@userWR_buffer, 10)
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
wend
HID_Disable()
end.
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
8 BIT VERSION
Code: Select all
module USB_HID_desc
' uses HIDconstant;
' File Version 2.0
'******************************************************************************
const Serial_No = "22062005"
'******************************************************************************
' The number of bytes in each report,
' calculated from Report Size and Report Count in the report descriptor
'******************************************************************************
const HID_INPUT_REPORT_BYTES = 64
const HID_OUTPUT_REPORT_BYTES = 64
const HID_FEATURE_REPORT_BYTES = 2
'******************************************************************************
' Byte constants
'******************************************************************************
const NUM_ENDPOINTS = 2
const ConfigDescr_wTotalLength = USB_CONFIG_DESCRIPTOR_LEN + USB_INTERF_DESCRIPTOR_LEN + USB_HID_DESCRIPTOR_LEN + (NUM_ENDPOINTS * USB_ENDP_DESCRIPTOR_LEN)
const HID_ReportDesc_len = 115
const Low_HID_ReportDesc_len = HID_ReportDesc_len
const High_HID_ReportDesc_len = HID_ReportDesc_len >> 8
const Low_HID_PACKET_SIZE = HID_PACKET_SIZE
const High_HID_PACKET_SIZE = HID_PACKET_SIZE >> 8
'******************************************************************************
' Descriptor Tables
'******************************************************************************
' const DescTables as byte[USB_DEVICE_DESCRIPTOR_ALL_LEN*2] = (
const DescTables as byte[(18+9+9+9+7+7+115)*2] = (
' Device Descriptor
USB_DEVICE_DESCRIPTOR_LEN, 0, ' bLength - Length of Device descriptor (always 0x12)
USB_DEVICE_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 1 = DEVICE descriptor
0x00, 0, ' bcdUSB - USB revision 2.00 (low byte)
0x02, 0, ' (high byte)
0x00, 0, ' bDeviceClass - Zero means each interface operates independently (class code in the interface descriptor)
0x00, 0, ' bDeviceSubClass
0x00, 0, ' bDeviceProtocol
EP0_PACKET_SIZE, 0, ' bMaxPacketSize0 - maximum size of a data packet for a control transfer over EP0
0x01, 0, ' idVendor - Vendor ID (low byte)
0x28, 0, ' (high byte)
0x13, 0, ' idProduct - Product ID (low byte)
0x20, 0, ' (high byte)
0x21, 0, ' bcdDevice - (low byte)
0x01, 0, ' (high byte)
0x01, 0, ' iManufacturer - String1
0x02, 0, ' iProduct - String2
0x03, 0, ' iSerialNumber - String3
0x01, 0, ' bNumConfigurations - 1
'------------------------------------------------------------------------------
' Configuration Descriptor
USB_CONFIG_DESCRIPTOR_LEN, 0, ' bLength - Length of Configuration descriptor (always 0x09)
USB_CONFIG_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 2 = CONFIGURATION descriptor
ConfigDescr_wTotalLength, 0, ' wTotalLength - Total length of this config. descriptor plus the interface and endpoint descriptors that are part of the configuration.
0x00, 0, ' (high byte)
0x01, 0, ' bNumInterfaces - Number of interfaces
0x01, 0, ' bConfigurationValue - Configuration Value
0x00, 0, ' iConfiguration - String Index for this configuration ( None )
0xA0, 0, ' bmAttributes - attributes - "Bus powered" and "Remote wakeup"
50, 0, ' MaxPower - bus-powered draws 50*2 mA from the bus.
'------------------------------------------------------------------------------
' Interface Descriptor
USB_INTERF_DESCRIPTOR_LEN, 0, ' bLength - Length of Interface descriptor (always 0x09)
USB_INTERFACE_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 4 = INTERFACE descriptor
0x00, 0, ' bInterfaceNumber - Number of interface, 0 based array
0x00, 0, ' bAlternateSetting - Alternate setting
NUM_ENDPOINTS, 0, ' bNumEndPoints - Number of endpoints used in this interface
0x03, 0, ' bInterfaceClass - assigned by the USB
0x00, 0, ' bInterfaceSubClass - Not A boot device
0x00, 0, ' bInterfaceProtocol - none
0x00, 0, ' iInterface - Index to string descriptor that describes this interface ( None )
'------------------------------------------------------------------------------
' HID Descriptor
USB_HID_DESCRIPTOR_LEN, 0, ' bLength - Length of HID descriptor (always 0x09)
USB_HID_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 0x21 = HID descriptor
0x01, 0, ' HID class release number (1.01)
0x01, 0,
0x00, 0, ' Localized country code (none)
0x01, 0, ' # of HID class descriptor to follow (1)
0x22, 0, ' Report descriptor type (HID)
Low_HID_ReportDesc_len, 0,
High_HID_ReportDesc_len, 0,
'------------------------------------------------------------------------------
' EP1_RX Descriptor
USB_ENDP_DESCRIPTOR_LEN, 0, ' bLength - length of descriptor (always 0x07)
USB_ENDPOINT_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 5 = ENDPOINT descriptor
0x81, 0, ' bEndpointAddress - In, EP1
USB_ENDPOINT_TYPE_INTERRUPT, 0, ' bmAttributes - Endpoint Type - Interrupt
Low_HID_PACKET_SIZE, 0, ' wMaxPacketSize - max packet size - low order byte
High_HID_PACKET_SIZE, 0, ' - max packet size - high order byte
1, 0, ' bInterval - polling interval (1 ms)
'------------------------------------------------------------------------------
' EP1_TX Descriptor
USB_ENDP_DESCRIPTOR_LEN, 0, ' bLength - length of descriptor (always 0x07)
USB_ENDPOINT_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 5 = ENDPOINT descriptor
0x01, 0, ' bEndpointAddress - Out, EP1
USB_ENDPOINT_TYPE_INTERRUPT, 0, ' bmAttributes - Endpoint Type - Interrupt
Low_HID_PACKET_SIZE, 0, ' wMaxPacketSize - max packet size - low order byte
High_HID_PACKET_SIZE, 0, ' - max packet size - high order byte
1, 0, ' bInterval - polling interval (1 ms)
'------------------------------------------------------------------------------
' HID_Report Descriptor
' USB Data Map
'------------------------------------------------------------------------------
0x05, 0, 0x01, 0, ' USAGE_PAGE (Generic Desktop)
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x09, 0, 0x04, 0, ' USAGE (Joystick)
0xa1, 0, 0x01, 0, ' COLLECTION (Application)
'------------------------------------------------------------------------------
' 1 BYTE DATA ZA RZ OSU
0x05, 0, 0x01, 0, ' USAGE_PAGE (Generic Desktop)
0x09, 0, 0x35, 0, ' USAGE (RZ)
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x26, 0, 0xff, 0,
0x00, 0, ' LOGICAL_MAXIMUM (255)
0x75, 0, 0x08, 0, ' REPORT_SIZE (8)
0x95, 0, 0x01, 0, ' REPORT_COUNT (1)
0x81, 0, 0x02, 0, ' INPUT (Data,Var,Abs)
'------------------------------------------------------------------------------
' 2,3,4,5,6 BYTE DATA ZA X, Y, Z, RX, RY OSU
0x05, 0, 0x01, 0, ' USAGE_PAGE (Generic Desktop)
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x26, 0,
0xff, 0, 0x00, 0, ' LOGICAL_MAXIMUM (255)
0xa1, 0, 0x00, 0, ' COLLECTION (Physical)
0x09, 0, 0x30, 0, ' USAGE (X)
0x09, 0, 0x31, 0, ' USAGE (Y)
0x09, 0, 0x32, 0, ' USAGE (Z)
0x09, 0, 0x33, 0, ' USAGE (RX)
0x09, 0, 0x34, 0, ' USAGE (RY)
0x95, 0, 0x05, 0, ' REPORT_COUNT (5)
0x81, 0, 0x02, 0, ' INPUT (Data,Var,Abs)
'------------------------------------------------------------------------------
' 7 BYTE DATA ZA Dial POZICIJU
0x05, 0, 0x01, 0, ' USAGE_PAGE (Generic Desktop)
0x09, 0, 0x36, 0, ' USAGE (Dial)
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x26, 0, 0xFF, 0,
0x00, 0, ' LOGICAL_MAXIMUM (255)
0x75, 0, 0x08, 0, ' REPORT_SIZE (8)
0x95, 0, 0x01, 0, ' REPORT_COUNT (1)
0x81, 0, 0x02, 0, ' INPUT (Data,Var,Abs)
'------------------------------------------------------------------------------
' 8 BYTE DATA ZA Slider POZICIJU
0x05, 0, 0x01, 0, ' USAGE_PAGE (Generic Desktop)
0x09, 0, 0x37, 0, ' USAGE (Slider)
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x26, 0, 0xFF, 0,
0x00, 0, ' LOGICAL_MAXIMUM (255)
0x75, 0, 0x08, 0, ' REPORT_SIZE (8)
0x95, 0, 0x01, 0, ' REPORT_COUNT (1)
0x81, 0, 0x02, 0, ' INPUT (Data,Var,Abs)
'------------------------------------------------------------------------------
' 9 1/2 BYTE DATA ZA HAT POZICIJU i 2/2 BYTE ZA BUTTONS
0x05, 0, 0x01, 0, ' USAGE_PAGE (Generic Desktop)
0x09, 0, 0x39, 0, ' USAGE (Hat switch)
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x25, 0, 0x07, 0, ' LOGICAL_MAXIMUM (1)
0x35, 0, 0x00, 0, ' PHYSICAL_MINIMUM (0)
0x46, 0, 0x68, 0, '
0x01, 0, ' PHYSICAL_MAXIMUM (360)
0x55, 0, 0x0F, 0, ' UNIT (Eng Rot:Angular Pos)
0x75, 0, 0x04, 0, ' REPORT_SIZE (4)
0x95, 0, 0x01, 0, ' REPORT_COUNT (1)
0x81, 0, 0x02, 0, ' INPUT (Data,Var,Abs)
'------------------------------------------------------------------------------
' 10 BYTE DATA ZA Buttons POZICIJU
0x05, 0, 0x09, 0, ' USAGE_PAGE (Buttons)
0x19, 0, 0x01, 0, ' Usage Minimum
0x29, 0, 0x12, 0, ' Usage Maximum
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x25, 0, 0x01, 0, ' LOGICAL_MAXIMUM (1)
0x75, 0, 0x01, 0, ' REPORT_SIZE (1)
0x95, 0, 0x0C, 0, ' REPORT_COUNT (12)
0x81, 0, 0x02, 0, ' INPUT (Data,Var,Abs)
'------------------------------------------------------------------------------
0xc0, 0, ' END_COLLECTION
0xc0, 0 ' END_COLLECTION
)
'******************************************************************************
const LangIDDescr as byte[8] = (
0x04, 0,
USB_STRING_DESCRIPTOR_TYPE, 0,
0x09, 0, ' LangID (0x0409) - Low
0x04, 0 ' - High
)
'******************************************************************************
const ManufacturerDescr as byte[28] = (
14, 0,
USB_STRING_DESCRIPTOR_TYPE, 0,
"8", 0, 0, 0,
"-", 0, 0, 0,
"B", 0, 0, 0,
"i", 0, 0, 0,
"t", 0, 0, 0,
"a", 0, 0, 0
)
'******************************************************************************
const ProductDescr as byte[116] = (
58, 0,
USB_STRING_DESCRIPTOR_TYPE, 0,
"U", 0, 0, 0,
"S", 0, 0, 0,
"B", 0, 0, 0,
" ", 0, 0, 0,
"J", 0, 0, 0,
"O", 0, 0, 0,
"Y", 0, 0, 0,
"S", 0, 0, 0,
"T", 0, 0, 0,
"I", 0, 0, 0,
"C", 0, 0, 0,
" ", 0, 0, 0,
"B", 0, 0, 0,
"Y", 0, 0, 0,
" ", 0, 0, 0,
"S", 0, 0, 0,
"5", 0, 0, 0,
"9", 0, 0, 0,
"K", 0, 0, 0,
"B", 0, 0, 0,
" ", 0, 0, 0,
"V", 0, 0, 0,
"E", 0, 0, 0,
"R", 0, 0, 0,
" ", 0, 0, 0,
"2", 0, 0, 0,
".", 0, 0, 0,
"0", 0, 0, 0
)
'******************************************************************************
const StrUnknownDescr as byte[36] = (
18, 0,
USB_STRING_DESCRIPTOR_TYPE, 0,
Serial_No[0], 0, 0, 0,
Serial_No[1], 0, 0, 0,
Serial_No[2], 0, 0, 0,
Serial_No[3], 0, 0, 0,
Serial_No[4], 0, 0, 0,
Serial_No[5], 0, 0, 0,
Serial_No[6], 0, 0, 0,
Serial_No[7], 0, 0, 0
)
'******************************************************************************
implements
end.
Code: Select all
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
''
'' * Program name: JOYSTIC_BY_BOKI S59KB 10 BIT AXIS
''
'' * Copyright:
'' S59KB
'' Thank microelectronics, 2013
''
'' * Revision History:
'' 20130126:
''
'' * Description:
''
'' This is a simple demonstration of 8 Axis, 12 Buttons and Hat Joystick Controller
'' Possibility of adjusting OFFSET potentiometer USING REFERENCES VREF+ and VREF-
'' Due to the angle of the potentiometer.
'' There are opportunities to expand the matrix of buttons
'' Program to use USB_HID_desc
''
'' * Test configuration:
'' No drivers needed
'' Tested on WIN_98 operating systems,
'' Tested on WIN_XP 32_BIT operating systems,
'' Tested on WIN_XP 64_BIT operating systems,
'' Tested on WIN_7 32_BIT operating systems,
'' Tested on WIN_7 64_BIT operating systems,
'' Not tested on WIN_8 operating systems.
''
'' MCU: P18F2550 or any other USB Pic
'' Dev.Board: EasyPIC5 or any other.
'' Oscillator: 4.0000 MHz
'' SW: mikroBasic Pro v 3.2
''
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
program JOYSTIC_BY_BOKI
include USB_HID_desc
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
' Tested on 18F2550 @ 4 MHz....8 Axis, 12 Buttons and Hat Joystick Controller
' ______ _____
' ( (__) )
' COLUMN 4 RE3 O (1 28) O RB7
' ( )
' X AXIS RA0/AN0 O (2 27) O RB6 ROWS 3
' ( )
' Y AXIS RA1/AN1 O (3 26) O RB5
' ( )
' VREF - RA2/AN2 O (4 25) O RB4/AN11 SLIDER AXIS
' ( )
' VREF + RA3/AN3 O (5 24) O RB3/AN9 RY AXIS
' ( )
' ROWS 4 RA4 O (6 23) O RB2/AN8 RX AXIS
' ( )
' Z AXIS RA5/AN4 O (7 22) O RB1/AN10 RZ AXIS
' ( )
' - 5 V VSS O (8 21) O RB0/AN12 DIAL AXIS
' ( )
' OSC O (9 20) O VDD + 5 V
' 4 MHZ ( )
' OSC O (10 19) O VSS - 5 V
' ( )
' COLUMN 1 RCO O (11 18) O RC7 ROWS 2
' ( )
' COLUMN 2 RC1 O (12 17) O RC6 ROWS 1
' ( )
' COLUMN 3 RC2 O (13 16) O D++
' ( ) USB
' USB O (14 15) O D--
' (______________)
'*******************************************************************************
' USB Data Map BYTE
' |----|----|----|----|----|----|----|----|
' 0,1 | X |
' |----|----|----|----|----|----|----|----|
' 2,3 | Y |
' |----|----|----|----|----|----|----|----|
' 4,5 | Z |
' |----|----|----|----|----|----|----|----|
' 6,7 | RX |
' |----|----|----|----|----|----|----|----|
' 8,9 | RY |
' |----|----|----|----|----|----|----|----|
' 10,11 | RZ |
' |----|----|----|----|----|----|----|----|
' 12,13 | DIAL |
' |----|----|----|----|----|----|----|----|
' 14,15 | SLIDER |
' |----|----|----|----|----|----|----|----|
' 16 |HATA|HATB|HATC|HATD|SW1 |SW2 |SW3 |SW4 |
' |----|----|----|----|----|----|----|----|
' 17 |SW5 |SW6 |SW7 |SW8 |SW9 |SW10|SW11|SW12|
' |----|----|----|----|----|----|----|----|
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
DIM BR AS BYTE
DIM POT_BR AS BYTE
DIM BUTT AS BYTE[5]
DIM NEGACIJA AS BYTE
DIM BUTTONS as BYTE[4]
DIM userWR_buffer as BYTE[64]
DIM userRD_buffer as BYTE[64]
DIM POT AS WORD[9]
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
sub procedure interrupt ' Main Interrupt Routine
HID_InterruptProc
end sub
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
sub procedure Init_Main ' Initialization Routine
'--------------------------------------
' Disable interrupts
'--------------------------------------
INTCON = 0 ' Disable GIE, PEIE, TMR0IE,INT0IE, RBIE
INTCON2 = 0x75 ' Turn on PORTB pull-ups
INTCON3 = 0xC0
RCON.IPEN = 0 ' Disable Priority Levels on interrupts
PIE1 = 0 PIE2 = 0 PIR1 = 0 PIR2 = 0
LATA = 0 LATB = 0 LATC = 0
'--------------------------------------
' ADCON1 = ADCON1 or 0xF3 ' 0xF3 REFERENCA +/-
ADCON0 = 0x01
ADCON1 = 0x31 ' RA2, RA3 are joystick axis inputs REFERENCA
ADCON2 = 0xBE
'--------------------------------------
' Switch Map TRIS bits: 1 = input, 0 = output
TRISC.0 = 1 ' RC0 input Columns 1 - with pullup
TRISC.1 = 1 ' RC1 input Columns 2 - with pullup
TRISC.2 = 1 ' RC2 input Columns 3 - with pullup
' TRISE.3 = 1 ' RE2 input Columns 4 - with pullup
TRISC.6 = 0 ' RC6 output Rows 1
TRISC.7 = 0 ' RC7 output Rows 2
TRISA.4 = 0 ' RA4 output Rows 3
TRISB.6 = 0 ' RB6 output Rows 4
end sub
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
main: ' Main Program Routine
Init_Main()
FOR BR = 0 TO 11
userWR_buffer[BR] = 0x00 ' Initialize everything to 0
NEXT BR
'----------------------------
FOR BR = 0 TO 4
BUTT[BR] = 0x00 ' Initialize everything to 0
NEXT BR
HID_Enable(@userRD_buffer, @userWR_buffer)
Delay_ms(1000)
Delay_ms(1000)
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
while true
' PORTC.0 = 0 PORTC.1 = 0 PORTC.2 = 0 PORTE.0 = 0
' Scan switch lines
' Read key data into Hat and Buttons
' Switch Map COL
' ROW 1 - RC0 2 - RC1 3 - RC2 4 - RE4
' RC6 - 1 0.0 = 1H 0.1 = 2H 0.2 = 3H 0.3 = 4H HAT 1-4
' RC7 - 2 0.4 = 1 0.5 = 2 0.6 = 3 0.7 = 4 BUTTONS 1-4
' RA4 - 3 1.0 = 5 1.1 = 6 1.2 = 7 1.3 = 8 BUTTONS 5-8
' RB6 - 4 1.4 = 9 1.5 = 10 1.6 = 11 1.7 = 12 BUTTONS 9-12
'-------------------------------------------------------------------------------
' VARIJANTA 1 SA 4 POZICIJE OD 90°
' Scan row RC6 = 0 Hat
PORTA.4 = 1 PORTB.6 = 1 PORTC.6 = 0 PORTC.7 = 1
BUTT[0] = 1 BUTT[1] = 1 BUTT[2] = 1 BUTT[3] = 1
IF (PORTC.1 = 0) THEN BUTT[1] = 0 END IF ' B
IF (PORTC.2 = 0) THEN BUTT[2] = 0 END IF ' C
IF (PORTC.0 = 0) THEN BUTT[1] = 0 BUTT[2] = 0 END IF ' D
IF (PORTE.3 = 0) THEN BUTT[3] = 0 END IF 'A
IF (PORTC.0 = 1) AND (PORTC.1 = 1) AND (PORTC.2 = 1) THEN NEGACIJA = 0 ELSE NEGACIJA = 1 END IF
IF (BUTT[3] = 0) AND (NEGACIJA = 0) THEN NEGACIJA = 1 END IF
BUTTONS[0].0 = BUTT[0]
BUTTONS[0].1 = BUTT[1]
BUTTONS[0].2 = BUTT[2]
BUTTONS[0].3 = NEGACIJA
'---------------------------
' VARIJANTA 2 SA 8 POZICIJA OD 45°
' Scan row RC6 = 0 Hat
' PORTA.4 = 1 PORTB.6 = 1 PORTC.6 = 0 PORTC.7 = 1
' BUTTONS[0].0 = PORTC.0
' BUTTONS[0].1 = PORTC.1
' BUTTONS[0].2 = PORTC.2
' IF (PORTC.0 = 1) AND (PORTC.1 = 1) AND (PORTC.2 = 1) THEN NEGACIJA = 0 ELSE NEGACIJA = 1 END IF
' IF (PORTE.3 = 0) AND (NEGACIJA = 0) THEN NEGACIJA = 1 END IF
' BUTTONS[0].3 = NEGACIJA
'---------------------------
' Scan row RC7 = 0 Buttons
PORTA.4 = 1 PORTB.6 = 1 PORTC.6 = 1 PORTC.7 = 0
BUTTONS[0].4 = PORTC.0
BUTTONS[0].5 = PORTC.1
BUTTONS[0].6 = PORTC.2
BUTTONS[0].7 = PORTE.3
'---------------------------
' Scan row RA4 = 0 Buttons
PORTA.4 = 0 PORTB.6 = 1 PORTC.6 = 1 PORTC.7 = 1
BUTTONS[1].0 = PORTC.0
BUTTONS[1].1 = PORTC.1
BUTTONS[1].2 = PORTC.2
BUTTONS[1].3 = PORTE.3
'---------------------------
' Scan row RB6 = 0 Buttons
PORTA.4 = 1 PORTB.6 = 0 PORTC.6 = 1 PORTC.7 = 1
BUTTONS[1].4 = PORTC.0
BUTTONS[1].5 = PORTC.1
BUTTONS[1].6 = PORTC.2
BUTTONS[1].7 = PORTE.3
PORTA.4 = 1 PORTB.6 = 1 PORTC.6 = 1 PORTC.7 = 1
'---------------------------------------------------------
' SELEKTOVANJE RADNIH I MIRNIH BUTTONA
FOR BR = 0 TO 2
buttons[BR]= NOT buttons[BR]
NEXT BR
'---------------------------------------------------------
' Read axis inputs and userWR 16 BYTE
POT[1] = adc_read(10)
userWR_buffer[0] = LO(POT[1]) ' Read RZ
userWR_buffer[1] = HI(POT[1])
POT[2] = adc_read(0)
userWR_buffer[2] = LO(POT[2]) ' Read X
userWR_buffer[3] = HI(POT[2])
POT[3] = adc_read(1)
userWR_buffer[4] = LO(POT[3]) ' Read Y
userWR_buffer[5] = HI(POT[3])
POT[4] = adc_read(4)
userWR_buffer[6] = LO(POT[4]) ' Read Z
userWR_buffer[7] = HI(POT[4])
POT[5] = adc_read(8)
userWR_buffer[8] = LO(POT[5]) ' Read RX
userWR_buffer[9] = HI(POT[5])
POT[6] = adc_read(9)
userWR_buffer[10] = LO(POT[6]) ' Read RY
userWR_buffer[11] = HI(POT[6])
POT[7] = adc_read(12)
userWR_buffer[12] = LO(POT[7]) ' Read DIAL
userWR_buffer[13] = HI(POT[7])
POT[8] = adc_read(11)
userWR_buffer[14] = LO(POT[8]) ' Read SLIDER
userWR_buffer[15] = HI(POT[8])
'-----------------------------------------------------------
' Read BUTTONS inputs and HAT 2 BYTE
userWR_buffer[16] = BUTTONS[0] ' HAT and buttons 1, 2, 3, 4
userWR_buffer[17] = BUTTONS[1] ' buttons 5, 6, 7, 8, 9, 10, 11, 12
'-----------------------------------------------------------
HID_Write(@userWR_buffer, 18)
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
wend
HID_Disable()
end.
'*******************************************************************************
'///////////////////////////////////////////////////////////////////////////////
'*******************************************************************************
Code: Select all
module USB_HID_desc
' uses HIDconstant;
' File Version 2.0
'******************************************************************************
const Serial_No = "22062005"
'******************************************************************************
' The number of bytes in each report,
' calculated from Report Size and Report Count in the report descriptor
'******************************************************************************
const HID_INPUT_REPORT_BYTES = 64
const HID_OUTPUT_REPORT_BYTES = 64
const HID_FEATURE_REPORT_BYTES = 2
'******************************************************************************
' Byte constants
'******************************************************************************
const NUM_ENDPOINTS = 2
const ConfigDescr_wTotalLength = USB_CONFIG_DESCRIPTOR_LEN + USB_INTERF_DESCRIPTOR_LEN + USB_HID_DESCRIPTOR_LEN + (NUM_ENDPOINTS * USB_ENDP_DESCRIPTOR_LEN)
' const HID_ReportDesc_len = 115
const HID_ReportDesc_len = 78
const Low_HID_ReportDesc_len = HID_ReportDesc_len
const High_HID_ReportDesc_len = HID_ReportDesc_len >> 8
const Low_HID_PACKET_SIZE = HID_PACKET_SIZE
const High_HID_PACKET_SIZE = HID_PACKET_SIZE >> 8
'******************************************************************************
' Descriptor Tables
'******************************************************************************
' const DescTables as byte[USB_DEVICE_DESCRIPTOR_ALL_LEN*2] = (
' const DescTables as byte[(18+9+9+9+7+7+115)*2] = (
const DescTables as byte[(18+9+9+9+7+7+78)*2] = (
' Device Descriptor
USB_DEVICE_DESCRIPTOR_LEN, 0, ' bLength - Length of Device descriptor (always 0x12)
USB_DEVICE_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 1 = DEVICE descriptor
0x00, 0, ' bcdUSB - USB revision 2.00 (low byte)
0x02, 0, ' (high byte)
0x00, 0, ' bDeviceClass - Zero means each interface operates independently (class code in the interface descriptor)
0x00, 0, ' bDeviceSubClass
0x00, 0, ' bDeviceProtocol
EP0_PACKET_SIZE, 0, ' bMaxPacketSize0 - maximum size of a data packet for a control transfer over EP0
0x02, 0, ' idVendor - Vendor ID (low byte)
0x07, 0, ' (high byte)
0x13, 0, ' idProduct - Product ID (low byte)
0x20, 0, ' (high byte)
0x21, 0, ' bcdDevice - (low byte)
0x01, 0, ' (high byte)
0x01, 0, ' iManufacturer - String1
0x02, 0, ' iProduct - String2
0x03, 0, ' iSerialNumber - String3
0x01, 0, ' bNumConfigurations - 1
'------------------------------------------------------------------------------
' Configuration Descriptor
USB_CONFIG_DESCRIPTOR_LEN, 0, ' bLength - Length of Configuration descriptor (always 0x09)
USB_CONFIG_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 2 = CONFIGURATION descriptor
ConfigDescr_wTotalLength, 0, ' wTotalLength - Total length of this config. descriptor plus the interface and endpoint descriptors that are part of the configuration.
0x00, 0, ' (high byte)
0x01, 0, ' bNumInterfaces - Number of interfaces
0x01, 0, ' bConfigurationValue - Configuration Value
0x00, 0, ' iConfiguration - String Index for this configuration ( None )
0xA0, 0, ' bmAttributes - attributes - "Bus powered" and "Remote wakeup"
50, 0, ' MaxPower - bus-powered draws 50*2 mA from the bus.
'------------------------------------------------------------------------------
' Interface Descriptor
USB_INTERF_DESCRIPTOR_LEN, 0, ' bLength - Length of Interface descriptor (always 0x09)
USB_INTERFACE_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 4 = INTERFACE descriptor
0x00, 0, ' bInterfaceNumber - Number of interface, 0 based array
0x00, 0, ' bAlternateSetting - Alternate setting
NUM_ENDPOINTS, 0, ' bNumEndPoints - Number of endpoints used in this interface
0x03, 0, ' bInterfaceClass - assigned by the USB
0x00, 0, ' bInterfaceSubClass - Not A boot device
0x00, 0, ' bInterfaceProtocol - none
0x00, 0, ' iInterface - Index to string descriptor that describes this interface ( None )
'------------------------------------------------------------------------------
' HID Descriptor
USB_HID_DESCRIPTOR_LEN, 0, ' bLength - Length of HID descriptor (always 0x09)
USB_HID_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 0x21 = HID descriptor
0x01, 0, ' HID class release number (1.01)
0x01, 0,
0x00, 0, ' Localized country code (none)
0x01, 0, ' # of HID class descriptor to follow (1)
0x22, 0, ' Report descriptor type (HID)
Low_HID_ReportDesc_len, 0,
High_HID_ReportDesc_len, 0,
'------------------------------------------------------------------------------
' EP1_RX Descriptor
USB_ENDP_DESCRIPTOR_LEN, 0, ' bLength - length of descriptor (always 0x07)
USB_ENDPOINT_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 5 = ENDPOINT descriptor
0x81, 0, ' bEndpointAddress - In, EP1
USB_ENDPOINT_TYPE_INTERRUPT, 0, ' bmAttributes - Endpoint Type - Interrupt
Low_HID_PACKET_SIZE, 0, ' wMaxPacketSize - max packet size - low order byte
High_HID_PACKET_SIZE, 0, ' - max packet size - high order byte
1, 0, ' bInterval - polling interval (1 ms)
'------------------------------------------------------------------------------
' EP1_TX Descriptor
USB_ENDP_DESCRIPTOR_LEN, 0, ' bLength - length of descriptor (always 0x07)
USB_ENDPOINT_DESCRIPTOR_TYPE, 0, ' bDescriptorType - 5 = ENDPOINT descriptor
0x01, 0, ' bEndpointAddress - Out, EP1
USB_ENDPOINT_TYPE_INTERRUPT, 0, ' bmAttributes - Endpoint Type - Interrupt
Low_HID_PACKET_SIZE, 0, ' wMaxPacketSize - max packet size - low order byte
High_HID_PACKET_SIZE, 0, ' - max packet size - high order byte
1, 0, ' bInterval - polling interval (1 ms)
'------------------------------------------------------------------------------
' HID_Report Descriptor
' USB Data Map
'------------------------------------------------------------------------------
0x05, 0, 0x01, 0, ' USAGE_PAGE (Generic Desktop)
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x09, 0, 0x04, 0, ' USAGE (Joystick)
0xa1, 0, 0x01, 0, ' COLLECTION (Application)
'------------------------------------------------------------------------------
' 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 BYTE DATA ZA X, Y, Z, RX, RY, RZ, Dial, Slider OSU
0x05, 0, 0x01, 0, ' USAGE_PAGE (Generic Desktop)
0x15, 0, 0x00, 0,
0x26, 0, ' LOGICAL_MINIMUM (0)
0xFF, 0, 0x03, 0, ' LOGICAL_MAXIMUM (1024)
0x75, 0, 0x10, 0, ' REPORT_SIZE (16)
0xa1, 0, 0x00, 0, ' COLLECTION (Physical)
0x09, 0, 0x35, 0, ' USAGE (RZ)
0x09, 0, 0x30, 0, ' USAGE (X)
0x09, 0, 0x31, 0, ' USAGE (Y)
0x09, 0, 0x32, 0, ' USAGE (Z)
0x09, 0, 0x33, 0, ' USAGE (RX)
0x09, 0, 0x34, 0, ' USAGE (RY)
0x09, 0, 0x36, 0, ' USAGE (Dial)
0x09, 0, 0x37, 0, ' USAGE (Slider)
0x95, 0, 0x08, 0, ' REPORT_COUNT (8)
0x81, 0, 0x02, 0, ' INPUT (Data,Var,Abs)
0xc0, 0, ' END_COLLECTION
'------------------------------------------------------------------------------
' 17 1/2 BYTE DATA ZA HAT POZICIJU i 2/2 BYTE ZA BUTTONS
0x05, 0, 0x01, 0, ' USAGE_PAGE (Generic Desktop)
0x09, 0, 0x39, 0, ' USAGE (Hat switch)
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x25, 0, 0x07, 0, ' LOGICAL_MAXIMUM (1)
0x35, 0, 0x00, 0, ' PHYSICAL_MINIMUM (0)
0x46, 0, 0x68, 0, '
0x01, 0, ' PHYSICAL_MAXIMUM (360)
0x55, 0, 0x0F, 0, ' UNIT (Eng Rot:Angular Pos)
0x75, 0, 0x04, 0, ' REPORT_SIZE (4)
0x95, 0, 0x01, 0, ' REPORT_COUNT (1)
0x81, 0, 0x02, 0, ' INPUT (Data,Var,Abs)
'------------------------------------------------------------------------------
' 18 BYTE DATA ZA Buttons POZICIJU
0x05, 0, 0x09, 0, ' USAGE_PAGE (Buttons)
0x19, 0, 0x01, 0, ' Usage Minimum
0x29, 0, 0x12, 0, ' Usage Maximum
0x15, 0, 0x00, 0, ' LOGICAL_MINIMUM (0)
0x25, 0, 0x01, 0, ' LOGICAL_MAXIMUM (1)
0x75, 0, 0x01, 0, ' REPORT_SIZE (1)
0x95, 0, 0x0C, 0, ' REPORT_COUNT (12)
0x81, 0, 0x02, 0, ' INPUT (Data,Var,Abs)
'------------------------------------------------------------------------------
0xc0, 0 ' END_COLLECTION
)
'******************************************************************************
const LangIDDescr as byte[8] = (
0x04, 0,
USB_STRING_DESCRIPTOR_TYPE, 0,
0x09, 0, ' LangID (0x0409) - Low
0x04, 0 ' - High
)
'******************************************************************************
const ManufacturerDescr as byte[28] = (
14, 0,
USB_STRING_DESCRIPTOR_TYPE, 0,
"8", 0, 0, 0,
"-", 0, 0, 0,
"B", 0, 0, 0,
"i", 0, 0, 0,
"t", 0, 0, 0,
"a", 0, 0, 0
)
'******************************************************************************
const ProductDescr as byte[116] = (
58, 0,
USB_STRING_DESCRIPTOR_TYPE, 0,
"U", 0, 0, 0,
"S", 0, 0, 0,
"B", 0, 0, 0,
" ", 0, 0, 0,
"J", 0, 0, 0,
"O", 0, 0, 0,
"Y", 0, 0, 0,
"S", 0, 0, 0,
"T", 0, 0, 0,
"I", 0, 0, 0,
"C", 0, 0, 0,
" ", 0, 0, 0,
"B", 0, 0, 0,
"Y", 0, 0, 0,
" ", 0, 0, 0,
"S", 0, 0, 0,
"5", 0, 0, 0,
"9", 0, 0, 0,
"K", 0, 0, 0,
"B", 0, 0, 0,
" ", 0, 0, 0,
"1", 0, 0, 0,
"0", 0, 0, 0,
" ", 0, 0, 0,
"B", 0, 0, 0,
"I", 0, 0, 0,
"T", 0, 0, 0,
" ", 0, 0, 0
)
'******************************************************************************
const StrUnknownDescr as byte[36] = (
18, 0,
USB_STRING_DESCRIPTOR_TYPE, 0,
Serial_No[0], 0, 0, 0,
Serial_No[1], 0, 0, 0,
Serial_No[2], 0, 0, 0,
Serial_No[3], 0, 0, 0,
Serial_No[4], 0, 0, 0,
Serial_No[5], 0, 0, 0,
Serial_No[6], 0, 0, 0,
Serial_No[7], 0, 0, 0
)
'******************************************************************************
implements
end.
And finally
Live long and prosper 73 de S59KB