PDA

View Full Version : dummie joystick guide problem



jsags1
- 23rd April 2014, 04:38
Hello gentlemen, im new to the forum and dont really know much about usb or PBP3 so sorry for the may-be dumb question since i use HITECH-C

i did all off the dummies guide stuff but in the end, it asks me to compile, compile where? in MPLAB?

ok so i compiled on mplab using the PBP3 compiler on the 15 trial version and it gives me the following:

Executing: "C:\Program Files (x86)\PBP3\PBPX.EXE" -ampasmwin -k# -p18F2550 "C:\Users\Aramburo\Desktop\Nueva carpeta\HUB.pbp"
PICBASIC PRO(TM) Compiler 3.0.7.1, (c) 1998, 2013 microEngineering Labs, Inc.
All Rights Reserved.
Trial version. 15 days left.
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 761 : Symbol not previously defined (USBDeviceInit)
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 762 : Symbol not previously defined (USBDeviceInit)
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 761 : Symbol not previously defined (USBDeviceTasks)
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 762 : Symbol not previously defined (USBDeviceTasks)
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 761 : Symbol not previously defined (GetUSB)
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 762 : Symbol not previously defined (GetUSB)
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 761 : Symbol not previously defined (USBDeviceTasks)
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 762 : Symbol not previously defined (USBDeviceTasks)
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 761 : Symbol not previously defined (PutUSB)
Error[113] C:\PROGRAM FILES (X86)\PBP3\PBPPIC18.LIB 762 : Symbol not previously defined (PutUSB)
Halting build on first failure as requested.
BUILD FAILED: Tue Apr 22 22:54:59 2014



apart from this, i would really like to know where do i configure my PIC18f2550??

do i make a .c file?? (i.e MY_JOYSTICK.c)
and work from there??
how do i prevent/correct this compile errors??

also, where can i find the circuit diagram for this "dummie" joystick, thanks a bunch guys and see you later


i posted the same thing on another thread, but i am new to the forum and dont know if that was the appropriate way. let me know. thanks

Demon
- 23rd April 2014, 18:05
dont really know much about usb or PBP3 so sorry for the may-be dumb question since i use HITECH-C

PBP stands for PIC BASIC PRO and you are using C.

Robert

HenrikOlsson
- 23rd April 2014, 18:57
Hi,
Come on Robert :-)
He says that he's compiled the program with PBP3 and the posted error messages supports that statement saying PBPX version 3.0.7.1.

Unfortunately I don't know my way around the USB stuff so I'm not able to help with that except for suggesting to read thru the USB.TXT document in the \PBP3\USB18 folder and trying to compile the examples provided to start with.

Regarding the i would really like to know where do i configure my PIC18f2550 statement I suspect you mean the configuration fuses and if that's the case look at the #CONFIG / #ENDCONFIG directives in the manual.

/Henrik.

Demon
- 23rd April 2014, 22:46
I noticed that, but he didn't post any code. It could just as well be C for all we know.

It would help posting all the code.

Robert
:)

HenrikOlsson
- 24th April 2014, 06:10
Oh, you mean like trying to compile C source code with PBP? Yeah, that would most definitely produce "some" errors :-)
That's just "so wrong" I didn't even think of it.....
Clarifications and code needed.

/Henrik.

jsags1
- 27th April 2014, 01:43
ok, this is what i got so far, all i really did was to turn TRISA into inputs and slightly modyfied the code to what i think would work with the 4 buttons but without the axis. and i get this errors.

MY code;

DEFINE OSC 48
DEFINE LOADER_USED 1
include "DESCUSBTRYTRYJOY.asm"

TRISA = 0


USBBufferSizeMax con 1 ' maximum buffer size
USBBufferSizeTX con 1 ' input

' the USB buffer...
USBBuffer Var Byte[USBBufferSizeMax]
USBBufferCount Var Byte

' ************************************************** **********
' * main program loop - remember, you must keep the USB *
' * connection alive with a call to USBService every couple *
' * of milliseconds or so... *
' ************************************************** **********
usbinit ' initialise USB...
ProgramStart:
USBBuffer.0(0) = porta.0
USBBuffer.0(1) = porta.1
USBBuffer.0(2) = porta.2
USBBuffer.0(3) = porta.3

gosub DoUSBOut
goto ProgramStart




MY ERRORS;

7318



thanks for any advice

Demon
- 27th April 2014, 15:03
Darrel's usb routine:

http://www.picbasic.co.uk/forum/showthread.php?t=5418&page=6&p=80434#post80434

Where did you get that include file? What are the contents?

Robert

jsags1
- 28th April 2014, 00:16
i got the file from EasyHID and added the descriptor from the Descriptor tool like the DUMMY guide said, here are its contents:



