Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Heres the code that Easy HID created. I set up an led to see where the code stops at. It seems to stop after
USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, . I guess this is because I dont have any code right now to send data, but I was more concerned with the pc recognizing the pic.
If usbinit is called, doesnt the pc enumerate the usb device? It never shows that a hid device is connected. Is there something I am missing to get the pc to recognize this device?!
DEFINE OSC 48
DEFINE LOADER_USED 1
USBBufferSizeMax con 8 ' maximum buffer size
USBBufferSizeTX con 8 ' input
USBBufferSizeRX con 8 ' output
' 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:
gosub DoUSBOut
goto ProgramStart
' ************************************************** **********
' * wait for USB interface to attach *
' ************************************************** **********
DoUSBOut:
USBBufferCount = USBBufferSizeTX ' TX buffer size
USBService ' keep connection alive
USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
return
That's not the "Whole" code that easyHID created.
You've deleted some things that are very important.
If you just want to see it enumerate, change the main loop to this...But that will neither send or receive any data.Code:ProgramStart: USBService ' keep connection alive goto ProgramStart
This also assumes you've setup your Configs properly.
DT
Oh, I took out the code for receiving data from the pc to the pic. I just want to communicate to the pc side.
All the configs are what easyhid has set up. I will try just polling serviceusb and see if that can get the pic to enumerate. Thanks
What Darrel talked about was the PIC configuration Fuses... which EasyHID don't create for you.
http://www.picbasic.co.uk/forum/showthread.php?t=543
http://www.picbasic.co.uk/forum/showthread.php?t=5418
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I still cant get the pic to enumerate.
Here is my code for the fuses:
else
LIST
LIST p = 18F2550, r = dec, w = -311, w = -230, f = inhx32
INCLUDE "C:\PBasPro Projects\AirDrum\PICBasicPRO\P18F2550.INC" ; MPASM Header
__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
__CONFIG _CONFIG1H, _FOSC_XTPLL_XT_1H & _IESO_OFF_1H
__CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOR_OFF_2L & _BORV_2_2L & _VREGEN_OFF_2L
__CONFIG _CONFIG2H, _WDT_OFF_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H
__CONFIG _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
NOLIST
endif
Here is the main code again:
DEFINE OSC 48
DEFINE LOADER_USED 1
USBBufferSizeMax con 8 ' maximum buffer size
USBBufferSizeTX con 8 ' input
USBBufferSizeRX con 8 ' output
' the USB buffer...
USBBuffer Var Byte[USBBufferSizeMax]
USBBufferCount Var Byte
i 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:
'gosub DoUSBIn
'gosub DoUSBOut
High PORTB.0
for i = 1 to 10
Pause 2
USBservice
next i
LOW PORTB.0
for i = 1 to 10
Pause 2
USBservice
next i
goto ProgramStart
' ************************************************** **********
' * receive data from the USB bus *
' ************************************************** **********
DoUSBIn:
USBBufferCount = USBBufferSizeRX ' RX buffer size
USBService ' keep connection alive
USBIn 1, USBBuffer, USBBufferCount, DoUSBIn ' read data, if available
return
' ************************************************** **********
' * wait for USB interface to attach *
' ************************************************** **********
DoUSBOut:
USBBufferCount = USBBufferSizeTX ' TX buffer size
USBService ' keep connection alive
USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
return
The LED lights up correctly, but the pic still does not enumerate even with calling the USBSERVICE. I have 0.5microF on VSUB, 20 MHZ crystal with 33 pF connected to it. D+, D- set up correctly. Bus powered.
I have no idea what the problem is!
Bookmarks