#define EP0_BUFF_SIZE 64 ; 8, 16, 32, or 64
#define MAX_NUM_INT 1 ; For tracking Alternate Setting
#define MAX_EP_NUMBER 1 ; UEP1
#define NUM_CONFIGURATIONS 1
#define NUM_INTERFACES 1

#define MODE_PP _PPBM0
#define UCFG_VAL _PUEN|_TRINT|_FS|MODE_PP ; Full-speed

; DEVICE CLASS USAGE
#define USB_USE_HID

; HID
; Endpoints Allocation
#define HID_INTF_ID 0x00
#define HID_UEP UEP1
#define HID_BD_OUT ep1Bo
#define HID_INT_OUT_EP_SIZE 64
#define HID_BD_IN ep1Bi
#define HID_INT_IN_EP_SIZE 64
#define HID_NUM_OF_DSC 1

; ************************************************** ****************
; This table is polled by the host immediately after USB Reset has been released.
; This table defines the maximum packet size EP0 can take.
; See section 9.6.1 of the Rev 1.0 USB specification.
; These fields are application DEPENDENT. Modify these to meet
; your specifications.
; ************************************************** ****************
DeviceDescriptor
retlw (EndDeviceDescriptor-DeviceDescriptor)/2 ; bLength Length of this descriptor
retlw DSC_DEV ; bDescType This is a DEVICE descriptor
retlw 0x10 ; bcdUSBUSB Revision 1.10 (low byte)
retlw 0x01 ; high byte
retlw 0x00 ; bDeviceClass zero means each interface operates independently
retlw 0x00 ; bDeviceSubClass
retlw 0x00 ; bDeviceProtocol
retlw EP0_BUFF_SIZE ; bMaxPacketSize for EP0

; idVendor (low byte, high byte)
retlw 0x81
retlw 0x17

; idProduct (low byte, high byte)
retlw 0xD0
retlw 0x07

retlw 0x00 ; bcdDevice (low byte)
retlw 0x00 ; (high byte)
retlw 0x01 ; iManufacturer (string index)
retlw 0x02 ; iProduct (string index)

; iSerialNumber (string index)
retlw 0x00
retlw NUM_CONFIGURATIONS ; bNumConfigurations
EndDeviceDescriptor

; ************************************************** ****************
; This table is retrieved by the host after the address has been set.
; This table defines the configurations available for the device.
; See section 9.6.2 of the Rev 1.0 USB specification (page 184).
; These fields are application DEPENDENT.
; Modify these to meet your specifications.
; ************************************************** ****************
; Configuration pointer table
USB_CD_Ptr
Configs
db low Config1, high Config1
db low Config1, high Config1

; Configuration Descriptor
Config1
retlw (Interface1-Config1)/2 ; bLength Length of this descriptor
retlw DSC_CFG ; bDescType 2=CONFIGURATION
Config1Len
retlw low ((EndConfig1 - Config1)/2) ; Length of this configuration
retlw high ((EndConfig1 - Config1)/2)
retlw 0x01 ; bNumInterfaces Number of interfaces
retlw 0x01 ; bConfigValue Configuration Value
retlw 0x00 ; iConfig (string index)
retlw 0xA0 ; bmAttributes attributes - bus powered

; Max power consumption (2X mA)
retlw 0x32
Interface1
retlw (HIDDescriptor1-Interface1)/2 ; length of descriptor
retlw DSC_INTF
retlw 0x00 ; number of interface, 0 based array
retlw 0x00 ; alternate setting
retlw 0x02 ; number of endpoints used in this interface
retlw 0x03 ; interface class - assigned by the USB
retlw 0x00 ; boot device
retlw 0x00 ; interface protocol - mouse
retlw 0x00 ; index to string descriptor that describes this interface
HIDDescriptor1
retlw (Endpoint1In-HIDDescriptor1)/2 ; descriptor size (9 bytes)
retlw 0x21 ; descriptor type (HID)
retlw 0x00 ; HID class release number (1.00)
retlw 0x01
retlw 0x00 ; Localized country code (none)
retlw 0x01 ; # of HID class descriptor to follow (1)
retlw 0x22 ; Report descriptor type (HID)
ReportDescriptor1Len
retlw low ((EndReportDescriptor1-ReportDescriptor1)/2)
retlw high ((EndReportDescriptor1-ReportDescriptor1)/2)
Endpoint1In
retlw (EndPoint1Out-Endpoint1In)/2 ; length of descriptor
retlw DSC_EP
retlw 0x81 ; EP1, In
retlw 0x03 ; Interrupt
retlw 0x40 ; This should be the size of the endpoint buffer
retlw 0x00
retlw 0x0A ; Polling interval
EndPoint1Out
retlw (EndConfig1-EndPoint1Out)/2 ; Length of this Endpoint Descriptor
retlw DSC_EP ; bDescriptorType = 5 for Endpoint Descriptor
retlw 0x01 ; Endpoint number & direction
retlw 0x03 ; Transfer type supported by this Endpoint
retlw 0x40 ; This should be the size of the endpoint buffer
retlw 0x00
retlw 0x0A ; Polling interval
EndConfig1

ReportDescriptor1
; vendor defined usage page
RETLW 0x05
RETLW 0x01 ; USAGE_PAGE (Generic Desktop)
RETLW 0x09
RETLW 0x04 ; USAGE (Joystick)
RETLW 0xa1
RETLW 0x01 ; COLLECTION (Application)
RETLW 0x09
RETLW 0x04 ; USAGE (Joystick)
RETLW 0xa1
RETLW 0x00 ; COLLECTION (Physical)
RETLW 0x05
RETLW 0x09 ; USAGE_PAGE (Button)
RETLW 0x19
RETLW 0x01 ; USAGE_MINIMUM (Button 1)
RETLW 0x29
RETLW 0x04 ; USAGE_MAXIMUM (Button 4)
RETLW 0x15
RETLW 0x00 ; LOGICAL_MINIMUM (0)
RETLW 0x25
RETLW 0x01 ; LOGICAL_MAXIMUM (1)
RETLW 0x95
RETLW 0x08 ; REPORT_COUNT (8)
RETLW 0x75
RETLW 0x01 ; REPORT_SIZE (1)
RETLW 0x81
RETLW 0x02 ; INPUT (Data Var Abs)
RETLW 0xc0 ; END_COLLECTION
RETLW 0xc0 ; END_COLLECTION

EndReportDescriptor1

; String pointer table
USB_SD_Ptr
Strings
db low String0, high String0
db low String1, high String1
db low String2, high String2
db low String3, high String3

String0
retlw (String1-String0)/2 ; Length of string
retlw DSC_STR ; Descriptor type 3
retlw 0x09 ; Language ID (as defined by MS 0x0409)
retlw 0x04

; company name
String1
retlw (String2-String1)/2
retlw DSC_STR

retlw 'M'
retlw 0x00
retlw 'y'
retlw 0x00
retlw 'C'
retlw 0x00
retlw 'o'
retlw 0x00
retlw 'm'
retlw 0x00
retlw 'p'
retlw 0x00
retlw 'a'
retlw 0x00
retlw 'n'
retlw 0x00
retlw 'y'
retlw 0x00


; product name
String2
retlw (String3-String2)/2
retlw DSC_STR

retlw 'M'
retlw 0x00
retlw 'y'
retlw 0x00
retlw 'P'
retlw 0x00
retlw 'r'
retlw 0x00
retlw 'o'
retlw 0x00
retlw 'd'
retlw 0x00
retlw 'u'
retlw 0x00
retlw 'c'
retlw 0x00
retlw 't'
retlw 0x00

; serial number
String3
retlw (String4-String3)/2
retlw DSC_STR

Demon
- 28th April 2014, 15:35
Someone has mentionned problems with Easyhid and PBP 3. Check out Darrel's usb routine.

Robert

jsags1
- 30th April 2014, 21:28
Hmmm apparently my last post on this thread didnt upload....

ive spent the last few days trying to figure darrel USB routine (thanks by the way) but its only for PBP2.6

where can i get PBP2.6??

or

What other "dummy joystick" alternatives do i have??

Demon
- 30th April 2014, 23:13
Darn, hadn't noticed Darrel's comment about PBP 3.

Hoping a senior will jump in, that thread was my GOTO for USB and my v2.6c.

V2.6c no longer for sale as far as I know.

Robert

jsags1
- 1st May 2014, 00:11
Hey there Demon. I foud a solution.

You must place your project files inside USB18 folder (no sub-folders) in order to compile. I know that it sucks. But at least it workss!! :D

Demon
- 1st May 2014, 00:32
Awesome!

Gonna link back to here in that thread.

Robert
:)

Demon
- 1st May 2014, 00:42
Hey there Demon. I foud a solution.

You must place your project files inside USB18 folder (no sub-folders) in order to compile. I know that it sucks. But at least it workss!! :D

I bet there's a way to figure exactly which file is needed in that folder and copy that one in the project folder (along with all the other files).

Robert

jsags1
- 2nd May 2014, 02:57
yes, ill try and make some time to figure out wich files are needed in the project folder after im done with my project. im on tiral version and only have 5 days left!!! XD
thanks for the advice Demon